Page 1 of 1

Creating Writer Document using Classic ASP

Posted: Tue Jun 30, 2009 11:17 am
by snjm
Hi - I have to create an invoice in Writer using Classic ASP. I am new to OO and having installed OO on the server I tried to use the code snippet on the Automation Bridge Wiki page as follows:

Code: Select all

    Set objServiceManager= Server.CreateObject("com.sun.star.ServiceManager")

    Set objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")

    Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")

    Dim args()
    Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)

    Set objText= objDocument.getText

    Set objCursor= objText.createTextCursor

    'Inserting some Text
    objText.insertString objCursor, "The first line in the newly created text document." & vbLf, false

But it just times out - can anyone point me in the right direction...

Many thanks...

Re: Creating Writer Document using Classic ASP

Posted: Tue Jun 30, 2009 2:23 pm
by Villeroy
The biggest advantage is the free file format. It's all about zipped XML. Create office documents without any office being installed: http://odftoolkit.org/
For simple reports you could also prepare a preformatted template file and dump your content to the right place in content.xml.