AODL.ExternalExporter.PDF.Document.ContentConverter.FormatedTextConverter.Convert C# (CSharp) Method

Convert() public static method

Converts the specified formated text.
public static Convert ( AODL formatedText ) : iTextSharp.text.Phrase
formatedText AODL The formated text.
return iTextSharp.text.Phrase
		public static iTextSharp.text.Phrase Convert(AODL.Document.Content.Text.FormatedText formatedText)
		{
			iTextSharp.text.Font font;
			if ((TextStyle)formatedText.TextStyle != null
			    && ((TextStyle)formatedText.TextStyle).TextProperties != null)
				font = TextPropertyConverter.GetFont(
					((TextStyle)formatedText.TextStyle).TextProperties);
			else
				font = DefaultDocumentStyles.Instance().DefaultTextFont;

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

			return phrase;
		}

Usage Example

Esempio n. 1
0
 /// <summary>
 /// Gets the text contents.
 /// </summary>
 /// <param name="textCollection">The text collection.</param>
 /// <returns>The content. ArrayList of chunks and phrases.</returns>
 public static ICollection GetTextContents(ITextCollection textCollection, iTextSharp.text.Font font)
 {
     try
     {
         ArrayList contents = new ArrayList();
         foreach (object obj in textCollection)
         {
             if (obj is AODL.Document.Content.Text.FormatedText)
             {
                 contents.Add(FormatedTextConverter.Convert(
                                  obj as AODL.Document.Content.Text.FormatedText));
             }
             else if (obj is AODL.Document.Content.Text.SimpleText)
             {
                 contents.Add(SimpleTextConverter.Convert(
                                  obj as AODL.Document.Content.Text.SimpleText, font));
             }
             else if (obj is AODL.Document.Content.Text.TextControl.TabStop)
             {
                 contents.Add(SimpleTextConverter.ConvertTabs(
                                  obj as AODL.Document.Content.Text.TextControl.TabStop, font));
             }
             else if (obj is AODL.Document.Content.Text.TextControl.WhiteSpace)
             {
                 contents.Add(SimpleTextConverter.ConvertWhiteSpaces(
                                  obj as AODL.Document.Content.Text.TextControl.WhiteSpace, font));
             }
         }
         return(contents);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
All Usage Examples Of AODL.ExternalExporter.PDF.Document.ContentConverter.FormatedTextConverter::Convert