1
基于"Hello World" using OpenOffice 3 sample code我设法从C#创建了Open Office文本文件。但我仍然无法找到设置页面大小和页边距的方法。任何线索如何做到这一点?OpenOffice 3文本文档 - 设置页面大小和边距
谢谢
基于"Hello World" using OpenOffice 3 sample code我设法从C#创建了Open Office文本文件。但我仍然无法找到设置页面大小和页边距的方法。任何线索如何做到这一点?OpenOffice 3文本文档 - 设置页面大小和边距
谢谢
我终于找到了,所以如果有人在未来的需求,该代码是在这里:
XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)xComponent;
XNameContainer xPageStyleCollection = (XNameContainer)xSupplier.getStyleFamilies().getByName("PageStyles").Value;
XPropertySet xPropertySet = (XPropertySet)xPageStyleCollection.getByName("Default").Value;
xPropertySet.setPropertyValue("LeftMargin", new Any((Int32)(5000))); //mm
xPropertySet.setPropertyValue("RightMargin", new Any((Int32)(9000))); // (1/100)mm
xPropertySet.setPropertyValue("TopMargin", new Any((Int32)(6000))); //(1/100)mm
xPropertySet.setPropertyValue("BottomMargin", new Any((Int32)(7000))); //(1/100)mm
xPropertySet.setPropertyValue("Width", new Any((Int32)(25000))); //(1/100)mm
xPropertySet.setPropertyValue("Height", new Any((Int32)(21000))); //(1/100)mm