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

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

Creates the paragraph.
public CreateParagraph ( XmlNode paragraphNode ) : Paragraph
paragraphNode System.Xml.XmlNode The paragraph node.
Результат AODL.Document.Content.Text.Paragraph
		public Paragraph CreateParagraph(XmlNode paragraphNode)
		{
			try
			{
				//Create a new Paragraph
				Paragraph paragraph				= new Paragraph(paragraphNode, this._document);
				//Recieve the ParagraphStyle
				IStyle paragraphStyle			= this._document.Styles.GetStyleByName(paragraph.StyleName);

				if (paragraphStyle != null)
				{
					paragraph.Style				= paragraphStyle;
				}
				else if (paragraph.StyleName != "Standard"
				        && paragraph.StyleName != "Table_20_Contents"
				        && paragraph.StyleName != "Text_20_body"
				        && this._document is TextDocument)
				{
					//Check if it's a user defined style
					IStyle commonStyle			= this._document.CommonStyles.GetStyleByName(paragraph.StyleName);
					if (commonStyle == null)
					{
						this.OnWarning(new AODLWarning(string.Format(
							"A ParagraphStyle '{0}' wasn't found.", paragraph.StyleName), paragraph.Node));
					}
				}

				return this.ReadParagraphTextContent(paragraph);
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Paragraph.", ex);
			}
		}

Usage Example

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

			if (this.Document != null && this.Node != null)
			{			
				MainContentProcessor mcp	= new MainContentProcessor(this.Document);
				pargaphClone				= mcp.CreateParagraph(this.Node.CloneNode(true));
			}

			return pargaphClone;
		}