static void Main(string[] args)
{
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
PdfGrid pdfDocumentoGrid = new PdfGrid();
pdfDocumentoGrid.Columns.Add(2);
PdfGridRow rowprova = pdfDocumentoGrid.Rows.Add();
rowprova.Cells[0].Value ="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
rowprova.Cells[0].ColumnSpan = 2;
PdfGridRow rowTestata = pdfDocumentoGrid.Rows.Add();
rowTestata.Cells[0].Style.Borders.All = PdfPens.Transparent;
rowTestata.Cells[1].Style.Borders.All = PdfPens.Transparent;
PdfGridRow rowEmpty = pdfDocumentoGrid.Rows.Add();
rowEmpty.Cells[0].Style.Borders.All = PdfPens.Transparent;
rowEmpty.Cells[0].Value = "";
rowEmpty.Cells[0].ColumnSpan = 2;
PdfGridRow rowSottoTestata = pdfDocumentoGrid.Rows.Add();
rowSottoTestata.Cells[0].Value = PdfSottoTestaGrid();
rowSottoTestata.Cells[0].ColumnSpan = 2;
pdfDocumentoGrid.Draw(page, PointF.Empty);
MemoryStream stream = new MemoryStream();
document.Save(stream);
document.Close(true);
using (var fs = new FileStream(@"d:\Prova.pdf", FileMode.Create, FileAccess.Write))
{
stream.WriteTo(fs);
}
document.Close(true);
}
private static object PdfSottoTestaGrid()
{
PdfGrid pdfgrid = new PdfGrid();
pdfgrid.Columns.Add(4);
PdfGridCellStyle cellTitolettoStyle = new PdfGridCellStyle();
cellTitolettoStyle.Borders.Top = PdfPens.Black;
cellTitolettoStyle.Borders.Left = PdfPens.Black;
cellTitolettoStyle.Borders.Right = PdfPens.Black;
cellTitolettoStyle.Borders.Bottom = PdfPens.Transparent;
cellTitolettoStyle.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 6);
PdfGridCellStyle cellDatoStyle = new PdfGridCellStyle();
cellDatoStyle.Borders.Top = PdfPens.Transparent;
cellDatoStyle.Borders.Left = PdfPens.Black;
cellDatoStyle.Borders.Right = PdfPens.Black;
cellDatoStyle.Borders.Bottom = PdfPens.Black;
cellDatoStyle.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10);
PdfGridRow row0 = pdfgrid.Rows.Add();
row0.Cells[0].Style = cellTitolettoStyle;
row0.Cells[0].Value = "T1";
row0.Cells[0].ColumnSpan = 3;
row0.Cells[3].Value = "T2";
row0.Cells[3].Style = cellTitolettoStyle;
PdfGridRow row1 = pdfgrid.Rows.Add();
row1.Cells[0].Style = cellDatoStyle;
row1.Cells[0].Value = "12345678901234567890123";
row1.Cells[0].ColumnSpan = 3;
row1.Cells[3].Style = cellDatoStyle;
return pdfgrid;
}
and this works regularly.
But why if I increase the text of the first cell of the second grid, the height of the row increases even though it has not covered all the available space?