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

OO ActiveX Control in Delphi

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
jirii
Newbie
Newbie


Joined: 07 May 2007
Posts: 3

PostPosted: Mon May 07, 2007 1:47 am    Post subject: OO ActiveX Control in Delphi Reply with quote

Hi,
I wanted to use ActiveX control inside my Delphi application. There was no problem with installing, but I am unable to find any examples how to use it or make it running.
I download SDK and looked throw OLE examples, found some code how to drive OO from delphi code (but outside my apllication) and also findded X-Ray Tool, whitch is great.

But was here anybody able to use ActiveX control inside Delphi or Visual Basic?

There is mentioned, that it may be possible:
http://www.openoffice.org/dev_docs/features/1.1/index.html
ActiveX Control
OpenOffice.org 1.1 comes with an ActiveX control that allows users to view OpenOffice.org documents within a browser window (Internet Explorer) on the Windows platform. The ActiveX control can also be used within native applications developed in Microsoft VisualBasic or Borland Delphi.

Thanks for any help.

Jiri
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon May 07, 2007 7:13 am    Post subject: Reply with quote

Sorry this is not an answer :
Quote:
OpenOffice.org 1.1 comes with an ActiveX control that allows users to view OpenOffice.org documents within a browser window (Internet Explorer) on the Windows platform.

and under other OS with OOo2.X
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon May 07, 2007 7:15 am    Post subject: Reply with quote

See also :
How to trigger a macro from VB, Delphi,.. without dispatcher http://www.oooforum.org/forum/viewtopic.phtml?t=13059&highlight=
Number of pages in document of swriter (delphi) http://www.oooforum.org/forum/viewtopic.phtml?t=29159&highlight=
VarArray into range (COM:delphi) http://www.oooforum.org/forum/viewtopic.phtml?t=31155&highlight=
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
jirii
Newbie
Newbie


Joined: 07 May 2007
Posts: 3

PostPosted: Mon May 07, 2007 7:50 am    Post subject: Reply with quote

Yes, I read the forum. I searched and founded some articles about Delphi and OO. But I found nothing about using ActiveX control.
I may be example in VB, Delphi, C..,... it does not depands on language. But I found nothing.
I am using last version of OO, WindowsXP and Turbo Delphi. Can someone help?
Back to top
View user's profile Send private message
havardo
General User
General User


Joined: 21 Jun 2007
Posts: 11

PostPosted: Mon Jun 25, 2007 7:03 am    Post subject: Re: OO ActiveX Control in Delphi Reply with quote

You may be better of using the TOleContainer.
This will give you a preview of the first page of the document, and the user can activate OO Writer on-demand.
If you choose this root I recommend that you use load your documents through "LoadFromLink"

Good luck
Havard
_________________
Havard
Back to top
View user's profile Send private message
jirii
Newbie
Newbie


Joined: 07 May 2007
Posts: 3

PostPosted: Mon Jun 25, 2007 10:17 pm    Post subject: TOleContainer Reply with quote

I tryied that. Problem is, that MS Word works properly, while OO Writer seems not to. When I put it into the OleContainer and run it, I get OO Writer everythere on the Tform (but not in the TOleContainer intself), and it draws something (but its not usable).

Can you post some code example, please?

My code:

Code:
unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtnrs, ComObj;

type
  TForm3 = class(TForm)
    OC: TOleContainer;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
var
 FServiceManager: Variant;
begin

// --- OO
 FServiceManager:=CreateOleObject('com.sun.star.ServiceManager');
   // if (VarType(FServiceManager)=varDispatch) then
    //OC. .OleObject  :=FServiceManager.CreateInstance('com.sun.star.frame.Desktop');
OC.DoVerb(0);

// ---- MS Excel
//OC.CreateObject('excel.sheet', False);
//OC.DoVerb(0);

end;

end.
Back to top
View user's profile Send private message
havardo
General User
General User


Joined: 21 Jun 2007
Posts: 11

PostPosted: Tue Jun 26, 2007 12:21 am    Post subject: Re: TOleContainer Reply with quote

jirii wrote:
I tryied that. Problem is, that MS Word works properly, while OO Writer seems not to. When I put it into the OleContainer and run it, I get OO Writer everythere on the Tform (but not in the TOleContainer intself), and it draws something (but its not usable).
Can you post some code example, please?


Hi Jirii,
This is the approach I have used and it works for me.
First step is to load the document via link (E.g. TOleContainer.CreateLinkFromFile). I would prefer to use LoadFromStream, but Oo Writer does not behave well when the document is “in memory”. In other words, the document is stored on disk (temp files in my case).
Next step is to get a Object reference to the actual document via LoadComponentFromUrl.

Here is a rough version no of my code.

Code:
var
  LManager,LDesktop,LLoadParams,LPropvalue, LActiveDocument,
  LReflection: variant;
  LUrlName : WideString;

Begin
MyContainer.CreateLinkToFile(FFilename,false);
LManager:=CreateOleObject('com.sun.star.ServiceManager');
LDesktop:=LManager.CreateInstance('com.sun.star.frame.Desktop');
LReflection := LManager.createInstance('com.sun.star.reflection.CoreReflection');
LReflection.forName('com.sun.star.beans.PropertyValue').createObject(LPropvalue);
LLoadParams := VarArrayCreate([0, -1], varVariant);
LUrlName := convertToURL(AFilename);
LActiveDocument:= LDesktop.LoadComponentFromUrl(LUrlName,'_blank',0,LLoadParams);
//The document can now be accessed by code and is visible in Oo Writer


I’m also trying to get a Delphi implementation of XCloseListener to work so that I know when the end user has finished his work. I’ll post a solution for this if I have any success.

Good luck
_________________
Havard
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API 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