How will the word document read out from the database?

Category: Delphi -> Database Author: willy67 Date: 2009-09-03 06:27:32
 
willy67
2009-09-03 06:27:32
I now have word file into access database, but you can not read them out?
Please advice twelve, be grateful.
bangbag
2009-09-03 06:54:31
read with Tstream easy enough
flyovr
2009-09-03 07:27:38
Levi ADO that book presentations, look go
hzdj1234
2009-09-03 08:01:52
"Livy ADO that book have introduced"

Which book? Where can I find. I have encountered the same problem.
pan656
2009-09-03 08:08:28
Where there is the electronic version of the book?
shuwei12
2009-09-03 08:16:20
is simply to use TBLOBStream and TMemoryStream. There are many such articles, previously been asked.
you have a good look for it.
right, a lot of people have mentioned Livy wrote the book, in the end what is the book that way? What is the name ah? I am also very want to see ...
bugtracker
2009-09-03 08:31:38
This problem has a lot of posts, which gave me a hint
var
MemSize: Integer;
Buffer: PChar;
MyFile: TFileStream;
Stream: TBlobStream;
begin
; MyFile: = TFileStream.Create ('c: \ temp.tmp', fmCreate);
with table1 do
; begin
Open;
Stream: = TBlobStream.Create (FieldByName ('Doc') ; as TBlobField, bmRead);
MemSize: = Stream.Size;
Inc (MemSize);
Buffer: = AllocMem (MemSize);
try
Stream.Read (Buffer ^, MemSize);
MyFile . Write (Buffer ^, MemSize);
statictext1.caption: = 'File name:' + FieldByName ('Name'). Asstring;
statictext2.caption: = 'File size:' + FieldByName ('Size'). Asstring + 'bytes';
; finally
MyFile.Free;
Stream.Free;
end;
end;
if FileExists ('c: \ temp.DOC') then
DeleteFile ('c: \ temp.DOC ');
if FileExists (' c: \ temp.tmp ') then
begin
RenameFile ('c: \ temp.tmp', 'c: \ temp.DOC');
Doc_ole.CreateObjectFromFile ('c: \ temp.DOC', False);
Doc_ole.Run;
hope you will be satisfied with
cmmi20100107
2009-09-03 08:40:13

procedure TComposetypeForm.DbToWord (ViewADOQuery: TADOQuery; TitleFile, AnswerFile: String) ;/ / from the database to Word Temporary files
var
TitleSize, AnswerSize: integer; TitleBuffer, AnswerBuffer: PChar;
TitleFileStream, AnswerFileStream: TFileStream; TitleBlobStream , AnswerBlobStream: TStream;
begin
if ViewADOQuery.RecNo> 0 then
begin
TitleFileStream: = TFileStream.Create (MainForm.ApplicationPath + 'Title.tmp', fmCreate);
AnswerFileStream: = TFileStream.Create (MainForm.ApplicationPath + 'Answer. tmp ', fmCreate);
with ViewADOQuery do
begin
open;
TitleBlobStream: = CreateBlobStream (FieldByName ('Title') as TBlobField, bmRead);
TitleSize: = TitleBlobStream.Size; TitleBuffer: = AllocMem (TitleSize);
; AnswerBlobStream: = CreateBlobStream (FieldByName ('Answer') as TBlobField, bmRead);
AnswerSize: = AnswerBlobStream.Size; AnswerBuffer: = AllocMem (AnswerSize);
Try
; TitleBlobStream.Read (TitleBuffer ^, TitleSize); TitleFileStream.Write (TitleBuffer ^, TitleSize);
; AnswerBlobStream.Read (AnswerBuffer ^, AnswerSize); AnswerFileStream.Write (AnswerBuffer ^, AnswerSize);
finally
TitleBlobStream.Free; TitleFileStream.Free;
AnswerBlobStream.Free; AnswerFileStream.Free;
end;
end;
if FileExists (TitleFile) then DeleteFile (TitleFile);
if FileExists (MainForm.ApplicationPath + 'Title.tmp ') then Renamefile (MainForm.ApplicationPath +' Title.tmp ', TitleFile);
if FileExists (AnswerFile) then DeleteFile (AnswerFile);
if FileExists (MainForm.ApplicationPath + 'Answer.tmp') then Renamefile (MainForm.ApplicationPath + 'Answer.tmp', AnswerFile);
End;
end;
whf83109591
2009-09-03 08:55:32
the problem I have Zhengchou go again!
experts do not know who said Levi ADO is what this book? Please express, thank you.