不好意思啊:我这几天恰巧没上,我那天本来给你写好地,可惜掉线了,机子也死了,
没办法,今天再发给你一个原程序,我地没有文档,可能你难看懂,有问题
找我哦,88
哎,本来想88地,没发现你email,只好先给你最重要地代码了,就是blob字段
送到word显示那一部分,
procedure Tautoselectform.insertword;
function startword:boolean;
var Template,NewTemplate,ItemIndex:OleVariant;
begin
try
Template := EmptyParam;
NewTemplate := True;
ItemIndex := 1;
try
Wordapplication.Connect;
except
MessageDlg('请先安装Microsoft Word再运行本软件', mtError, [mbOk], 0);
result:=false;
Abort;
end;
Wordapplication.Visible:=false;
WordApplication.Caption :=title.text;
Template := EmptyParam;
NewTemplate := False;
WordApplication.Documents.Add(Template, NewTemplate);
WordDocument1.ConnectTo(WordApplication.Documents.Item(ItemIndex));
WordApplication.Options.CheckSpellingAsYouType := False;
WordApplication.Options.CheckGrammarAsYouType := False;
result:=true;
except
on E: Exception do
begin
ShowMessage(E.Message);
WordApplication.Disconnect;
result:=false;
end;
end;
end;
begin
if not startw then
begin
if not startword then
begin
showmessage('Microsoft Word没有启动,本系统无法继续运行');
abort;
end;
startw:=true;
end;
quedit.SelectAll;//quedit为dbedit控件(问题部分地显示)
quedit.CopyToClipboard;
WordDocument.Sentences.Last.Paste;
clipboard.clear;
WordDocument.Range.InsertAfter(' ' + #13);
if dm.questionTable.FieldByName('pic').asstring<>'无' then//问题有没有附图??
begin
qupic.CopyToClipboard;//qupic为dbimage控件(问题附带图地显示)
WordDocument.Sentences.Last.Paste;
clipboard.clear;
WordDocument.Range.InsertAfter(' ' + #13);
WordDocument.Range.InsertAfter(' ' + #13);
end;
anedit.SelectAll;//答案正文显示。也是dbedit控件
anedit.CopyToClipboard;
WordDocument1.Sentences.Last.Paste;
clipboard.clear;
WordDocument1.Range.InsertAfter(' ' + #13);
if dm.questionTable.FieldByName('anpic').asstring<>'无' then//答案图地显示
begin
anpic.CopyToClipboard;
WordDocument1.Sentences.Last.Paste;
clipboard.clear;
WordDocument1.Range.InsertAfter(' ' + #13);
WordDocument1.Range.InsertAfter(' ' + #13);
end;
这么多就搞定了,当然还有别地功能比如选择,填空题,。。。加题号
这个简单一点,我地也有怕你看了麻烦,del了,你自己想想办法就可以了,88