procedure TForm1.SpeedButton5Click(Sender: TObject);
var
LinkToFile, SaveWithDocument:OleVariant;
begin
// Selection.InlineShapes.AddPicture FileName:="F:\新建文件夹 (2)\BLOW4.JPG", _
// LinkToFile:=False, SaveWithDocument:=True
odDoc.FileName :='F:\新建文件夹 (2)\BLOW4.JPG';
if odDoc.Execute then
begin
LinkToFile:=False; SaveWithDocument:=True;
app.Selection.InlineShapes.AddPicture(odDoc.FileName,LinkToFile,SaveWithDocument,EmptyParam); end;
{插入表格也类是 用range 可以控制插入的位置}
end;
var
LinkToFile, SaveWithDocument:OleVariant;
begin
// Selection.InlineShapes.AddPicture FileName:="F:\新建文件夹 (2)\BLOW4.JPG", _
// LinkToFile:=False, SaveWithDocument:=True
odDoc.FileName :='F:\新建文件夹 (2)\BLOW4.JPG';
if odDoc.Execute then
begin
LinkToFile:=False; SaveWithDocument:=True;
app.Selection.InlineShapes.AddPicture(odDoc.FileName,LinkToFile,SaveWithDocument,EmptyParam); end;
{插入表格也类是 用range 可以控制插入的位置}
end;
解决方案 »
- 请问怎么在AdvStringGrid1统计那边加文字?
- 迷宫改成贴图的问题
- 急用简单问题:如何给一个控件的事件赋值?
- 七龙珠(1-20)不能下你垛了我!
- 可能是关于SQL SERVER简单的问题吧
- 得知某一字段的类型是哪个属性
- ,我在写一个网吧操作监视程序,把用户使用的任意窗体包括浏览器的内容即时输入到Form1.Memo1里处理,如何实现?
- 请问有没有带checkbox的treeview的控件,也就是每个显示名称前有个checkbox的选择?
- 怎么引用不用路径的pas和dcu文件?
- 为什么在同一个局域网ping 出来的两台机子的ip是一样的?
- 请教以下trackbar控件的使用方法?
- 怎样用 worddocument组件在 w o r d中插入以副图片
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, Word97, OleServer;type
TForm1 = class(TForm)
App: TWordApplication;
Doc: TWordDocument;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
odDoc: TOpenDialog;
SpeedButton6: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
APP.Connect;
app.Visible := true;
end;procedure TForm1.SpeedButton2Click(Sender: TObject);
var Index,sFile,bFlag:OleVariant;
begin
if odDoc.Execute then
begin
sFile:=odDoc.FileName;
bFlag := False;
App.Documents.Open(sFile,bFlag,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam);
index :=1;
Doc.ConnectTo(App.Documents.Item(index));
end
else
begin
///Documents.Add DocumentType:=wdNewBlankDocument
// ShowVisualBasicEditor = True
///
app.Documents.Add(EmptyParam,EmptyParam);
end;
end;procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
Doc.PrintPreview;
end;procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
// Selection.TypeText Text:="uiyuiyuiyuiyuyuyui"
///这是我录的插入字符的宏
// 思想:宏转换在 vb转换要容易些
app.Selection.TypeText('dfjalfda;fdsajfla');end;procedure TForm1.SpeedButton5Click(Sender: TObject);
var
LinkToFile, SaveWithDocument:OleVariant;
begin
// Selection.InlineShapes.AddPicture FileName:="F:\新建文件夹 (2)\BLOW4.JPG", _
// LinkToFile:=False, SaveWithDocument:=True
odDoc.FileName :='F:\新建文件夹 (2)\BLOW4.JPG';
if odDoc.Execute then
begin
LinkToFile:=False; SaveWithDocument:=True;
app.Selection.InlineShapes.AddPicture(odDoc.FileName,LinkToFile,SaveWithDocument,EmptyParam); end;
{插入表格也类是 用range 可以控制插入的位置}
end;procedure TForm1.SpeedButton6Click(Sender: TObject);
var
append,FileName, Range, Item, Copies, Pages, PageType , ManualDuplexPrint
, Collate, Background, PrintToFile , PrintZoomColumn, from,to_ ,
PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight:OleVariant;begin
{'
' Macro3 Macro
' 宏在 2001-7-24 由 yj 录制
'
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="11", PageType:=wdPrintAllPages _
, ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile _
:=False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
}
FileName:=''; Range:='wdPrintRangeOfPages'; Item:='wdPrintDocumentContent';
Copies:=1; Pages:=2; PageType:='wdPrintAllPages';
ManualDuplexPrint:=False; Collate:=True; Background:=True; PrintToFile :=False; PrintZoomColumn:=0; PrintZoomRow:=0;
PrintZoomPaperWidth:=0;
PrintZoomPaperHeight:=0 ;
append:=false;
from:=2;
to_:=2;
app.PrintOut(Background,Append , Range, filename, from, to_, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, EmptyParam, ManualDuplexPrint)//, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight) {(Background,EmptyParam,EmptyParam,filename,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,pages,EmptyParam,EmptyParam);}
end;end.