Конвертировать Visio в форматы изображений
Contents
[
Hide
]
Экспорт диаграмм в форматы файлов изображений
В этой статье объясняется, как экспортировать Microsoft Visio diagram в изображение с помощьюAspose.Diagram for .NET API. ИспользуйтеDiagram конструктор класса для чтения файлов diagram и метод Save для экспорта diagram в любой поддерживаемый формат изображения.
Чтобы экспортировать diagram в изображение:
- Создайте экземпляр класса Diagram.
- Вызовите метод Save класса Diagram и установите формат изображения, в который вы хотите экспортировать. Выходной файл изображения выглядит как исходный файл.
Экспорт Microsoft Visio чертежа в файл изображения
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Также можно сохранить в изображение определенную страницу, а не весь документ:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |