Name
itcluno::Tablelist2OOTable - A Helper Class for itcluno::OpenOffice to convert a tablelist to a OOo Table
Synopsis
itcluno::Tablelist2OOTable::Tablelist2TextTable
tablelist tableObject document {propertyList ""}
itcluno::Tablelist2OOTable::Tablelist2SpreadSheet
tablelist document sheetName startCell {propertyList ""}
Procedures
itcluno::Tablelist2OOTable::Tablelist2TextTable tablelist tableObject document {propertyList ""}convert a tablelist to an OO TextTable object within an existing document object. The tableObject argument is the name of the TextTable object which will be created within this procedures, trying to adopt as many options as possible from the tablelist (such as background, font, ...). propertyList must have the form of options
Return-Value: the newly created TextTable object
itcluno::Tablelist2OOTable::Tablelist2SpreadSheet tablelist document sheetName startCell {propertyList ""}convert a tablelist to an existing OO SpreadSheet. The document object is a SpreadSheet object. The sheet sheetName must exist. This procedure tries to adopt as many options as possible from the tablelist (such as background, font, ...). startCell must have the form of a cellrange. propertyList must have the form of options
Return-Value: the document object
Examples
Simple Copy / SpreadSheet
Copies a tablelist to a SpreadSheet without adopting properties
package require itcluno
catch {itcl::delete object new_document}
package require tablelist
set top .top
catch {destroy $top}
toplevel $top
itcluno::SpreadSheet new_document
set sheetNames [new_document getSheetNames]
scan [lindex $sheetNames 0] {%[^0-9]*%d} tableBaseName dummy
set tablelistWidget [tablelist::tablelist $top.tablelistSpreadSheet \
-columns [list 0 Column1 right 0 Column2 right 0 Column3 right \
0 Column4 right 0 Column5 right 0 Column6 right 0 Column7 right]]
for {set row 0} {$row < 10} {incr row} {
set line [list]
for {set col 0} {$col < 8} {incr col} {
lappend line "Cell $row.$col"
}
$tablelistWidget insert end $line
}
pack $tablelistWidget -expand 1 -fill both
itcluno::Tablelist2OOTable::Tablelist2SpreadSheet $tablelistWidget new_document ${tableBaseName}1 [list 2 4]
Property Copy / SpreadSheet
Copies a tablelist to a SpreadSheet trying to adopt as many properties as possible
package require itcluno
catch {itcl::delete object new_document}
package require tablelist
set top .top
catch {destroy $top}
toplevel $top
itcluno::SpreadSheet new_document
set sheetNames [new_document getSheetNames]
scan [lindex $sheetNames 0] {%[^0-9]*%d} tableBaseName dummy
set tablelistWidget [tablelist::tablelist $top.tablelistSpreadSheet \
-columns [list 0 Column1 right 0 Column2 right 0 Column3 right \
0 Column4 right 0 Column5 right 0 Column6 right 0 Column7 right] \
-font [list Courier 8] -background "lightblue" -titlecolumns 2]
for {set row 0} {$row < 10} {incr row} {
set line [list]
for {set col 0} {$col < 8} {incr col} {
lappend line "Cell $row.$col"
}
$tablelistWidget insert end $line
}
$tablelistWidget rowconfigure 5 -background red -font [list Arial 20 bold]
$tablelistWidget cellconfigure 2,3 -background green -font [list Arial 10 bold italic underline]
$tablelistWidget columnconfigure 1 -align left
pack $tablelistWidget -expand 1 -fill both
itcluno::Tablelist2OOTable::Tablelist2SpreadSheet $tablelistWidget new_document ${tableBaseName}1 C3
Simple Copy / Writer
Copies a tablelist to a Writer document without adopting properties
package require itcluno
catch {itcl::delete object new_document ::textTable1}
package require tablelist
set top .top
catch {destroy $top}
toplevel $top
itcluno::Writer new_document
set tablelistWidget [tablelist::tablelist $top.tablelistWriter \
-columns [list 0 Column1 right 0 Column2 right 0 Column3 right \
0 Column4 right 0 Column5 right 0 Column6 right 0 Column7 right]]
for {set row 0} {$row < 10} {incr row} {
set line [list]
for {set col 0} {$col < 8} {incr col} {
lappend line "Cell $row.$col"
}
$tablelistWidget insert end $line
}
pack $tablelistWidget -expand 1 -fill both
itcluno::Tablelist2OOTable::Tablelist2TextTable $tablelistWidget ::textTable1 new_document
Property Copy / Writer
Copies a tablelist to a Writer document trying to adopt as many properties as possible
package require itcluno
catch {itcl::delete object new_document ::textTable2}
package require tablelist
set top .top
catch {destroy $top}
toplevel $top
itcluno::Writer new_document
set tablelistWidget [tablelist::tablelist $top.tablelistWriter \
-columns [list 0 Column1 right 0 Column2 right 0 Column3 right \
0 Column4 right 0 Column5 right 0 Column6 right 0 Column7 right] \
-font [list Courier 8] -background "lightblue"]
for {set row 0} {$row < 10} {incr row} {
set line [list]
for {set col 0} {$col < 8} {incr col} {
lappend line "Cell $row.$col"
}
$tablelistWidget insert end $line
}
$tablelistWidget rowconfigure 5 -background red -font [list Arial 20 bold]
$tablelistWidget cellconfigure 2,3 -background green -font [list Arial 10 bold italic underline]
$tablelistWidget columnconfigure 1 -align left
pack $tablelistWidget -expand 1 -fill both
itcluno::Tablelist2OOTable::Tablelist2TextTable $tablelistWidget ::textTable2 new_document
Bugs
no bugs known, but of course no software is bug free. If found one, file them to the bug section on our sourceforge page.
ToDo
a lot of new features which I find useful. If you find that anything useful is missing, please let me know via the bug report
Top