Name
itcluno::Presentation - A Presentation Class for Openoffice.org's Swriter
Synopsis
itcluno::Presentation objectname ?options?
Inheritance
Methods
objectname exportToPdf filenameexport the document to pdf
Return-Value:
objectname getPageNames
Return-Value: a list of all page names
objectname insertPage {position end} {layoutIndex -1}insert an empty page at the appropriate position. The layout index determines which layout to use for the new page
Return-Value: the position of the inserted page
objectname renamePage oldname newnamerenames the given page
Return-Value: the name of the new page, an empty string if "oldname" does not exist or "newname" exists
objectname deletePage pageNamedeletes the given page
Return-Value: the name of the deleted page, an empty string if "pageName" does not exist
objectname activatePage pageNameactivates the given page
Return-Value: the name of the activated page, an empty string if "pageName" does not exist
objectname setMasterText rectangle text {type Text}sets this text into the rectangle on the master page (i.e. this is seen on every page)
Return-Value: a handle of the form _$objectname_@@@_number
objectname setText pageName rectangle text {type Text}sets this text into the rectangle on the appropriate page
Return-Value: a handle of the form _$objectname_@@@_number, an empty string if pageName does not exist
objectname setPreparedText pageName index stringsets the string for an existing object (referred by index) on the appropriate page
Return-Value: a handle of the form _$objectname_@@@_number, an empty string if pageName does not exist
objectname setImage pageName rectangle graphicURLsets the image into the rectangle on the appropriate page
Return-Value: a handle of the form _$objectname_@@@_number, an empty string if pageName does not exist
objectname setPreparedImage pageName index graphicURLsets the image for an existing object (referred by index) on the appropriate page
Return-Value: a handle of the form _$objectname_@@@_number, an empty string if pageName does not exist
objectname getDocumentProperties {propertyList ""}gets all properties of the document
Return-Value: a list of the appropriate properties and values
objectname getMasterPageProperties {propertyList ""}gets all properties of the master page
Return-Value: a list of the appropriate properties and values
objectname getPageProperties pageName {propertyList ""}gets all properties of the appropriate page
Return-Value: a list of the appropriate properties and values
objectname getPreparedObjectProperties pageName index {propertyList ""}gets all properties of object number index on the appropriate page
Return-Value: a list of the appropriate properties and values
objectname getObjectProperties objectId {propertyList ""}gets all properties of object "objectid" (previously created with setText)
Return-Value: a list of the appropriate properties and values
objectname setPagePropertyValues pageName propertyListsets the properties for pageName (propertyList has to be a list in the form options)
Return-Value:
objectname setPropertyValues objectId propertyListsets the properties for the object "objectid" which was previously created by setText (propertyList has to be a list in the form options)
Return-Value:
objectname setPreparedObjectProperties pageName index propertyListsets the properties for the object with index "index" on the appropriate page (propertyList has to be a list in the form options
Return-Value:
objectname createTable pageName rectanglecreates a Spreadsheet object which can be handled as a SpreadSheet object within rectangle
Return-Value: the objectname of the created SpreadSheet ($objectname#auto)
objectname createChart pageName rectanglecreates a Chart object which can be handled as a ChartDocument object within rectangle
Return-Value: the objectname of the created ChartDocument ($objectname#auto)
Examples
making a first Presentation
This example adds text to the master page. This text can be seen on all pages.
Also 2 new pages are created, one with a empty layout, the other one with layout no. 7 (empty layout is not counted, counting starts at 0).
On all pages a simple text is written. On the last page being activated at the end you will also see the tk logo.
package require itcluno
catch {itcl::delete object new_document}
itcluno::Presentation new_document
new_document setMasterText [list 0 0 10 1 cm] "A small itcluno Presentation"
new_document setText page1 [list 3 3 20 10 cm] "This is text for page1\non line 2\non line 3"
new_document insertPage
new_document setText page2 [list 3 3 20 10 cm] "This is text for page2\non line 2\non line 3"
# this means: add a new page with the 9th layout style
# the empty layout is not count
new_document insertPage end 7
new_document setPreparedText page3 0 "This is the title for page3"
set tkImage $tk_library/images/logoLarge.gif
if {[file exists $tkImage]} {
new_document setPreparedImage page3 1 [itcluno::OfficeUtilities::filenameToURL $tkImage]
}
new_document setPreparedText page3 1 "This is text for page3\non line 2\non line 3"
new_document activatePage page3
A Chart within a Presentation
This example creates a Chart within a Presentation
actually the chart is displayed incorrect and does not change when called with -urtp
package require itcluno
catch {itcl::delete object new_document}
itcluno::Presentation new_document
new_document insertPage
set page [lindex [new_document getPageNames] end]
new_document activatePage $page
set values [list \
[list Month Temperature "No. of Days"] \
[list January -5 31] \
[list February -3 28] \
[list March 3 31] \
[list April 15 30] \
]
set colHeaders [lrange [lindex $values 0] 1 end]
set rowHeaders [list]
set dataValues [list]
foreach line [lrange $values 1 end] {
lappend rowHeaders [lindex $line 0]
lappend dataValues [lrange $line 1 end]
}
new_document setText $page [list 3 10.5 20 1 cm] "This is a small chart with changing chart types"
set chart [new_document createChart $page [list 3 2 20 8 cm]]
$chart setChart $colHeaders $rowHeaders $dataValues \
"Temperature diagram" Bar
after 2000
$chart setChartType Line
A Spreadsheet within a Presentation
This example creates a SpreadSheet within a Presentation
package require itcluno
catch {itcl::delete object new_document}
itcluno::Presentation new_document
new_document insertPage
set page [lindex [new_document getPageNames] end]
new_document activatePage $page
set values [list \
[list Month Temperature "No. of Days"] \
[list January -5 31] \
[list February -3 28] \
[list March 3 31] \
[list April 15 30] \
]
set internalSpreadSheet [new_document createTable $page [list 3 12 20 8 cm]]
set sheetNames [$internalSpreadSheet getSheetNames]
set sheet0 [lindex $sheetNames 0]
scan $sheet0 {%[^0-9]*%d} tableBaseName dummy
$internalSpreadSheet setCellValue ${tableBaseName}1 A1 $values
$internalSpreadSheet setSheetProperties ${tableBaseName}1 \
[itcluno::OfficeUtilities::tkFont2ooFont [list Roman 20 bold italic]]
$internalSpreadSheet columnWidth ${tableBaseName}1 [list 0 1] 4000
Inserting and activating Pages
It does what the example name says
package require itcluno
catch {itcl::delete object new_document}
itcluno::Presentation new_document
new_document renamePage page1 "First Page"
new_document insertPage
new_document activatePage "First Page"
after 10
set page [lindex [new_document getPageNames] end]
new_document activatePage $page
new_document insertPage
set page [lindex [new_document getPageNames] end]
new_document activatePage $page
set url http://tugm.de/TUGM.gif
if {[catch {new_document setImage $page [list 6000 6000 16760 5760] $url}]} {
new_document setText $page [list 6 6 18 1 cm] "Could not load image $url from the internet"
} else {
new_document setText $page [list 6 18 18 1 cm] "Image $url from the internet"
}
new_document setText "First Page" [list 3 3 20 10 cm] "Look at page 3"
new_document saveFile tugm_presentation.sxi
new_document activatePage "First Page"
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