AODL.Document.Export.Html.HTMLContentBuilder.GetIContentCollectionAsHtml C# (CSharp) Метод

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

Gets the I content collection as HTML.
public GetIContentCollectionAsHtml ( ContentCollection iContentCollection ) : string
iContentCollection ContentCollection The i content collection.
Результат string
		public string GetIContentCollectionAsHtml(ContentCollection iContentCollection)
		{
			string html					= "";

			try
			{
				if (iContentCollection != null)
				{
					foreach(IContent iContent in iContentCollection)
					{
						//determine type
						if (iContent is Table)
							html			+= this.GetTableAsHtml(iContent as Table);
						else if (iContent is ODFControlRef)
							html			+= this.GetODFControlAsHtml(iContent as ODFControlRef);
						else if (iContent is Field)
							html			+= this.GetFieldAsHtml(iContent as Field);
						else if (iContent is Paragraph)
							html			+= this.GetParagraphAsHtml(iContent as Paragraph);
						else if (iContent is List)
							html			+= this.GetListAsHtml(iContent as List);
						else if (iContent is Frame)
							html			+= this.GetDrawFrameAsHtml(iContent as Frame);
						else if (iContent is DrawTextBox)
							html			+= this.GetDrawTextBoxAsHtml(iContent as DrawTextBox);
						else if (iContent is Graphic)
							html			+= this.GetGraphicAsHtml(iContent as Graphic);
						else if (iContent is ListItem)
							html			+= this.GetListItemAsHtml(iContent as ListItem);
						else if (iContent is Header)
							html			+= this.GetHeadingAsHtml(iContent as Header);
						else if (iContent is TableOfContents)
							html			+= this.GetTableOfContentsAsHtml(iContent as TableOfContents);
						else if (iContent is UnknownContent)
							html			+= this.GetUnknowContentAsHtml(iContent as UnknownContent);
						else if (iContent is ImageMap)
							html			+= this.GetImageMapAsHtml(iContent as ImageMap);
						else if (iContent is DrawArea)
							html			+= this.GetDrawAreaAsHtml(iContent as DrawArea);
						else
							//this should never happens, because all not implemented elements 
							//are unknwon content
							if (OnWarning != null)
						{
							AODLWarning warning			= new AODLWarning("Finding total unknown content. This should (could) never happen.");
							//warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
							OnWarning(warning);
						}
					}
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML string from an IContentCollection.", ex);
			}

			return html;
		}

Usage Example

		/// <summary>
		/// Appends the HTML.
		/// </summary>
		/// <param name="contentlist">The contentlist.</param>
		/// <param name="template">The template.</param>
		/// <returns>The filled template string</returns>
		private string AppendHtml(ContentCollection contentlist, string template)
		{
			try
			{
				HTMLContentBuilder htmlContentBuilder	= new HTMLContentBuilder();
				htmlContentBuilder.GraphicTargetFolder	= this._imgFolder;
				string htmlBody							= htmlContentBuilder.GetIContentCollectionAsHtml(this._document.Content);
				template								+= htmlBody;

				template		+= "</body>\n</html>";

				template		= this.SetMetaContent(template);
				
				return template;
			}
			catch(Exception)
			{
				throw;
			}
		}
All Usage Examples Of AODL.Document.Export.Html.HTMLContentBuilder::GetIContentCollectionAsHtml