We want to use this component to pilot Word and Visio documents, but we have certain problems and I would like to ask you some questions :
In Word, I use bookmarks to automatically insert data, like date, name of the user. To do this, in my code I use WordGotoItem function :
OfficeViewer_1.WordGotoItem(wdGoToBookmark, wdGoToFirst, 1, ‘Name’);
but it doesn’t work, and I don’t know why.
Could you give me more information about this function and what’s wrong in my code ?
And I have another question :
How do I reach the header or footer of the word document ? Is there a function ?
Edraw Office Viewer Component can work in Delphi 2007/2009 for the office automation.
For example:
var
p1,p2: OleVariant;
OleAPP,OleDoc,MenuBar: OleVariant;
begin
OfficeViewer.Toolbars:=FALSE;
OfficeViewer.Titlebar:=FALSE;
p1:=DocFileName;
p2:=TRUE;
OfficeViewer.Open(DocFileName);
OleDoc:=OfficeViewer.ActiveDocument; // IDispatch Document
OleAPP:=OleDoc.application; // IDispatch Document.application
// ——— WORD —————————————
OleAPP.ActiveWindow.DisplayRulers := False;
OleAPP.ActiveWindow.View.Type := 1; // wdNormalView=1
// no popup
oleDoc.CommandBars[‘Text’].Enabled := False;
try
OleDoc.Protect(1,Null,’ppkLock’);
except
end;
end;
Leave a Reply
You must be logged in to post a comment.
Recent Comments