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

problems with setting name for a texttable

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


Joined: 21 Nov 2005
Posts: 9

PostPosted: Mon Dec 12, 2005 8:21 am    Post subject: problems with setting name for a texttable Reply with quote

hi!
i'm trying to create a texttable with the following code:
Code:

sub NewTable(columns as integer,rows as integer, tabname as string, coloredborders as boolean, repheadline as boolean)
dim oDoc as object
dim oText as object
dim oViewCursor as object
dim oTable as object

oDoc= thiscomponent
oText = oDoc.getText()
'oCursor = oText.createTextCursor()
oViewCursor = oDoc.getCurrentController().getViewCursor()
oTable = oDoc.createInstance( "com.sun.star.text.TextTable" )
oTable.initialize(columns, rows)
oTable.HoriOrient = 0 'com::sun::star::text::HoriOrientation::NONE
'oTable.Name= tabname
otable.setname(tabname)
oTable.RepeatHeadline= repheadline
oDoc.getText.insertTextContent( oViewCursor, oTable, false )

if coloredborders = false then
  Dim x 'represents each BorderLine 
  Dim v 'represents the TableBorder Object as a whole
  oTable = ThisComponent.getTextTables().getByName(tabname)
  v = oTable.TableBorder
  x = v.TopLine
  x.OuterLineWidth = 0
  v.TopLine = x
  x = v.LeftLine
  x.OuterLineWidth = 0
  v.LeftLine = x
  x = v.RightLine
  x.OuterLineWidth = 0
  v.RightLine = x
  x = v.TopLine
  x.OuterLineWidth = 0
  v.TopLine = x
  x = v.VerticalLine
  x.OuterLineWidth = 0
  v.VerticalLine = x
  x = v.HorizontalLine
  x.OuterLineWidth = 0
  v.HorizontalLine = x
  x = v.BottomLine
  x.OuterLineWidth = 0
  v.BottomLine = x

  oTable.TableBorder = v
end if
end sub

when i'm setting the name (e.g. "Table1") it SOMETIMES sets the name to "Table1". i don't know why it's doing this SOMETIMES and not everytime or never. i have to access the tables via their names because the order (=index) may change in the document.

any ideas?

thx in advance
Morgoth
Back to top
View user's profile Send private message
Laurent Godard
General User
General User


Joined: 16 Mar 2003
Posts: 47
Location: Grenoble (France)

PostPosted: Mon Dec 12, 2005 8:31 am    Post subject: Reply with quote

Do you have special characters in your table names ?
Back to top
View user's profile Send private message Visit poster's website
Morgoth
General User
General User


Joined: 21 Nov 2005
Posts: 9

PostPosted: Mon Dec 12, 2005 9:24 am    Post subject: Reply with quote

no, as i wrote, they're called like "Table1" etc.
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Mon Dec 12, 2005 9:32 am    Post subject: Reply with quote

If you own my book, read pages 304 and 305. Notice the note on page 305.... This should help you...
Quote:
In general, it is better to set table properties before inserting the table into the document. This prevents screen flicker as the object is modified and then redrawn on the screen. Due to a bug in OOo 1.1.0, if Listing 38 is modified to set the data before inserting the table, the table name is modified and it contains an extra garbage character at the end. Be warned, however, that some text content, such as text field masters, cannot change their names after they have been inserted into a document.

If you do not own my book, this is still probably enough of a hint to solve your problem! Wink
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
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