GetTextContents() public static method

Gets the text contents.
public static GetTextContents ( AODL.Document.Content.Text.ITextCollection textCollection, iTextSharp font ) : ICollection
textCollection AODL.Document.Content.Text.ITextCollection The text collection.
font iTextSharp
return ICollection
Ejemplo n.º 1
0
        /// <summary>
        /// Converts the specified formated text.
        /// </summary>
        /// <param name="formatedText">The formated text.</param>
        /// <returns>The chunck object representing this formated text.</returns>
        public static iTextSharp.text.Phrase Convert(AODL.Document.Content.Text.FormatedText formatedText)
        {
            try
            {
                iTextSharp.text.Font font;
                if ((TextStyle)formatedText.Style != null &&
                    ((TextStyle)formatedText.Style).TextProperties != null)
                {
                    font = TextPropertyConverter.GetFont(
                        ((TextStyle)formatedText.Style).TextProperties);
                }
                else
                {
                    font = DefaultDocumentStyles.Instance().DefaultTextFont;
                }

                iTextSharp.text.Phrase phrase = new iTextSharp.text.Phrase("", font);                 // default ctor protected - why ??
                phrase.AddRange(FormatedTextConverter.GetTextContents(formatedText.TextContent, font));

                return(phrase);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts the specified heading.
 /// </summary>
 /// <param name="heading">The heading.</param>
 /// <returns>A PDF paragraph representing the ODF heading</returns>
 public static iTextSharp.text.Paragraph Convert(Header heading)
 {
     try
     {
         iTextSharp.text.Font font = DefaultDocumentStyles.Instance().DefaultTextFont;
         IStyle style = heading.Document.CommonStyles.GetStyleByName(heading.StyleName);
         if (style != null && style is ParagraphStyle)
         {
             if ((ParagraphStyle)style != null)
             {
                 if (((ParagraphStyle)style).ParentStyle != null)
                 {
                     IStyle parentStyle = heading.Document.CommonStyles.GetStyleByName(
                         ((ParagraphStyle)style).ParentStyle);
                     if (parentStyle != null &&
                         parentStyle is ParagraphStyle &&
                         ((ParagraphStyle)parentStyle).TextProperties != null &&
                         ((ParagraphStyle)style).TextProperties != null)
                     {
                         // get parent style first
                         font = TextPropertyConverter.GetFont(((ParagraphStyle)parentStyle).TextProperties);
                         // now use the orignal style as multiplier
                         font = TextPropertyConverter.FontMultiplier(((ParagraphStyle)style).TextProperties, font);
                     }
                     else
                     {
                         font = TextPropertyConverter.GetFont(((ParagraphStyle)style).TextProperties);
                     }
                 }
                 else
                 {
                     font = TextPropertyConverter.GetFont(((ParagraphStyle)style).TextProperties);
                 }
             }
         }
         iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph("", font);                 // default ctor protected - why ??
         paragraph.AddRange(FormatedTextConverter.GetTextContents(heading.TextContent, font));
         return(paragraph);
     }
     catch (Exception ex)
     {
         throw;
     }
 }