Bugzilla – Attachment 49221 Details for
Bug 39313
XTableRows.removeByIndex and also symply remove Row / Column crashes Libo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
test
test.py (text/x-python), 2.65 KB, created by
Xisco FaulĂ
on 2011-07-17 13:46:42 UTC
(
hide
)
Description:
test
Filename:
MIME Type:
Creator:
Xisco FaulĂ
Created:
2011-07-17 13:46:42 UTC
Size:
2.65 KB
patch
obsolete
>import uno > ># a UNO struct later needed to create a document >from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK >from com.sun.star.text.TextContentAnchorType import AS_CHARACTER >from com.sun.star.awt import Size > >from com.sun.star.lang import XMain > >def insertTextIntoCell( table, cellName, text, color ): > tableText = table.getCellByName( cellName ) > cursor = tableText.createTextCursor() > cursor.setPropertyValue( "CharColor", color ) > tableText.setString( text ) > > >def createTable(): > """creates a new writer document and inserts a table with some data (also known as the SWriter sample)""" > localContext = uno.getComponentContext() > resolver = localContext.ServiceManager.createInstanceWithContext( > "com.sun.star.bridge.UnoUrlResolver", localContext ) > ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" ) > smgr = ctx.ServiceManager > desktop = smgr.createInstance( "com.sun.star.frame.Desktop") > model = desktop.getCurrentComponent() > text = model.Text > > cursor = text.createTextCursor() > text.insertString( cursor, "\n", 0 ) > > # create a text table > table = model.createInstance( "com.sun.star.text.TextTable" ) > > # with 4 rows and 4 columns > table.initialize( 4,4) > > text.insertTextContent( cursor, table, 0 ) > rows = table.Rows > > table.setPropertyValue( "BackTransparent", uno.Bool(0) ) > table.setPropertyValue( "BackColor", 13421823 ) > row = rows.getByIndex(0) > row.setPropertyValue( "BackTransparent", uno.Bool(0) ) > row.setPropertyValue( "BackColor", 6710932 ) > > textColor = 16777215 > > insertTextIntoCell( table, "A1", "FirstColumn", textColor ) > insertTextIntoCell( table, "B1", "SecondColumn", textColor ) > insertTextIntoCell( table, "C1", "ThirdColumn", textColor ) > insertTextIntoCell( table, "D1", "SUM", textColor ) > > values = ( (22.5,21.5,121.5), > (5615.3,615.3,-615.3), > (-2315.7,315.7,415.7) ) > table.getCellByName("A2").setValue(22.5) > table.getCellByName("B2").setValue(5615.3) > table.getCellByName("C2").setValue(-2315.7) > table.getCellByName("D2").setFormula("sum <A2:C2>") > > table.getCellByName("A3").setValue(21.5) > table.getCellByName("B3").setValue(615.3) > table.getCellByName("C3").setValue(-315.7) > table.getCellByName("D3").setFormula("sum <A3:C3>") > > table.getCellByName("A4").setValue(121.5) > table.getCellByName("B4").setValue(-615.3) > table.getCellByName("C4").setValue(415.7) > table.getCellByName("D4").setFormula("sum <A4:C4>") > > columns = table.Columns > columns.removeByIndex(1,1) > >if __name__ == "__main__": > createTable()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 39313
: 49221