AODL.ExternalExporter.PDF.Document.ContentConverter.TableLayoutInfo.AnalyzeTableLayout C# (CSharp) Method

AnalyzeTableLayout() public method

Analyzes the table layout.
public AnalyzeTableLayout ( Table table ) : void
table AODL.Document.Content.Tables.Table The table.
return void
		public void AnalyzeTableLayout(Table table)
		{
			try
			{
				this.GetTableWidth(table);
				this._maxCells = 1;
				foreach(Row r in table.Rows)
				{
					if (r.Cells.Count > this._maxCells)
					{
						this._maxCells = r.Cells.Count;
					}
				}
				this.CalulateCellWidths(table.ColumnCollection);
			}
			catch(Exception)
			{
				throw;
			}
		}

Usage Example

		/// <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.TableLayoutInfo::AnalyzeTableLayout