Hi Mathias

Thanks for your help

I Wrote the program that opens the document in Read Only Mode.

The Code is:


function TSampleCode.CreateTextDocument(cFileName:string): Boolean;
var
  ServiceManager,StarDesktop,Document,LoadParams,PropertyValue,
  CoreReflection: variant;
begin
  try
    ServiceManager:=CreateOleObject('com.sun.star.ServiceManager');

StarDesktop:=ServiceManager.CreateInstance('com.sun.star.frame.Desktop');

    CoreReflection :=
ServiceManager.createInstance('com.sun.star.reflection.CoreReflection');
    CoreReflection
           .forName('com.sun.star.beans.PropertyValue')
           .createObject(PropertyValue);

    LoadParams := VarArrayCreate([0, 1], varVariant);
    PropertyValue.Name := 'Readonly';
    PropertyValue.Value := true;
    PropertyValue.Name := 'Preview';
    PropertyValue.Value := true;

    LoadParams[0] := PropertyValue;
    LoadParams[1] := PropertyValue;

    Document:=
StarDeskTop.LoadComponentFromUrl(cFileName,'_blank',0,LoadParams);
    CreateTextDocument:=true;
  except
    CreateTextDocument:=false;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  SampleCode:TSampleCode;
  cFileName:string;
begin
  OpenDialog1.Execute;
  cFileName:=OpenDialog1.FileName;
  cFileName := 'file:///'+StringReplace(cFileNAme , '\',
'/',[rfReplaceAll]);
  SampleCode:=TSampleCode.Create;
  if (not SampleCode.CreateTextDocument(cFileName)) then
    Label1.Caption:='Error'
  else
    Label1.Caption:='Document Open';
end;

The Lines   PropertyValue.Name := 'Preview' and  PropertyValue.Value :=
true; make that the openoffice starts in preview mode (no menus, no
toolbars).

The problem is that the Read Only mode doesn't work, nither preview  or in
"normal mode", and the size of the window and   preview zoom can't be re
adjusted.

Best Regards,
Alejandro Rufino
----- Original Message ----- 
From: "Mathias Bauer" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, February 02, 2006 8:18 PM
Subject: Re: [dev] Writer Automation with Delphi


> Ale Rufino wrote:
>
> > Hi
> >
> > This is a Kiosk application, in witch the user won't be able to see the
> > OppenOffice instance. For this reason I have to write a program that
shows
> > to the user the complete document, I can open the document but I can't
see
> > the document is  in my program. Using a TOleContainer control in Delphi
it
> > only shows the first page of the document.
> >
> > Other option could be, to open the OppenOficce and delete all the menus
and
> > hotkeys.
> >
> > I tried to use the SoActiveX component but I have no documentation to
use
> > it.
>
> please try what I suggested you to do (open the file in readonly mode).
> This should allow you to see the whole file and scroll through it. If
> this works we can see in the next step how you can remove the user
> interface elements.
>
> BTW: SoActiveX still has a toolbar, you won't win anything using it.
>
> Best regards,
> Mathias
>
> -- 
> Mathias Bauer - OpenOffice.org Application Framework Project Lead
> Please reply to the list only, [EMAIL PROTECTED] is a spam sink.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to