求助:为什么在WORD的标签处显示不出来我要插入的内容??? ( 积分: 50 )

  • 主题发起人 主题发起人 zenghc80
  • 开始时间 开始时间
Z

zenghc80

Unregistered / Unconfirmed
GUEST, unregistred user!
{

功能:在书签sBookMark处插入TChart控件包含的图表

}
function TForm1.PrnWordInsert(var chartInsert: TChart;
sBookMark: String): boolean;
var wRange:Variant;
iRangeEnd:Integer;
begin
try
if sBookMark='' then
begin
//在文档末尾
iRangeEnd:=wDoc.Range.End-1;
if iRangeEnd<0 then iRangeEnd:=0;
wRange:=wDoc.Range(iRangeEnd,iRangeEnd);//wDoc是全局的文档变量
end
else
begin
//在书签处
wRange:=wDoc.Range.Goto(wdGoToBookmark,,,sBookMark);
end;
chartInsert.CopyToClipboardBitmap;
wRange.Paste;
result:=true;
except
result:=false;
end;

end;

//--------------------------下面的是引用---------------
procedure TForm1.Button1Click(Sender: TObject);
var str1 : olevariant;
str2 : string;

begin
str1 := extractfilepath(application.ExeName)+'template/report.dot';
if (self.PrnWordBegin(str1)) then
begin
//self.prnWordReplace('#zhc#','ddkjfiefdfei',true) ;
str2 := 'sBookMark';
prnWordInsert(chart1,str2);
//prnWordInsert(image1,str2);
//prnWordTable(dbgrideh1,str2);
end;
end;
 
{

功能:在书签sBookMark处插入TChart控件包含的图表

}
function TForm1.PrnWordInsert(var chartInsert: TChart;
sBookMark: String): boolean;
var wRange:Variant;
iRangeEnd:Integer;
begin
try
if sBookMark='' then
begin
//在文档末尾
iRangeEnd:=wDoc.Range.End-1;
if iRangeEnd<0 then iRangeEnd:=0;
wRange:=wDoc.Range(iRangeEnd,iRangeEnd);//wDoc是全局的文档变量
end
else
begin
//在书签处
wRange:=wDoc.Range.Goto(wdGoToBookmark,,,sBookMark);
end;
chartInsert.CopyToClipboardBitmap;
wRange.Paste;
result:=true;
except
result:=false;
end;

end;

//--------------------------下面的是引用---------------
procedure TForm1.Button1Click(Sender: TObject);
var str1 : olevariant;
str2 : string;

begin
str1 := extractfilepath(application.ExeName)+'template/report.dot';
if (self.PrnWordBegin(str1)) then
begin
//self.prnWordReplace('#zhc#','ddkjfiefdfei',true) ;
str2 := 'sBookMark';
prnWordInsert(chart1,str2);
//prnWordInsert(image1,str2);
//prnWordTable(dbgrideh1,str2);
end;
end;
 
后退
顶部