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änd klasskonstruktorn [Diagram] 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 hidden or 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
import aspose.diagram | |
from aspose.diagram import * | |
#// Initialize a Diagram class | |
diagram = Diagram(os.path.join(sourceDir, "Drawing1.vsdx")) | |
#// Save diagram in the png format | |
diagram.save("Visio_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 hidden or 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
import aspose.diagram | |
from aspose.diagram import * | |
#// Initialize a Diagram class | |
diagram = Diagram(os.path.join(sourceDir, "Drawing1.vsdx")) | |
#// Save diagram as PNG | |
options = saving.ImageSaveOptions(SaveFileFormat.PNG) | |
#// Save one page only, by page index | |
options.page_index = 0 | |
#// Save diagram in the png format | |
diagram.save("ExportPageToImage_out.png", options) |