AnalyzeTableLayout() public method

Analyzes the table layout.
public AnalyzeTableLayout ( Table table ) : void
table AODL.Document.Content.Tables.Table The table.
return void
		/// <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;
			}
		}
Esempio n. 2
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;
            }
        }