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

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

Creates the text object.
public CreateTextObject ( IDocument document, XmlNode aTextNode ) : IText
document IDocument The document.
aTextNode System.Xml.XmlNode A text node.
Результат IText
		public IText CreateTextObject(IDocument document, XmlNode aTextNode)
		{
			//aTextNode.InnerText				= this.ReplaceSpecialCharacter(aTextNode.InnerText);
			int i=0;
			if (aTextNode.OuterXml.IndexOf("Contains state ") > -1)
				i++;

			switch(aTextNode.Name)
			{
				case "#text":
					return new SimpleText(document, aTextNode.InnerText);
				case "text:span":
					return CreateFormatedText(document, aTextNode);
				case "text:bookmark":
					return CreateBookmark(document, aTextNode , BookmarkType.Standard);
				case "text:bookmark-start":
					return CreateBookmark(document, aTextNode , BookmarkType.Start);
				case "text:bookmark-end":
					return CreateBookmark(document, aTextNode , BookmarkType.End);
				case "text:a":
					return CreateXLink(document, aTextNode);
				case "text:note":
					return CreateFootnote(document, aTextNode);
				case "text:line-break":
					return new LineBreak(document);
				case "text:s":
					return new WhiteSpace(document, aTextNode.CloneNode(true));
				case "text:tab":
					return new TabStop(document);
				default:
					return null;
			}
		}
		

Usage Example

		/// <summary>
		/// Creates the header.
		/// </summary>
		/// <param name="headernode">The headernode.</param>
		/// <returns></returns>
		public Header CreateHeader(XmlNode headernode)
		{
			try
			{
				if (this._debugMode)
					this.LogNode(headernode, "Log header node before");

				//Create a new Header
				Header header				= new Header(headernode, this._document);
				//Create a ITextCollection
				ITextCollection textColl	= new ITextCollection();
				//Recieve the HeaderStyle
				IStyle headerStyle			= this._document.Styles.GetStyleByName(header.StyleName);

				if (headerStyle != null)
					header.Style			= headerStyle;

				//Create the IText content
				foreach(XmlNode nodeChild in header.Node.ChildNodes)
				{
					TextContentProcessor tcp	= new TextContentProcessor();
					IText iText					= tcp.CreateTextObject(this._document, nodeChild);
					
					if (iText != null)
						textColl.Add(iText);
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IText object from header child node!.", nodeChild));
					}
				}

				//Remove all
				header.Node.InnerXml		= "";

				foreach(IText iText in textColl)
				{
					if (this._debugMode)
						this.LogNode(iText.Node, "Log IText node read from header");
					header.TextContent.Add(iText);
				}

				return header;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Header.", ex);
			}
		}
All Usage Examples Of AODL.Document.Import.OpenDocument.NodeProcessors.TextContentProcessor::CreateTextObject