H
howwell
Unregistered / Unconfirmed
GUEST, unregistred user!
最近我遇到个难题,想请教一下各位高手
如何使用DELPHI更改WORD中图表的数据,即操纵WORD中MSGRAPH
procedure UpdateGraphData(ABookmark: string);
var
I: Integer;
ARange: Variant;
AShapes: Variant;
AGraphChart: Variant;
begin
FWord := CreateOleObject('Word.Application');
FWord.Visible := False;
FDocument := FWord.Documents.Add('C:/Doc1.doc', False);
I := FDocument.Range.End - 1;
if I < 0 then I := 0;
ARange := FDocument.Range(I, I);
ARange := FDocument.Range.Goto(wdGoToBookmark, , , ABookMark);
AShapes := ARange.InlineShapes.Item(1);
AGraphChart := AShapes.OLEFormat.DoVerb(-1);
AGraphChart.Application.DataSheet.Cells(1, 1) := '99'; //这句出错,不知该如何写才是正确的
end;
如何使用DELPHI更改WORD中图表的数据,即操纵WORD中MSGRAPH
procedure UpdateGraphData(ABookmark: string);
var
I: Integer;
ARange: Variant;
AShapes: Variant;
AGraphChart: Variant;
begin
FWord := CreateOleObject('Word.Application');
FWord.Visible := False;
FDocument := FWord.Documents.Add('C:/Doc1.doc', False);
I := FDocument.Range.End - 1;
if I < 0 then I := 0;
ARange := FDocument.Range(I, I);
ARange := FDocument.Range.Goto(wdGoToBookmark, , , ABookMark);
AShapes := ARange.InlineShapes.Item(1);
AGraphChart := AShapes.OLEFormat.DoVerb(-1);
AGraphChart.Application.DataSheet.Cells(1, 1) := '99'; //这句出错,不知该如何写才是正确的
end;