Konvertera Visio till bildformat
Contents
[
Hide
]
Exportera diagram till bildfilformat
Den här artikeln förklarar hur du exporterar en Microsoft Visio diagram till en bild medAspose.Diagram for .NET API. AnvändDiagram klasskonstruktorn för att läsa diagram-filerna och metoden Spara för att exportera diagram till valfritt bildformat som stöds.
Så här exporterar du ett diagram till en bild:
- Skapa en instans av klassen Diagram.
- Anropa Diagram-klassens Spara-metod och ställ in bildformatet du vill exportera till. Utdatafilen ser ut som originalfilen.
Exportera Microsoft Visio Ritning till bildfil
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); |
Det är också möjligt att spara en viss sida till bild istället för hela dokumentet:
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); |