[Solved] Getting Total Page Count for text document
Posted: Thu Sep 27, 2012 2:16 am
I need to know the page count of a document. I see there is a PageCount property in TextDocumentView, but on the getPropertyValue() in the code below I get com.sun.star.beans.UnknownPropertyException.
Note the following code and output.
Code: Select all
XViewSettingsSupplier xViewSettings = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class,xcontroller);
XPropertySet viewSettings=xViewSettings.getViewSettings();
Object o=viewSettings.getPropertyValue("PageCount");
Code: Select all
XServiceInfo factory = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xcontroller);
String[] availableServiceNames = factory.getSupportedServiceNames();
for (String string : availableServiceNames) {
System.out.println(string);
}
output:
com.sun.star.text.TextDocumentView
com.sun.star.view.OfficeDocumentView