Alejandro wrote:

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
I do not understand what you want to do.
When you open a document, this opens a document such that you can edit and manipulate the document. This is what your code snippet does. I am not certain if you are saying that you want to open the document but NOT have it visible? You can do this. You passing an empty array of arguments, but you could pass the following arguments:

*'Dim args(0) As New com.sun.star.beans.PropertyValue*

*'args(0).name="Hidden"*

*'args(0).value=true*


Did you NOT want to open the document, but merely have the contained text assigned to a variable?

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to