我正在使用OpenOffice SDK打开并解析PPT和PPTX文件;现在,我可以打开PPT文件并提取形状。

XShape xShape = (XShape) UnoRuntime.queryInterface(
    XShape.class, xShapes.getByIndex(j));
String type = xShape.getShapeType();

通过使用上面的代码,我可以获得形状类型和矩形,椭圆等,但是我得到 com.sun.star.drawing.CustomShape.

有没有办法获得形状类型,例如矩形,椭圆等?

有帮助吗?

解决方案

我能找到的唯一方法就是 uinamesingular 财产

XPropertySet xShapeProperties = (XPropertySet) 
    UnoRuntime.queryInterface(XPropertySet.class, xShape);
String uiName = (String) xShapeProperties.getPropertyValue("UINameSingular");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top