其实你可以分别把blob的字段分别生成.doc文件(当然通过olecontainer来实现了)
然后按照我的方法处理就可以了。
Procedure BlobFld2OleSaveasdoc(var dataQuery:TQuery;fldName:String; Ole: TOleContainer);
var
OleStream:Tstream;
NameId: String;
begin
NameId := dataQuery.FieldByName('element_Id').asstring;
OleStream := dataQuery.CreateBlobStream(dataQuery.fieldbyName(fldName),bmRead);
if OleStream.Size >0 then
begin
OLE.LoadFromStream(OleStream);
Ole.SaveAsDocument(TempPath+NameId+'.doc');//TempPath 为.doc文件的路径
Ole.Close ;
OleStream.free;
end else
begin
Ole.CreateObject('word.document',false);
end;
end;
//========end保存为doc文件========//
FileListBox1.Directory := TempPath;
FileLIstbox1.Mask :='*.doc';
//Filelistbox1 用于取“.doc”文件
//========begin合并doc文件========//
TempFileName := extractfilepath(Application.ExeName)+'TempdocFile/Tempdoc.dot';
//tempdoc.dot用于存放合并的主文件
wordapplication1.Connect;
wordapplication1.Documents.Open(TempFileName,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam);WordDocument1.ConnectTo(wordapplication1.Documents.Item(TempFileName));
WordDocument1.Select ;
WordDocument1.Range.Cut ;//清空.dot文件
for FileNameOrder := 0 to FileListBox1.Items.Count -1 do
begin
FromFileName := TempPath + FileListBox1.Items.Strings[FileNameOrder];
wordapplication1.Documents.Open(FromFileName,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam,emptyparam);
WordDocument2.ConnectTo(wordapplication1.Documents.Item(FromFileName));
WordDocument2.Select ;
WordDocument2.Range.Copy;
WordDocument2.Close ;
WordDocument1.Paragraphs.Last.Range.Paste;
end;{for for FileNameOrder := 0 to FileListBox1.Items.Count -1}
Wordapplication1.Visible:=true;//结果显示。
//========end合并doc文件========//