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


C# DocumentBuilder.MoveToParagraph方法代码示例

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


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

示例1: MoveToParagraph

        public static void MoveToParagraph(string dataDir)
        {
            // ExStart:DocumentBuilderMoveToParagraph
            Document doc = new Document(dataDir + "DocumentBuilder.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Parameters are 0-index. Moves to third paragraph.
            builder.MoveToParagraph(2, 0);
            builder.Writeln("This is the 3rd paragraph.");
            // ExEnd:DocumentBuilderMoveToParagraph               
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:11,代码来源:DocumentBuilderMovingCursor.cs

示例2: DocumentBuilderMoveToParagraph

        public void DocumentBuilderMoveToParagraph()
        {
            //ExStart
            //ExFor:DocumentBuilder.MoveToParagraph
            //ExId:DocumentBuilderMoveToParagraph
            //ExSummary:Shows how to move a cursor position to the specified paragraph.
            Aspose.Words.Document doc = new Aspose.Words.Document(ExDir + "DocumentBuilder.doc");
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Parameters are 0-index. Moves to third paragraph.
            builder.MoveToParagraph(2, 0);
            builder.Writeln("This is the 3rd paragraph.");
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:14,代码来源:ExDocumentBuilder.cs

示例3: EnsureQuoteField

        /// <summary>
        /// Ensure that the quote field is present at the start of the given document.
        /// </summary>
        public static void EnsureQuoteField(Document document)
        {
            var container = GetReferenceFieldContainer(document);
            if (container == null)
                throw new Exception("Unable to place quote reference field: no paragraph could be found.");

            // If the first field in the document is "SET q", then exit early
            var firstField = container.FirstChild as FieldStart;
            if (firstField != null && IsQuoteField(firstField))
                return;

            // Otherwise, insert "SET q"
            var builder = new DocumentBuilder(document);
            if (container.FirstChild != null)
            {
                // Insert the new field at the beginning of the first paragraph
                var field = builder.InsertField(" SET q \"\\\"\" ");
                var insertBefore = container.FirstChild;
                foreach (var node in field.Start.GetSelfAndFollowingSiblings().TakeUpToNode(field.End).Reverse().ToArray())
                {
                    container.InsertBefore(node, insertBefore);
                    insertBefore = node;
                }
            }
            else
            {
                // The paragraph is empty, so just insert the field
                builder.MoveToParagraph(0, 0);
                builder.InsertField(" SET q \"\\\"\" ");
            }
        }
开发者ID:vc3,项目名称:ExoMerge,代码行数:34,代码来源:QuoteCharacters.cs


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