将 Visio 转换为图像格式
Contents
[
Hide
]
将图表导出为图像文件格式
本文介绍了如何使用 将 Microsoft Visio diagram 导出到图像Aspose.Diagram for .NETAPI. 使用Diagram类构造函数读取 diagram 文件和 Save 方法将 diagram 导出为任何支持的图像格式。
要将 diagram 导出到图像:
- 创建 Diagram 类的实例。
- 调用 Diagram 类的 Save 方法并设置要导出的图像格式。输出的图像文件看起来像原始文件。
导出 Microsoft Visio 绘图到图像文件
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadSaveConvert();
// Call the diagram constructor to load a VSD diagram
Diagram diagram = new Diagram(dataDir + "ExportToImage.vsd");
// Save Image file
diagram.Save(dataDir + "ExportToImage_out.png", SaveFileFormat.PNG);
也可以将特定页面保存为图像,而不是整个文档:
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadSaveConvert();
// Load diagram
Diagram diagram = new Diagram(dataDir + "ExportPageToImage.vsd");
// Save diagram as PNG
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
// Save one page only, by page index
options.PageIndex = 0;
// Save resultant Image file
diagram.Save(dataDir + "ExportPageToImage_out.png", options);