R
river
Unregistered / Unconfirmed
GUEST, unregistred user!
i am using a OleContainer to load and modify MS WORD document,
and using OleContainer.SaveToStream to save data to TBlobStream which
is using to write to a TBlobField.
Problem:the first click in NewBlobButton is ok,but the second click is wrong,the wrong line is " OleContainer1.SaveToStream(obBlobStream);" with the message: "BLOB not opened"
program as follow:
procedure TForm1.FormCreate(Sender: TObject);
begin
Table1.Open;
Table1.First;
if Table1.Bof then
Table1.Append;
OleContainer1.CreateObjectFromFile('new.doc',False);
end;
procedure TForm1.NewBlobButtonClick(Sender: TObject);
var
obBlobStream:TBlobStream;
begin
Table1.Edit;
obBlobStream:=TBlobStream.Create(Table1ob,bmReadWrite); { Table1ob is BlobField }
OleContainer1.SaveToStream(obBlobStream); {***wrong in the cliking in second time with message: "blob not open"***}
Table1.Post;
obBlobStream.Free;
table1.Append;
OleContainer1.CreateObjectFromFile('new.doc',False);
end;
请问错在那里?
and using OleContainer.SaveToStream to save data to TBlobStream which
is using to write to a TBlobField.
Problem:the first click in NewBlobButton is ok,but the second click is wrong,the wrong line is " OleContainer1.SaveToStream(obBlobStream);" with the message: "BLOB not opened"
program as follow:
procedure TForm1.FormCreate(Sender: TObject);
begin
Table1.Open;
Table1.First;
if Table1.Bof then
Table1.Append;
OleContainer1.CreateObjectFromFile('new.doc',False);
end;
procedure TForm1.NewBlobButtonClick(Sender: TObject);
var
obBlobStream:TBlobStream;
begin
Table1.Edit;
obBlobStream:=TBlobStream.Create(Table1ob,bmReadWrite); { Table1ob is BlobField }
OleContainer1.SaveToStream(obBlobStream); {***wrong in the cliking in second time with message: "blob not open"***}
Table1.Post;
obBlobStream.Free;
table1.Append;
OleContainer1.CreateObjectFromFile('new.doc',False);
end;
请问错在那里?