| View previous topic :: View next topic |
| Author |
Message |
Morgoth General User

Joined: 21 Nov 2005 Posts: 9
|
Posted: Mon Dec 12, 2005 8:21 am Post subject: problems with setting name for a texttable |
|
|
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 |
|
 |
Laurent Godard General User


Joined: 16 Mar 2003 Posts: 47 Location: Grenoble (France)
|
Posted: Mon Dec 12, 2005 8:31 am Post subject: |
|
|
| Do you have special characters in your table names ? |
|
| Back to top |
|
 |
Morgoth General User

Joined: 21 Nov 2005 Posts: 9
|
Posted: Mon Dec 12, 2005 9:24 am Post subject: |
|
|
| no, as i wrote, they're called like "Table1" etc. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Mon Dec 12, 2005 9:32 am Post subject: |
|
|
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!  _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
|
|
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
|