public static void Run()
        {
            try
            {
                // ExStart:ExportOfHiddenVisioPagesToHTML
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_Intro();

                // Load an existing Visio
                Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
                // Get a particular page
                Page page = diagram.Pages.GetPage("Flow 2");
                // Set Visio page visiblity
                page.PageSheet.PageProps.UIVisibility.Value = BOOL.True;

                // Initialize PDF save options
                HTMLSaveOptions options = new HTMLSaveOptions();
                // Set export option of hidden Visio pages
                options.ExportHiddenPage = false;

                // Save the Visio diagram
                diagram.Save(dataDir + "ExportOfHiddenVisioPagesToHTML_Out.html", options);
                // ExEnd:ExportOfHiddenVisioPagesToHTML
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run() 
        {
            try
            {
                // ExStart:ExportOfHiddenVisioPagesToHTML
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_Intro();

                // Load an existing Visio
                Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");
                // Get a particular page
                Page page = diagram.Pages.GetPage("Flow 2");
                // Set Visio page visiblity
                page.PageSheet.PageProps.UIVisibility.Value = BOOL.True;

                // Initialize PDF save options
                HTMLSaveOptions options = new HTMLSaveOptions();
                // Set export option of hidden Visio pages
                options.ExportHiddenPage = false;

                // Save the Visio diagram
                diagram.Save(dataDir + "ExportOfHiddenVisioPagesToHTML_out.html", options);
                // ExEnd:ExportOfHiddenVisioPagesToHTML
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }
        }
예제 #3
0
        public void SaveHTMLWithLinkedFileTest()
        {
            // Prepare an output path for an HTML document
            string documentPath = Path.Combine(OutputDir, "save-with-linked-file.html");

            // Prepare a simple HTML file with a linked document
            File.WriteAllText(documentPath, "<p>Hello World!</p>" +
                              "<a href='linked.html'>linked file</a>");

            // Prepare a simple linked HTML file
            File.WriteAllText(Path.Combine(OutputDir, "linked.html"), "<p>Hello linked file!</p>");

            // Load the "save-with-linked-file.html" into memory
            using (var document = new HTMLDocument(documentPath))
            {
                // Create a save options instance
                var options = new HTMLSaveOptions();

                // The following line with value '0' cuts off all other linked HTML-files while saving this instance
                // If you remove this line or change value to the '1', the 'linked.html' file will be saved as well to the output folder
                options.ResourceHandlingOptions.MaxHandlingDepth = 1;

                // Save the document with the save options
                document.Save(Path.Combine(OutputDir, "save-with-linked-file_out.html"), options);

                Assert.True(document.QuerySelectorAll("p").Length > 0);
            }

            Assert.True(File.Exists(documentPath));
        }
예제 #4
0
        public static void Run()
        {
            // ExStart:UseHTMLSaveOptions
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_LoadSaveConvert();

            // Call the diagram constructor to a VSDX diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");

            // Options when saving a diagram into the HTML format
            HTMLSaveOptions options = new HTMLSaveOptions();

            // Value or the font is not installed locally, they may appear as a block,
            // Set the DefaultFont such as MingLiu or MS Gothic to show these
            // characters.
            options.DefaultFont = "MS Gothic";
            // Sets the number of pages to render in HTML.
            options.PageCount = 2;
            // Sets the 0-based index of the first page to render. Default is 0.
            options.PageIndex = 0;

            // Set page size
            PageSize pgSize = new PageSize(PaperSizeFormat.A1);

            options.PageSize = pgSize;
            // Discard saving background pages of the Visio diagram
            options.SaveForegroundPagesOnly = true;

            // Specify whether to include the toolbar or not. Default value is true.
            options.SaveToolBar = false;
            // Set title of the HTML document
            options.Title = "Title goes here";
            // Specify that you want to save tile or not
            options.SaveTitle = true;

            // Save in any supported file format
            diagram.Save(dataDir + "UseHTMLSaveOptions_out.html", options);

            // Save resultant HTML directly to a stream
            MemoryStream stream = new MemoryStream();

            diagram.Save(stream, SaveFileFormat.HTML);
            // ExEnd:UseHTMLSaveOptions
        }
예제 #5
0
        public static void Run()
        {
            // ExStart:RemoveHiddenInfo
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Intro();
            // Load an existing Visio
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");

            // Remove hidden information from diagram
            diagram.RemoveHiddenInformation((int)(RemoveHiddenInfoItem.Shapes | RemoveHiddenInfoItem.Masters));
            // Initialize PDF save options
            HTMLSaveOptions options = new HTMLSaveOptions();

            // Set export option of hidden Visio pages
            options.ExportHiddenPage = false;
            // Save the Visio diagram
            diagram.Save(dataDir + "RemoveHiddenInfo_out.html", options);
            // ExEnd:RemoveHiddenInfo
        }
        public static void Run()
        {
            // ExStart:UseHTMLSaveOptions
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_LoadSaveConvert();

            // Call the diagram constructor to a VSDX diagram
            Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx");

            // Options when saving a diagram into the HTML format
            HTMLSaveOptions options = new HTMLSaveOptions();

            // Summary:
            //     value or the font is not installed locally, they may appear as a block,
            //     set the DefaultFont such as MingLiu or MS Gothic to show these
            //     characters.
            options.DefaultFont = "MS Gothic";
            // Sets the number of pages to render in HTML.
            options.PageCount = 2;
            // Sets the 0-based index of the first page to render. Default is 0.
            options.PageIndex = 0;

            // Set page size
            PageSize pgSize = new PageSize(PaperSizeFormat.A1);
            options.PageSize = pgSize;
            // Discard saving background pages of the Visio diagram
            options.SaveForegroundPagesOnly = true;

            // Specify whether to include the toolbar or not. Default value is true.
            options.SaveToolBar = false;
            // Set title of the HTML document
            options.Title = "Title goes here";

            // Save in any supported file format
            diagram.Save(dataDir + "UseHTMLSaveOptions_out.html", options);

            // Save resultant HTML directly to a stream
            MemoryStream stream = new MemoryStream();
            diagram.Save(stream, SaveFileFormat.HTML);
            // ExEnd:UseHTMLSaveOptions
        }