AODL.ExternalExporter.PDF.Document.ContentConverter.MixedContentConverter.GetMixedPdfContent C# (CSharp) Method

GetMixedPdfContent() public static method

Convert a AODL IContentCollection into an ArrayList of IElement iText objects.
public static GetMixedPdfContent ( ContentCollection iContentCollection ) : ArrayList
iContentCollection ContentCollection The i content collection.
return System.Collections.ArrayList
		public static ArrayList GetMixedPdfContent(ContentCollection iContentCollection)
		{
			ArrayList mixedPdfContent = new ArrayList();
			foreach(IContent content in iContentCollection)
			{
				if (content is AODL.Document.Content.Text.Paragraph)
				{
					if (((AODL.Document.Content.Text.Paragraph)content).MixedContent != null
					    && ((AODL.Document.Content.Text.Paragraph)content).MixedContent.Count > 0)
						mixedPdfContent.Add(ParagraphConverter.Convert(
							content as AODL.Document.Content.Text.Paragraph));
					else
						mixedPdfContent.Add(iTextSharp.text.Chunk.NEWLINE);
				}
				else if (content is AODL.Document.Content.Text.Header)
				{
					mixedPdfContent.Add(HeadingConverter.Convert(
						content as AODL.Document.Content.Text.Header));
				}
				else if (content is AODL.Document.Content.Tables.Table)
				{
					TableConverter tc = new TableConverter();
					mixedPdfContent.Add(tc.Convert(
						content as AODL.Document.Content.Tables.Table));
				}
				else if (content is AODL.Document.Content.Draw.Frame)
				{
					DrawFrameConverter dfc = new DrawFrameConverter();
					mixedPdfContent.Add(dfc.Convert(
						content as AODL.Document.Content.Draw.Frame));
				}
				else if (content is AODL.Document.Content.Draw.Graphic)
				{
					ImageConverter ic = new ImageConverter();
					mixedPdfContent.Add(ic.Convert(
						content as AODL.Document.Content.Draw.Graphic));
				}
			}
			return mixedPdfContent;
		}
	}

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Converts the specified table.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <returns>The PDF table.</returns>
        public iTextSharp.text.pdf.PdfPTable Convert(Table table)
        {
            try
            {
                iTextSharp.text.pdf.PdfPTable pdfTable;
                TableLayoutInfo tableLayout = new TableLayoutInfo();
                tableLayout.AnalyzeTableLayout(table);

                if (tableLayout.CellWidths != null)
                {
                    pdfTable = new iTextSharp.text.pdf.PdfPTable(tableLayout.CellWidths);
                }
                else
                {
                    pdfTable = new iTextSharp.text.pdf.PdfPTable(tableLayout.MaxCells);
                }

                if (table.Style != null &&
                    table.Style is TableStyle &&
                    ((TableStyle)table.Style).TableProperties != null)
                {
                    //((TableStyle)table.Style).TableProperties.Width
                }

                foreach (Row row in table.Rows)
                {
                    foreach (Cell cell in row.Cells)
                    {
                        iTextSharp.text.pdf.PdfPCell pdfCell = new iTextSharp.text.pdf.PdfPCell();

                        if (cell.ColumnRepeating != null && Int32.Parse(cell.ColumnRepeating) > 0)
                        {
                            pdfCell.Colspan = Int32.Parse(cell.ColumnRepeating);
                        }

                        foreach (iTextSharp.text.IElement pdfElement in MixedContentConverter.GetMixedPdfContent(cell.Content))
                        {
                            pdfCell.AddElement(pdfElement);
                        }
                        pdfTable.AddCell(pdfCell);
                    }
                }

                //pdfTable = this.SetProperties(table, pdfTable, maxCells);

                return(pdfTable);
            }
            catch (Exception)
            {
                throw;
            }
        }
All Usage Examples Of AODL.ExternalExporter.PDF.Document.ContentConverter.MixedContentConverter::GetMixedPdfContent