Edit: Found c.s.s.sheet.XSheetPageBreak with methods getColumnPageBreaks and getRowPageBreaks. The interface is marked as depricated without apparent alternative. The dev guide suggests using it. I'll test how it interferes with used ranges and set print ranges. |
Edit: 2008-03-03, answering my own question |
IMHO this is the starting point for further testing:
http://api.openoffice.org/docs/common/r ... dererCount
getRendererCount takes two arguments. The first one should be something renderable from any type of document. I tested the first argument with following spreadsheet related objects:
1. spreadsheet document. The return value is the same as in Menu:File>Properties>Tab:Statistics
2. single range. The return value is the page count when you print with option "Current Selection"
3. single sheet. The return value is the page count when you print with option "Selected Sheets"
4. multiple ranges (c.s.s.sheet.SheetCellRanges). The return value is zero. You've got to use c.s.s.sheet.XPrintAreas.setPrintAreas(<sequence of addresses>) in order to make this work. Then you get the page count from the document.
Annoyance: After setting PrintAreas for one sheet explicitly (GUI: Format>Print Ranges>Define) the other sheets need PrintAreas as well in order to be printable.
The second argument is a sequence of property structs, describing an output device. I passed an empty Basic Array() without testing other options.
Simple Basic wrapper:
Code: Select all
Function getPageCount(oDoc, obj, optional aProps())
if isMissing(aProps()) then aProps() = Array()
getPageCount = oDoc.getRendererCount(obj, aProps())
End Function