Example #1
0
        /// <summary>
        /// Creates an Run to replace the value in the custom tag.
        /// </summary>
        /// <returns></returns>
        private Run GenerateRunBlock()
        {
            Run run         = new Run();
            var stringValue = Value as string;

            if (!string.IsNullOrWhiteSpace(stringValue))
            {
                run.Append(CommonDocumentFunctions.ParseParagraphForOOXML(stringValue));
            }
            return(run);
        }
Example #2
0
        /// <summary>
        /// Creates the text part of the paragraph.
        /// </summary>
        /// <param name="text">The text of the pargraph.</param>
        /// <returns>The paragraph or null if no text is defiend</returns>
        protected OOXMLParagraph CreateOOXMLTextPart(string text)
        {
            //Create the text part if there is any
            if (!string.IsNullOrEmpty(text))
            {
                OOXMLParagraph paragraph = new OOXMLParagraph(CommonDocumentFunctions.ParseParagraphForOOXML(text));
                //Add the header properties
                if (_paragraphLevel >= 0)
                {
                    paragraph.PrependChild(ooxmlParagraphProp(_paragraphLevel));
                }
                else if (!string.IsNullOrWhiteSpace(_styleName))
                {
                    paragraph.PrependChild(ooxmlParagraphProp(_styleName));
                }
                else
                {
                    paragraph.PrependChild(ooxmlParagraphProp(0));
                }
                return(paragraph);
            }

            return(null);
        }