当前位置: 首页>>代码示例>>C#>>正文


C# Document.UpdatePageLayout方法代码示例

本文整理汇总了C#中System.Windows.Forms.Document.UpdatePageLayout方法的典型用法代码示例。如果您正苦于以下问题:C# Document.UpdatePageLayout方法的具体用法?C# Document.UpdatePageLayout怎么用?C# Document.UpdatePageLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Document的用法示例。


在下文中一共展示了Document.UpdatePageLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdatePageLayout

        public void UpdatePageLayout()
        {
            //ExStart
            //ExFor:StyleCollection.Item(String)
            //ExFor:SectionCollection.Item(Int32)
            //ExFor:Document.UpdatePageLayout
            //ExSummary:Shows when to request page layout of the document to be recalculated.
            Document doc = new Document(MyDir + "Rendering.doc");

            // Saving a document to PDF or to image or printing for the first time will automatically
            // layout document pages and this information will be cached inside the document.
            doc.Save(MyDir + "Rendering.UpdatePageLayout1 Out.pdf");

            // Modify the document in any way.
            doc.Styles["Normal"].Font.Size = 6;
            doc.Sections[0].PageSetup.Orientation = Aspose.Words.Orientation.Landscape;

            // In the current version of Aspose.Words, modifying the document does not automatically rebuild
            // the cached page layout. If you want to save to PDF or render a modified document again,
            // you need to manually request page layout to be updated.
            doc.UpdatePageLayout();

            doc.Save(MyDir + "Rendering.UpdatePageLayout2 Out.pdf");
            //ExEnd
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Words_NET,代码行数:25,代码来源:ExRendering.cs

示例2: RecieveFontSubstitutionUpdatePageLayout

        public void RecieveFontSubstitutionUpdatePageLayout()
        {
            // Store the font sources currently used so we can restore them later.
            FontSourceBase[] origFontSources = FontSettings.GetFontsSources();

            // Load the document to render.
            Document doc = new Document(MyDir + "Document.doc");

            // We can choose the default font to use in the case of any missing fonts.
            FontSettings.DefaultFontName = "Arial";

            // For testing we will set Aspose.Words to look for fonts only in a folder which doesn't exist. Since Aspose.Words won't
            // find any fonts in the specified directory, then during rendering the fonts in the document will be subsuited with the default
            // font specified under FontSettings.DefaultFontName. We can pick up on this subsuition using our callback.
            FontSettings.SetFontsFolder(string.Empty, false);

            //ExStart
            //ExId:FontSubstitutionUpdatePageLayout
            //ExSummary:Demonstrates how IWarningCallback will still recieve warning notifcations even if UpdatePageLayout is called before document save.
            // When you call UpdatePageLayout the document is rendered in memory. Any warnings that occured during rendering
            // are stored until the document save and then sent to the appropriate WarningCallback.
            doc.UpdatePageLayout();

            // Create a new class implementing IWarningCallback and assign it to the PdfSaveOptions class.
            HandleDocumentWarnings callback = new HandleDocumentWarnings();
            PdfSaveOptions saveOptions = new PdfSaveOptions();
            saveOptions.WarningCallback = callback;

            // Even though the document was rendered previously, any save warnings are notified to the user during document save.
            doc.Save(MyDir + "Rendering.FontsNotificationUpdatePageLayout Out.pdf", saveOptions);
            //ExEnd

            Assert.Greater(callback.mFontWarnings.Count, 0);
            Assert.True(callback.mFontWarnings[0].WarningType == WarningType.FontSubstitution);
            Assert.True(callback.mFontWarnings[0].Description.Contains("has not been found"));

            // Restore default fonts.
            FontSettings.SetFontsSources(origFontSources);
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Words_NET,代码行数:39,代码来源:ExRendering.cs


注:本文中的System.Windows.Forms.Document.UpdatePageLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。