Hello Bernard, On Monday 26 January 2009 11:58, Bernard Marcelly wrote: > Hi Ariel, > Congratulations for finding some working code :-) > > Message de Ariel Constenla-Haile date 2009-01-25 18:17 : > > While oTableModel.ColumnCount < 6 > > oColumns.insertByIndex(0, 1) > > Wend > > > > While oTableModel.RowCount < 8 > > oRows.insertByIndex(0, 1) > > Wend > > The above code can be simplified as > oColumns.insertByIndex(0, 6) > oRows.insertByIndex(0, 8)
you're right. [I needed a loop to step and see how the layout changed as I inserted them] > > Any way, much more work than with the TextTable, not very API-user > > friendly... > > Yes :-( And there is room for improvement. I created today : > Issue 98469 Add Cell and Table styles in Styles and Formatting > Issue 98470 Incorrect style family in Draw style families > Issue 98480 Sub-object of Draw table style can crash OpenOffice mmm there is something really buggy with the table/cell styles, seem to be fixed and read-only as every try I make end up in a crash... I'll test a little more on that. To the drawbacks I'd add: * our friedly TextTable implements ::com::sun::star::sheet::XCellRangeData, which gives the possiblity to set the whole table content at once with setDataArray() [same interface is also available in Calc, so that the API design is more coherent] 'oDoc is a Writer doc Dim oTable as Object oTable = oDoc.createInstance( "com.sun.star.text.TextTable" ) oTable.initialize( 5, 6 ) oText.insertTextContent( oCursor, oTable , False ) 'to make the example more graphical, 'we do it in two steps 'First, an array per table row Dim aRow0(), aRow1(), aRow2(), aRow3(), aRow4() aRow0 = Array("","January","February", "March", "April", "May") aRow1 = Array("John", 5.4, 6.4, 3.4, 5.6, 9.4) aRow2 = Array("Paula", 7.8, 4.5, 7.0, 6.1, 6.1) aRow3 = Array("Alan", 3.4, 6.3, 4.7, 5.4, 3.4) aRow4 = Array("Dean", 6.7, 5.2, 5.4, 6.1, 4.1) 'then, they all together are the actual table content Dim aDataArray(4) aDataArray(0) = aRow0 aDataArray(1) = aRow1 aDataArray(2) = aRow2 aDataArray(3) = aRow3 aDataArray(4) = aRow4 oTable.setDataArray( aDataArray ) IMHO the TableShape could be enhanced with a css.drawing.XTableShape, implementing, among other things, ::com::sun::star::sheet::XCellRangeData; and all properties could then be attributes of this css.drawing.XTableShape (for strong-typed languages, css.bean.XPropertySet/PropertyValue is painful and error prone). Thanks for testing. Regards -- Ariel Constenla-Haile La Plata, Argentina "Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter." Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org