How can i get the page margin using java api?

Java, C++, C#, Delphi, ??? - Using the UNO bridges

How can i get the page margin using java api?

Postby conghaoyuan » Fri Jun 03, 2016 11:44 am

i did some works ,but it'a wrong, and i consulted the official docs , no answers

Code: Select all   Expand viewCollapse view
public long[] getPageMargin(String fileUrl , String password) throws Exception{
       long[] pageMargin = new long[4];
          xEmptyWriterComponent = newDocComponent(fileUrl, password);
            mxDoc = (XTextDocument) UnoRuntime.queryInterface(
                    XTextDocument.class, xEmptyWriterComponent);
            XPropertySet mxDocProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, mxDoc);
            //PageStyleLayout pageStyle =
            XPagePrintable xPagePrintable = (XPagePrintable)UnoRuntime.queryInterface(XPagePrintable.class, mxDoc);
            //PropertyValue[] pagePrint = xPagePrintable.getPagePrintSettings();
//            for(int i =0;i<pagePrint.length;i++){               
//               System.out.println(pagePrint[i].Name+":"+pagePrint[i].Value);
//            }
            //PropertyValue leftMargin = pagePrint[2];
       }catch(Exception e){
       return pageMargin;
openoffice 4.12 windows 64bit
Posts: 1
Joined: Fri Jun 03, 2016 11:40 am

Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests