图1为元素
局部截取_20260707_233557.png (3.2 KB)
局部截取_20260707_223913.png (1.8 KB)
Figure 1 is the SVG diagram, and Figure 2 is the converted VSDX diagram, which doesn’t align with the original format
Conversion code:
/**
* svg 转 visio
*/
@Test
public void svgToVisioFull() throws Exception {
String sourcePath = “D:\test\aspose\绘图1.svg”;
String targetPath = “D:\test\aspose\绘图1-full.vsdx”;
Diagram diagram = null;
try {
// 加载SVG
diagram = new Diagram(sourcePath);
// 导出配置,仅使用真实存在的API
DiagramSaveOptions saveOpts = new DiagramSaveOptions(SaveFileFormat.VSDX);
saveOpts.setAutoFitPageToDrawingContent(true);
diagram.save(targetPath, saveOpts);
} finally {
if (diagram != null) {
diagram.dispose();
}
}
}