This tutorial shows how .NET developers can Control the Export of Hidden Visio Pages on Saving inside .NET applications inside their .NET applications. Aspose.Diagram for .NET API allows developers to include or exclude hidden Visio pages on saving diagram to PDF, HTML, Image (PNG, JPEG, GIF), SVG, and XPS files. Even they may hide Visio pages using Aspose.Diagram API because it's option is already available through the cell UIVisibility in the page ShapeSheet. Aspose.Diagram for .NET API has the Page class that represents a Visio drawing page. The PageSheet property exposed by the Page class also exposes the page properties. The {{UIVisibility }}field of the page properties allows to hide the page. Developers can then use ExportHiddenPage property which is added in the SVGSaveOptions, XPSSaveOptions, ImageSaveOptions, HTMLSaveOptions and PdfSaveOptions classes. These examples show how to:
// [C# Code Sample]
// [C# Code Sample]
// [C# Code Sample]
diagram.Save(dataDir & Convert.ToString("Output.jpeg"), options)
//Set the Export Option for SVG
// [C# Code Sample]
diagram.Save(dataDir + "Output.svg", options);
// [VB.NET Code Sample]
// [C# Code Sample]
diagram.Save(dataDir + "Output.xps", options);
// [VB.NET Code Sample]
Overview: Aspose.Diagram for .NET
Aspose.Diagram is a class library for working with MS Visio files & is a pure Java alternate for MS Visio Object Model. It is a standalone Visio Java library and does not depend on Microsoft Office Visio. It enables developers to work with VSD & VDX files and they can open files & Add & manipulate the elements of the diagram, export Visio files to PDF, XML, HTML, images format, SVG & several other formats, Rotate a shape, Add a hyperlink to a Visio shape, protect diagram shape and many more. Aspose.Diagram can be used with any kind of application, whether it’s a Web Application or a Windows Desktop Application.
- Set the Export Option for PDF.
- Set the Export Option for HTML.
- Set the Export Option for Image.
- Set the Export Option for SVG.
- Set the Export Option for XPS.
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
PdfSaveOptions options = new PdfSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
PdfSaveOptions options = new PdfSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.pdf", options);
// [VB.NET Code Sample]diagram.Save(dataDir + "Output.pdf", options);
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New PdfSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
Dim options As New PdfSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.pdf"), options)
//Set the Export Option for HTMLdiagram.Save(dataDir & Convert.ToString("Output.pdf"), options)
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
HTMLSaveOptions options = new HTMLSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
HTMLSaveOptions options = new HTMLSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.html", options);
diagram.Save(dataDir + "Output.html", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New HTMLSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
Dim options As New HTMLSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.html"), options)
//Set the Export Option for Imagediagram.Save(dataDir & Convert.ToString("Output.html"), options)
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG);
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagram
diagram.Save(dataDir + "Output.jpeg", options);
// [VB.NET Code Sample]
diagram.Save(dataDir + "Output.jpeg", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New ImageSaveOptions(SaveFileFormat.JPEG)
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagramDim options As New ImageSaveOptions(SaveFileFormat.JPEG)
' set export option of hidden Visio pages
options.ExportHiddenPage = False
diagram.Save(dataDir & Convert.ToString("Output.jpeg"), options)
//Set the Export Option for SVG
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
SVGSaveOptions options = new SVGSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagramSVGSaveOptions options = new SVGSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
diagram.Save(dataDir + "Output.svg", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New SVGSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
Dim options As New SVGSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.svg"), options)
//Set the Export Option for XPSdiagram.Save(dataDir & Convert.ToString("Output.svg"), options)
// [C# Code Sample]
string dataDir = @"c:\temp\";
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// load an existing Visio
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
// get a particular page
Page page = diagram.Pages.GetPage("Page-2");
// set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.False;
// initialize PDF save options
XPSSaveOptions options = new XPSSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
//Save the Visio diagramXPSSaveOptions options = new XPSSaveOptions();
// set export option of hidden Visio pages
options.ExportHiddenPage = false;
diagram.Save(dataDir + "Output.xps", options);
// [VB.NET Code Sample]
Dim dataDir As String = "c:\temp\"
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' load an existing Visio
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx"))
' get a particular page
Dim page As Page = diagram.Pages.GetPage("Page-2")
' set Visio page visiblity
page.PageSheet.PageProps.UIVisibility.Value = BOOL.[False]
' initialize PDF save options
Dim options As New XPSSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
Dim options As New XPSSaveOptions()
' set export option of hidden Visio pages
options.ExportHiddenPage = False
'Save the Visio diagram
diagram.Save(dataDir & Convert.ToString("Output.xps"), options)
diagram.Save(dataDir & Convert.ToString("Output.xps"), options)
Aspose.Diagram is a class library for working with MS Visio files & is a pure Java alternate for MS Visio Object Model. It is a standalone Visio Java library and does not depend on Microsoft Office Visio. It enables developers to work with VSD & VDX files and they can open files & Add & manipulate the elements of the diagram, export Visio files to PDF, XML, HTML, images format, SVG & several other formats, Rotate a shape, Add a hyperlink to a Visio shape, protect diagram shape and many more. Aspose.Diagram can be used with any kind of application, whether it’s a Web Application or a Windows Desktop Application.
- Homepage of Aspose.Diagram for .NET
- Download Aspose.Diagram for .NET
No comments:
Post a Comment