怎样把word文档保存到数据库中(How do I save the word document in the database)
怎样把word文档保存到数据库中(How do I save the word document
in the database)
Word97 can be directly used to insert database function. First, right-click on the toolbar, select database toolbar. Then in the "database" toolbar and select Insert database can be inserted into the database records. You can select the dialog box "will be recorded as domain insert", such as long as you can use F9 to update the database records.
Li Hai answered this question by the.
How to save the word document to the database? Master please return to the home page - the current index
How to write the contents of the database to Word document
How to write the contents of the database to the Word document? (Chen Yong) huguangtao (original)
Key words: database, Word, OLE
In programming, the Microsoft Word is very powerful editing functions, so we often hope that some data is saved as a WORD document, so that our professional editors.
In the save as a Word document, we can pass the OLE, but often encounter the real Word editing interface transferred to the program, to make the program interface confusion. Also, the ordinary methods of calling Word must specify the absolute address Word executable file, because many users install the
Word path are inconsistent, therefore, we often call the wrong problem, can have a method called the Word do not show it, has nothing to do with this version, the installation path? The answer is yes.
Here, I have to do a small program for everyone to demonstrate, only a valuable role to play. Only friends as a reference.
First of all, we set up a database of Access2000 data.mdb in the library, we set up a table UserData, there is a "number", "name", "gender", "the four sector" field is a string, and then input some data, then we establish a form in Form1 Form1. The following controls are placed:
Control name attribute value description
Tlabel1 Caption "please input the file name"
"TEdit1 Name" to enter the file name, with extension
TButton1 Caption save"
The TButton2 Caption exit"
ADOTable1 Active
ConnectionString
TableName True
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=data.mdb;
Persist Security Info=False
UserData
Here is the code:
File://---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
---------------------------------------------------------------------------
#pragma package (smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
---------------------------------------------------------------------------
__fastcall TForm1:: TForm1 (TComponent* Owner)
TForm (Owner)
{
}
---------------------------------------------------------------------------
Void __fastcall TForm1:: Button1Click (TObject *Sender)
{
Variant OLEObject;
AnsiString dataword;
If (Trim (Edit1->Text) = = "")
{
ShowMessage ("please input the file name);
Return;
}
String currentPath=GetCurrentDir (+) / / +Trim (Edit1->Text);
OLEObject=CreateOleObject ("Word.Basic");
OLEObject.Exec (Procedure ("FileNew"));
OLEObject.Exec (Procedure ("EndOfDocument"));
(ADOTable1->First);
While (ADOTable1->Eof =True!)
{
dataword = adotable1 - > fieldvalues ["工号"] + adotable1 - >
fieldvalues ["姓名"] + adotable1 - > fieldvalues ["性别"] +
adotable1 - > fieldvalues ["部门"];
oleobject.exec (procedure ("insert") < < dataword);
adotable1 - > next ();
}
oleobject.exec (procedure ("startofdocument"));
oleobject.exec (procedure ("filesaveas") < < currentpath);
oleobject.exec (procedure ("fileclose") < < 1);
showmessage ("文件已经写入! 谢谢使用!");
}
---------------------------------------------------------------------------
from _ _ fastcall tform1:: button2click (tobject * sender)
{
this - > close ();
}
---------------------------------------------------------------------------
from _ _ fastcall tform1:: edit1click (tobject * sender)
{
edit1 - > text = "";
}
版权声明: csdn是本blog托管服务提供商.如本文牵涉版权问题,
csdn不承担相关责任, 请版权拥有者直接与文章作者联系解决.
主 题: 怎样把word文档保存到数据库中? 高手请指教
我用的oracle数据库, 有long raw类型字段, delphi怎样把word
文件保存到数据库呢? 谢谢!
回复人: david _ wwb (时代超人) () 信誉: 97 2002 - 06 - 25 11: 17: 24z 得分: 1
????
流可能可以
top
回复人: mv66 _ ren (didi [迪迪]) () 信誉: 96 2002 - 06 - 25 16:
00: 51z 得分: 0
????
具体怎样实现, 能提示一下吗?
top
回复人: mv66 _ ren (didi [迪迪]) () 信誉: 96 2002 - 06 - 08 26:
18: 09z 得分: 0
????
难道真的没人能帮助我吗?
top
回复人: mv66 _ ren (didi [迪迪]) () 信誉: 96 2002 - 06 - 26 09:
52: 58z 得分: 0
????
我用流试了试但还有错误!
top
回复人: netwg () () 信誉: 100 2002 - 07 - 10 19: 14: 50z 得
分: 0
????
大家可以继续讨论!
top
回复人: netwg () () 信誉: 100 2002 - 07 - 10 19: 17: 55z 得
分: 18
????
procedure tform1.button1click (sender: tobject);
var memorystream: tmemorystream;
begin
clientdataset1. open;
memorystream: = tmemorystream. create;
try
olecontainer1.savetostream (memorystream);
memorystream. position: = 0;
clientdataset1. first;
clientdataset1. edit;
tblobfield (clientdataset1.fieldbyname ('photo')).loadfromstream (memorystream);
/ / clientdataset1photo.loadfromstream (memorystream);
clientdataset1. post;
clientdataset1.applyupdates (- 1); / / 这句是必须的.
finally
memorystream. free;
end;
end;
procedure tform1.button2click (sender: tobject);
was memorystream: tmemorystream;
begin
memorystream: = tmemorystream. create;
try
tblobfield (clientdataset1.fieldbyname ("photo")).savetostream (memorystream);
memorystream. position: = 0;
olecontainer2.loadfromstream (memorystream); / / 不出错, 内容正确!
/ / olecontainer.refresh;
finally
memorystream. free;
end;
top
该问题已经结贴, 得分记录: david _ wwb (1) 、 netwg (18) 、
本文档为【怎样把word文档保存到数据库中(How do I save the word document in the database)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。