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

What's wrong with this code?

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


Joined: 30 Jan 2011
Posts: 26
Location: New Hampshire, USA

PostPosted: Fri Apr 27, 2012 5:31 am    Post subject: What's wrong with this code? Reply with quote

Code:
  Dim oServiceManager, oDesktop, oDoc, oTable, oCursor, oText, oTblColSeps As Object
        Dim aNoArgs(-1)

        oServiceManager = CreateObject("com.sun.star.ServiceManager")
        oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
        oDoc = oDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, aNoArgs)
        oText = oDoc.getText
        oCursor = oText.createTextCursor
        oTable = oDoc.createInstance("com.sun.star.text.TextTable")
        oTable.initialize(5, 8)
        oDoc.getText.insertTextContent(oCursor, oTable, False)
        oTblColSeps = oTable.TableColumnSeparators
        oTblColSeps(0).Position = 3000
        oTable.TableColumnSeparators = oTblColSeps


I get an error on this line oTblColSeps = oTable.TableColumnSeparators
the error is "Specified array was not of the expected type".

Any help would be greatly appreciated
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Fri Apr 27, 2012 6:59 am    Post subject: Reply with quote

See my answer to this previous thread.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
ranoel
General User
General User


Joined: 30 Jan 2011
Posts: 26
Location: New Hampshire, USA

PostPosted: Sat Apr 28, 2012 6:39 am    Post subject: Reply with quote

Thanks for the tip Bernard,
I went back to Ver. 3.2 and the code ran with no errors but.....
The columns widths don't seem to be changing I've tried different values and different columns. Is there something else I need to do?
Back to top
View user's profile Send private message
ranoel
General User
General User


Joined: 30 Jan 2011
Posts: 26
Location: New Hampshire, USA

PostPosted: Sat Apr 28, 2012 7:15 am    Post subject: Reply with quote

False alarm Bernard -- Problem solved --
Thanks again
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