0
I am trying via C# and with iTextSharp create a pdf doc with the following structure: I have a table with 3 rows In the first I have X columns with X years. In the 2nd one Row with the Months (J, F, M...etc) for each year, below I have another Row that I want to affect the property of theBackgroundColor cell for anything,
I’m having a hard time doing it, so can someone help me around here? Here’s part of the code, I’ve been through it and I’ve been through it so much.
PdfPTable tabelaAnos = new PdfPTable(iAnos);
for (int i = 0; i < iAnos; i++)
{
PdfPCell cellAnos1 = new PdfPCell();
AnoInicio = AnoInicio + 1;
cellAnos1 = new PdfPCell(new Phrase("Ano " + AnoInicio));
cellAnos1.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
tabelaAnos.AddCell(cellAnos1);
}
for (int i = 1; i < 13; i++)
{
PdfPCell cell = new PdfPCell();
cell = new PdfPCell(new Phrase("Meses com " + i + " columns"));
cell.Colspan = 12;
cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
tabelaAnos.AddCell(cell);
}
The procedure is to create a table with years*months columns and use colspan 12 in the first Row in column 1, 13, etc.
– Paulo Soares
Yes I tried it, but in theory it is very simple, I have created dozens of tables in html and aspnet, but iText does not behave as we want.
– myseLFFF
Tonight I prepare an example.
– Paulo Soares