Hi

 I'm attempting to use Writer from a program write in Delphi that open a .DOC 
document, the program Works good but the problem  is that  when I run my 
program de Writer is open with the document, y must do that my program open the 
doument without open the Writer and return the text in a component or a 
variable, for view o printing only. In MS Office I can Do that, but im New with 
the Open Office.

The Code or my program is:

function TSampleCode.CreateTextDocument(): Variant;
var
   ServiceManager: Variant;
   StarDesktop: Variant;
   Document: Variant;
begin
    ServiceManager:=CreateOleObject('com.sun.star.ServiceManager');
    StarDesktop:=ServiceManager.CreateInstance('com.sun.star.frame.Desktop');
    Document:=ServiceManager.CreateInstance('com.sun.star.Text.text');
    Document:= 
StarDeskTop.LoadComponentFromUrl('file:///C:/Tmp/ALE.doc','_blank',0,VarArrayCreate([0,
 -1],varVariant));
    CreateTextDocument:=Document;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
   SampleCode:TSampleCode;
begin
   SampleCode:=TSampleCode.Create;
   SampleCode.CreateTextDocument();
end;

Thanks
 

Reply via email to