用delphi吧一个word文档追加到另外一个word文档中
uses ComObj;
var WordApp: Variant;
begin
WordApp := CreateOleObject('Word.Application');
WordApp.Documents.open('c:\1.doc');
WordApp.Selection.InsertFile('c:\2.doc','',False,false,false);
WordApp.Selection.InsertFile('c:\3.doc','',False,false,false);
WordApp.ActiveDocument.SaveAs('C:\4.doc');//,'wdFormatDocument',False,'',True,'',False,False,False,False,False);
WordApp.Quit;
OleContainer1.CreateObjectfromFile('c:\4.doc',true);
procedure TFrm_Main.btUniteClick(Sender: TObject);
var
I: Integer ;
DocFileName: String ;
DocFile:OleVariant ;
begin
if lvFileName.Items.Count <1 then
Exit ;
btUnite.Enabled := False ;
try
pnJC.Visible := True ;
Frm_Main.Update ;
try
WordA.Connect ;
WordA.Visible := True;
WordDocument1.ConnectTo(WordA.Documents.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam) );
MixWordWindow('Word 文档合并器');
for I := 0 to lvFileName.Items.Count -1 do
begin
ProgressBar1.Position := I * 100 div lvFileName.Items.Count ;
Label3.Caption := lvFileName.Items.Item[I].SubItems.Strings[0] ;
Frm_Main.Update ;
DocFileName := lvFileName.Items.Item[I].SubItems.Strings[0] ;
WordA.Selection.InsertFile(DocFileName,EmptyParam,EmptyParam,EmptyParam,EmptyParam) ;
end;
ProgressBar1.Position := 100 ;
if CheckBox1.Checked then
begin
DocFile := edDocFileName.Text ;
WordDocument1.SaveAs(DocFile);
end ;
if CheckBox2.Checked then lvFileName.Items.Clear ;
if (CheckBox3.Checked) and (CheckBox1.Checked) then WordA.Quit ;
WordA.Disconnect ;
if CheckBox1.Checked then
Application.MessageBox(PChar('文档合并工作已经成功的完成。保存在' + #13+ edDocFileName.Text ),'完成', MB_OK or MB_ICONINFORMATION)
else
Application.MessageBox(PChar('文档合并工作已经成功的完成。请及时保存该文档!' ),'完成', MB_OK or MB_ICONINFORMATION) ;
if CheckBox1.Checked then
begin
DocCount := DocCount + 1 ;
edDocFileName.Text := ExtractFilePath(edDocFileName.Text) + '合并文档'+ IntToStr(DocCount) +'.Doc' ;
end;
except
on E: Exception do
begin
Application.Mess
相关文档:
◇[DELPHI]产生鼠标拖动效果
通过MouseMove事件、DragOver事件、EndDrag事件实现,例如在PANEL上的LABEL:
var xpanel,ypanel,xlabel,ylabel:integer;
PANEL的MouseMove事件:xpanel:=x;ypanel:=y;
PANEL的DragOver事件:xpanel:=x;ypanel:=y;
LABEL的MouseMove事件:xlabel:=x;ylabel:=y;
LABEL的EndDrag事件:label ......
savetime2k@yahoo.com 2004.1.28
http://savetime.delphibbs.com
今天开始学习元件编辑器,感觉比属性编辑器简单许多,但还是遇到了一些疑问。如果你能解答文中记录的问题,请告诉我答案,谢谢!
目 录
===============================================================================
⊙ TBaseComponentEdit ......
在DELPHI为编程者提供了一个灵活的绘图场所,即本文所述的
CANVAS类,在DELPHI中的很多控件都具有此属性,使编程者可以
在这些的控件的表面随心所欲的绘图,这对完善用户界面或者制
作一些屏幕特技都有着非凡的作用,下面举例说明几种特殊屏幕
......
制作圆角矩形的窗体:
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandle;
03.begin
04.hr:=createroundrectrgn(0,0,width,height,20,20);
05.setwindowrgn(handle,hr,true);
06.end;
如果不要窗体外框,则使用:
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandl ......
新建一个Active Library
2. 新建一个COM Object,在Class Name填一个名字,如Test。
点一下Implemented Interface后面的List按钮。再点一下对话框中的Add Library按钮,
选择“Program Files\Common Files\Designer”目录下的msaddndr.dll文件。
然后在列表中找到msaddndr.dll里面的_IDTExtensibility2接口点 ......