W
wljcr
Unregistered / Unconfirmed
GUEST, unregistred user!
我想把word文件内容读取出来存放到数据库中(sql sever),然后我想不用word打印出来,用
quickRep打印出来,还有对word文件内容可以进行查询时浏览,我应该怎么做,怎么把word中的内容
存放到数据库中,然后通过什么可以显示出来,并且可以进行打印??
我有一段程序是这个样子的:
procedure TForm1.Button1Click(Sender: TObject);
var
MemSize: Integer;
Buffer: PChar;
MyFile: TFileStream;
Stream: TBlobStream;
begin
OpenDialog1.Filter:='WORD文档(*.DOC)|*.DOC';{从对话窗选择文件}
if OpenDialog1.Execute then
begin
MyFile:=TFileStream.Create(OpenDialog1.FileName ,fmOpenRead);
with table2 do
{‘table2’为含BLOB字段的表名}
begin
//Open;
Edit;
Stream := TBlobStream.Create(Fieldbyname('content')as TBlobField, bmWrite);{‘content’为BLOB字段名}
MemSize := MyFile.Size;
Inc(MemSize);
{Make room for the buffer's nullterminator.}
Buffer := AllocMem(MemSize);
{Allocate thememory.}
try
Stream.Seek(0, soFrombegin
ning);
{Seek 0 bytesfrom the stream's end point}
MyFile.Read(Buffer^,MemSize);
Stream.Write(Buffer^,MemSize);
finally
MyFile.Free;
Stream.Free;
end;
try
Post;
except
on E: EDatabaseErrordo
if application.HandleException(E) <> 0 then
exit
else
raise;
end;
end;
do
c_ole.CreateObjectFromFile(OpenDialog1.FileName,False);
do
c_ole.Run;{Doc_ole为ToleContainer构件名}
end;
end;
请各位大虾指教一二!
quickRep打印出来,还有对word文件内容可以进行查询时浏览,我应该怎么做,怎么把word中的内容
存放到数据库中,然后通过什么可以显示出来,并且可以进行打印??
我有一段程序是这个样子的:
procedure TForm1.Button1Click(Sender: TObject);
var
MemSize: Integer;
Buffer: PChar;
MyFile: TFileStream;
Stream: TBlobStream;
begin
OpenDialog1.Filter:='WORD文档(*.DOC)|*.DOC';{从对话窗选择文件}
if OpenDialog1.Execute then
begin
MyFile:=TFileStream.Create(OpenDialog1.FileName ,fmOpenRead);
with table2 do
{‘table2’为含BLOB字段的表名}
begin
//Open;
Edit;
Stream := TBlobStream.Create(Fieldbyname('content')as TBlobField, bmWrite);{‘content’为BLOB字段名}
MemSize := MyFile.Size;
Inc(MemSize);
{Make room for the buffer's nullterminator.}
Buffer := AllocMem(MemSize);
{Allocate thememory.}
try
Stream.Seek(0, soFrombegin
ning);
{Seek 0 bytesfrom the stream's end point}
MyFile.Read(Buffer^,MemSize);
Stream.Write(Buffer^,MemSize);
finally
MyFile.Free;
Stream.Free;
end;
try
Post;
except
on E: EDatabaseErrordo
if application.HandleException(E) <> 0 then
exit
else
raise;
end;
end;
do
c_ole.CreateObjectFromFile(OpenDialog1.FileName,False);
do
c_ole.Run;{Doc_ole为ToleContainer构件名}
end;
end;
请各位大虾指教一二!