Creating Writer Document using Classic ASP

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
snjm
Posts: 1
Joined: Tue Jun 30, 2009 11:05 am

Creating Writer Document using Classic ASP

Post 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...
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Creating Writer Document using Classic ASP

Post 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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply