AODL.Document.Import.OpenDocument.NodeProcessors.TextContentProcessor.CreateFormatedText C# (CSharp) Метод

CreateFormatedText() публичный Метод

Creates the formated text.
public CreateFormatedText ( IDocument document, XmlNode node ) : FormatedText
document IDocument The document.
node System.Xml.XmlNode The node.
Результат AODL.Document.Content.Text.FormatedText
		public FormatedText CreateFormatedText(IDocument document, XmlNode node)
		{
			//Create a new FormatedText object
			FormatedText formatedText		= new FormatedText(document, node);
			ITextCollection iTextColl		= new ITextCollection();
			formatedText.Document			= document;
			formatedText.Node				= node;
			//Recieve a TextStyle
			
			IStyle textStyle				= document.Styles.GetStyleByName(formatedText.StyleName);

			if (textStyle != null)
				formatedText.Style			= textStyle;
			//else
			//{
			//	IStyle iStyle				= document.CommonStyles.GetStyleByName(formatedText.StyleName);
			//}
			
			//Ceck for more IText object
			foreach(XmlNode iTextNode in node.ChildNodes)
			{
				IText iText						= this.CreateTextObject(document, iTextNode.CloneNode(true));
				if (iText != null)
				{
					iTextColl.Add(iText);
				}
				else
					iTextColl.Add(new UnknownTextContent(document, iTextNode) as IText);
			}

			formatedText.Node.InnerText			= "";

			foreach(IText iText in iTextColl)
				formatedText.TextContent.Add(iText);

			return formatedText;
		}
		

Usage Example

Пример #1
0
		/// <summary>
		/// Create a deep clone of this FormatedText object.
		/// </summary>
		/// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
		/// <returns>
		/// A clone of this object.
		/// </returns>
		public object Clone()
		{
			FormatedText formatedTextClone		= null;

			if (this.Document != null && this.Node != null)
			{
				TextContentProcessor tcp		= new TextContentProcessor();
				formatedTextClone				= tcp.CreateFormatedText(
					this.Document, this.Node.CloneNode(true));
			}

			return formatedTextClone;
		}