Aspose.Diagram for Java解析visio问题

你好,我在将visio转成png时,如果visio的空白页面比较多,转换成png时就包含这些空白页。请问Aspose.Diagram是否支持在转换的时候,默认去掉这些空白页,只包含数据。WechatIMG67.jpg (3.6 MB)

@chenxf

您能否也分享您的示例图和代码片段以供我们参考?我们将进一步为您提供相应的帮助。

请参考Visio测试案例.zip (103.0 KB)

另外,我们还发现解析visio格式文件时,无法把画布去掉,导致上传之后的图背景很多空白。示例:Test file.zip (168.1 KB)

你好,相关文件已回复,请协助一下,感谢。

@chenxf

我们已检查您共享的数据,并在我们的问题跟踪系统中将问题记录为 DIAGRAMJAVA-50747,以供进一步调查。我们将调查此案例的详细信息,并在问题解决后立即通知您。请耐心等待,给我们一些时间。

我们对造成的不便很抱歉。

@chenxf
很抱歉,我们不能默认去掉所有空白的页面,因为有其他用户需要用到这些页面。
您可以使用以下代码删除空白页面:
doc.getPages().remove(doc.getPages().getPage(“Page-2”));
或者也可以使用以下代码设置转换某一页:
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
options.setPageIndex(0);

请使用最新的修复版本,21.7.3,使用以下代码生成没有空白的png图片:
Shape group=doc.getPages().get(0).getShapes().group(shapes);
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
group.toImage(“out.png”, options);
aspose-diagram-21.7.3-java.zip (3.9 MB)

The issues you have found earlier (filed as DIAGRAMJAVA-50747) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

您好,请问shapes参数是如何产生的?image.png (103.0 KB)

@chenxf
请把需要组合的图形加入这个数组,例如下面的代码,谢谢:
com.aspose.diagram.Shape[] shapes = new Shape[doc.getPages().get(0).getShapes().getCount()];
for (int i =0 ;i<doc.getPages().get(0).getShapes().getCount();i++)
{
Shape shape = doc.getPages().get(0).getShapes().get(i);
shapes[i] = shape;
}

          Shape s = doc.getPages().get(0).getShapes().group(shapes);