當前位置: 首頁>>代碼示例>>C#>>正文


C# Novacode.Paragraph類代碼示例

本文整理匯總了C#中Novacode.Paragraph的典型用法代碼示例。如果您正苦於以下問題:C# Paragraph類的具體用法?C# Paragraph怎麽用?C# Paragraph使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Paragraph類屬於Novacode命名空間,在下文中一共展示了Paragraph類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DocumentDependencies

        internal static Paragraph DocumentDependencies(this DocX body, string input, Paragraph parent = null)
        {
            if (string.IsNullOrEmpty(input))
                return null;

            Paragraph paragraph = parent ?? body.InsertParagraph();
            paragraph.IndentationBefore = parent == null ? 3 : parent.IndentationBefore + 1;

            paragraph.InsertText("Dependent activities: ", false, new Formatting
            {
                Bold = true,
                Size = 10,
            });

            paragraph.InsertText(input, false, new Formatting
            {
                FontColor = Color.Black,
                FontFamily = new FontFamily(System.Drawing.Text.GenericFontFamilies.Serif),
                Size = 9,
            });

            body.InsertParagraph();

            return paragraph;
        }
開發者ID:Rostamzadeh,項目名稱:WorkflowExtractor,代碼行數:25,代碼來源:WordExtensions.cs

示例2: createForParagraph

    private BaseConverter createForParagraph( DocX doc, Paragraph paragraph ) {
      var isList = paragraph.IsListItem;
      if( isList ) return createConverterForList( doc, paragraph );

      var type = Type.GetType( "DocXToMarkdown.Converter." + _converters[paragraph.StyleName] );
      return (BaseConverter)Activator.CreateInstance( type, new object[] { doc, paragraph } );
    }
開發者ID:jiga7,項目名稱:DocXToMarkdown,代碼行數:7,代碼來源:DocXParser.cs

示例3: BaseConverter

 public BaseConverter( DocX d, Paragraph p ) {
   _paragraph = p;
   _document = d;
   _text = Sanitize( _paragraph.Text );
   CheckHiperlinks();
   CheckPictures();
 }
開發者ID:jiga7,項目名稱:DocXToMarkdown,代碼行數:7,代碼來源:BaseConverter.cs

示例4: _Create

 private void _Create(string file, IEnumerable<OXmlElement> elements)
 {
     using (_document = DocX.Create(file))
     {
         foreach (OXmlElement element in elements)
         {
             switch (element.Type)
             {
                 //case zDocXElementType.BeginParagraph:
                 //    _paragraph = _document.InsertParagraph();
                 //    break;
                 //case zDocXElementType.EndParagraph:
                 //    _paragraph = null;
                 //    break;
                 case OXmlElementType.Paragraph:
                     _paragraph = _document.InsertParagraph();
                     break;
                 case OXmlElementType.Text:
                     AddText(element);
                     break;
                 case OXmlElementType.Line:
                     AddLine();
                     break;
                 case OXmlElementType.Picture:
                     AddPicture(element);
                     break;
             }
         }
         _document.Save();
     }
 }
開發者ID:labeuze,項目名稱:source,代碼行數:31,代碼來源:zDocX.cs

示例5: AddItemWithStartValue

 public void AddItemWithStartValue(Paragraph paragraph, int start)
 {
     //TODO: Update the numbering
     UpdateNumberingForLevelStartNumber(int.Parse(paragraph.IndentLevel.ToString()), start);
     if (ContainsLevel(start))
         throw new InvalidOperationException("Cannot add a paragraph with a start value if another element already exists in this list with that level.");
     AddItem(paragraph);
 }
開發者ID:kenjiuno,項目名稱:enex2docx,代碼行數:8,代碼來源:List.cs

示例6: InsertParagraphBeforeSelf

        public virtual Paragraph InsertParagraphBeforeSelf(Paragraph p)
        {
            Xml.AddBeforeSelf(p.Xml);
            XElement newlyInserted = Xml.ElementsBeforeSelf().First();

            p.Xml = newlyInserted;

            return p;
        }
開發者ID:Johnnyfly,項目名稱:source20131023,代碼行數:9,代碼來源:_BaseClasses.cs

示例7: Cell

        internal Cell(DocX document, XElement xml)
        {
            this.document = document;
            this.xml = xml;

            XElement properties = xml.Element(XName.Get("tcPr", DocX.w.NamespaceName));

            p = new Paragraph(document, 0, xml.Element(XName.Get("p", DocX.w.NamespaceName)));
        }
開發者ID:JonKruger,項目名稱:DocX,代碼行數:9,代碼來源:Table.cs

示例8: AddItem

        /// <summary>
        /// Adds an item to the list.
        /// </summary>
        /// <param name="paragraph"></param>
        /// <exception cref="InvalidOperationException">
        /// Throws an InvalidOperationException if the item cannot be added to the list.
        /// </exception>
        public void AddItem(Paragraph paragraph)
        {
            if (paragraph.IsListItem)
            {
                var numIdNode = paragraph.Xml.Descendants().First(s => s.Name.LocalName == "numId");
                var numId = Int32.Parse(numIdNode.Attribute(DocX.w + "val").Value);

                if (CanAddListItem(paragraph))
                {
                    NumId = numId;
                    Items.Add(paragraph);
                }
                else
                    throw new InvalidOperationException("New list items can only be added to this list if they are have the same numId.");
            }
        }
開發者ID:kenjiuno,項目名稱:enex2docx,代碼行數:23,代碼來源:List.cs

示例9: CanAddListItem

        /// <summary>
        /// Determine if it is able to add the item to the list
        /// </summary>
        /// <param name="paragraph"></param>
        /// <returns>
        /// Return true if AddItem(...) will succeed with the given paragraph.
        /// </returns>
        public bool CanAddListItem(Paragraph paragraph)
        {
            if (paragraph.IsListItem)
            {
                //var lvlNode = paragraph.Xml.Descendants().First(s => s.Name.LocalName == "ilvl");
                var numIdNode = paragraph.Xml.Descendants().First(s => s.Name.LocalName == "numId");
                var numId = Int32.Parse(numIdNode.Attribute(DocX.w + "val").Value);

                //Level = Int32.Parse(lvlNode.Attribute(DocX.w + "val").Value);
                if (NumId == 0 || (numId == NumId && numId > 0))
                {
                    return true;
                }
            }
            return false;
        }
開發者ID:kenjiuno,項目名稱:enex2docx,代碼行數:23,代碼來源:List.cs

示例10: DocumentDescription

        internal static Paragraph DocumentDescription(this DocX body, string input, Paragraph parent = null)
        {
            if (string.IsNullOrEmpty(input))
                return null;

            Paragraph paragraph = parent ?? body.InsertParagraph();
            paragraph.IndentationBefore = parent == null ? 3 : parent.IndentationBefore + 1;
            paragraph.InsertText(input, false, new Formatting
            {
                FontColor = Color.Black,
                Size = 10,
            });

            body.InsertParagraph();

            return paragraph;
        }
開發者ID:Rostamzadeh,項目名稱:WorkflowExtractor,代碼行數:17,代碼來源:WordExtensions.cs

示例11: DocumentLeafActivity

        internal static Paragraph DocumentLeafActivity(this DocX body, string input, Paragraph parent = null)
        {
            if (string.IsNullOrEmpty(input))
                return null;

            Paragraph paragraph = parent ?? body.InsertParagraph();
            paragraph.IndentationBefore = parent == null ? 3 : parent.IndentationBefore;

            paragraph.InsertText(input, false, new Formatting
            {
                FontColor = Color.Green,
                Size = 12,
            });

            body.InsertParagraph();

            return paragraph;
        }
開發者ID:Rostamzadeh,項目名稱:WorkflowExtractor,代碼行數:18,代碼來源:WordExtensions.cs

示例12: DocumentCompositeActivity

        internal static Paragraph DocumentCompositeActivity(this DocX body, string input, Paragraph parent = null)
        {
            if (string.IsNullOrEmpty(input))
                return null;

            Paragraph paragraph = parent ?? body.InsertParagraph();
            paragraph.IndentationBefore = parent == null ? 3 : parent.IndentationBefore + 1;

            paragraph.InsertText(input, false, new Formatting
            {
                FontColor = Color.Black,
                Size = 16,
                Bold = false,
                Italic = false,
                UnderlineStyle = UnderlineStyle.dash,
                UnderlineColor = Color.Gray
            });

            body.InsertParagraph();

            return paragraph;
        }
開發者ID:Rostamzadeh,項目名稱:WorkflowExtractor,代碼行數:22,代碼來源:WordExtensions.cs

示例13: RemoveParagraph

        /// <summary>
        /// Removes paragraph
        /// </summary>
        /// <param name="p">Paragraph to remove</param>
        /// <returns>True if removed</returns>
        public bool RemoveParagraph(Paragraph p)
        {
            foreach (var paragraph in Xml.Descendants(DocX.w + "p"))
            {
                if (paragraph.Equals(p.Xml))
                {
                    paragraph.Remove();
                    return true;
                }
            }

            return false;
        }
開發者ID:ScottSnodgrass,項目名稱:DocX,代碼行數:18,代碼來源:Container.cs

示例14: InsertParagraph

        public virtual Paragraph InsertParagraph(string text, bool trackChanges, Formatting formatting)
        {
            XElement newParagraph = new XElement
            (
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName)), HelperFunctions.FormatInput(text, formatting.Xml)
            );

            if (trackChanges)
                newParagraph = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraph);
            Xml.Add(newParagraph);
            var paragraphAdded = new Paragraph(Document, newParagraph, 0);
            if (this is Cell)
            {
                var cell = this as Cell;
                paragraphAdded.PackagePart = cell.mainPart;
            }
            else if (this is DocX)
            {
                paragraphAdded.PackagePart = Document.mainPart;
            }
            else if (this is Footer)
            {
                var f = this as Footer;
                paragraphAdded.mainPart = f.mainPart;
            }
            else if (this is Header)
            {
                var h = this as Header;
                paragraphAdded.mainPart = h.mainPart;
            }
            else
            {
                Console.WriteLine("No idea what we are {0}", this);
                paragraphAdded.PackagePart = Document.mainPart;
            }

            GetParent(paragraphAdded);

            return paragraphAdded;
        }
開發者ID:ScottSnodgrass,項目名稱:DocX,代碼行數:40,代碼來源:Container.cs

示例15: InsertParagraphBeforeSelf

 /// <summary>
 /// Insert a Paragraph before this Paragraph, this Paragraph may have come from the same or another document.
 /// </summary>
 /// <param name="p">The Paragraph to insert.</param>
 /// <returns>The Paragraph now associated with this document.</returns>
 /// <example>
 /// Take a Paragraph from document a, and insert it into document b before this Paragraph.
 /// <code>
 /// // Place holder for a Paragraph.
 /// Paragraph p;
 ///
 /// // Load document a.
 /// using (DocX documentA = DocX.Load(@"a.docx"))
 /// {
 ///     // Get the first paragraph from this document.
 ///     p = documentA.Paragraphs[0];
 /// }
 ///
 /// // Load document b.
 /// using (DocX documentB = DocX.Load(@"b.docx"))
 /// {
 ///     // Get the first Paragraph in document b.
 ///     Paragraph p2 = documentB.Paragraphs[0];
 ///
 ///     // Insert the Paragraph from document a before this Paragraph.
 ///     Paragraph newParagraph = p2.InsertParagraphBeforeSelf(p);
 ///
 ///     // Save all changes made to document b.
 ///     documentB.Save();
 /// }// Release this document from memory.
 /// </code> 
 /// </example>
 public override Paragraph InsertParagraphBeforeSelf(Paragraph p)
 {
     Paragraph p2 = base.InsertParagraphBeforeSelf(p);
     p2.PackagePart = mainPart;
     return p2;
 }
開發者ID:kozanid,項目名稱:DocX,代碼行數:38,代碼來源:Paragraph.cs


注:本文中的Novacode.Paragraph類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。