OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Write and delphi width ole

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
Uber Schincariol
Guest





PostPosted: Tue Feb 03, 2004 8:53 am    Post subject: Write and delphi width ole Reply with quote

Hi everybody

I’ve integrated Write by OpenOffice in a Delphi program. With 1.0.3. version I just succeeded in “controlling” Write in order to have searches/replacements inside the decument exploiting OLE.

Now I’ve updated OpenOffice with 1.1.0 version, and the function that was causing me problems before is detecting me some incompatibilities.

The function is:
xReplaceDescr := Document.createReplaceDescriptor(); (non tradurre)

Could somebody help me, please?

You can find the code hereby:

procedure TFEditPreventivo.TB_Off(Sender: TObject);
var
f : string;
ID : integer;
// VARIABILI PER IL CONTROLLO OLE DI OPEN OFFICE
StarOffice , StarDesktop, Document,xFound, xReplaceDescr : Variant;
OK : Boolean;
i : integer;
begin
StarOffice := CreateOleObject('com.sun.star.ServiceManager');

f:='c:\documento.sxw';
for i:=1 to Length(f) do
if f[i]='\' then f[i]:='/';

OK := not (VarIsEmpty(StarOffice) or VarIsNull(StarOffice));
if OK then
begin
StarDesktop := StarOffice.createInstance('com.sun.star.frame.Desktop');
Document := StarDesktop.LoadComponentFromURL( 'file:///'+f, '_blank', 0, VarArrayCreate([0, - 1], varVariant));
OK := not (VarIsEmpty(Document) or VarIsNull(Document));

if OK then
begin

// ******** ERROR ERROR ERROR ERROR ERROR ERROR *********
xReplaceDescr := Document.createReplaceDescriptor();
// ******** ERROR ERROR ERROR ERROR ERROR ERROR *********

xReplaceDescr.SearchString := '@@_DATA';
xReplaceDescr.ReplaceString := DateToStr(now);
xFound := Document.replaceAll( xReplaceDescr );
end
else
MessageDlg('Impossibile caricare il documento richiesto', mtError, [mbOK], 0);
StarOffice := Unassigned;
end
else
MessageDlg(
'Impossibile connettersi ad open Office',
mtError, [mbOK], 0);
finally
StarOffice := Unassigned;
StarDesktop:= Unassigned;
Document:= Unassigned;
xReplaceDescr:= Unassigned;
xFound:= Unassigned;
end;
end;
Back to top
uber schincariol
Guest





PostPosted: Tue Feb 03, 2004 12:57 pm    Post subject: delphi and write Reply with quote

problem resolved this is the correct line:
xReplaceDescr := Document.createReplaceDescriptor;

not use the () parameter not neccesary
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group