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

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
		public static ICollection GetTextContents(ITextCollection textCollection, iTextSharp.text.Font font)
		{
			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;
		}
	}

Usage Example

示例#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;
            }
        }
All Usage Examples Of AODL.ExternalExporter.PDF.Document.ContentConverter.FormatedTextConverter::GetTextContents