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;
}
}