Itextsharp 4.1.6.Tabla PDF - ¿Cómo eliminar el espacio en blanco en la parte superior de cada celda?[acolchado y líder ya establecido en 0]
-
12-12-2019 - |
Pregunta
Estoy teniendo un problema con las tablas de ItoxtSharp.Me gustaría tener celdas sin relleno superior e inferior, para que se colocan más cerca entre sí.
Aunque he establecido el relleno y el líder de la celda a 0, aún queda el espacio en blanco.
¿Alguien sabe cómo eliminar el espacio en blanco?
Editar:
Thanx Para pedir respuesta de Dylan, he logrado resolver mi problema.Aquí está el fragmento de origen si alguien se comprueba como un problema similar
Document document = new Document(PageSize.A4, 5, 5, 10, 10);
using (FileStream fs = new FileStream("C:\\Users\\brum\\Desktop\\untitled.pdf", FileMode.Create))
{
iTextSharp.text.pdf.PdfWriter.GetInstance(document, fs);
document.Open();
PdfPTable table = new PdfPTable(2);
PdfPCell cell = new PdfPCell(new Phrase("Spanning 2 cols"));
cell.Colspan = 2;
cell.HorizontalAlignment = 1;
cell.Padding = 0f;
cell.UseAscender = true;
table.AddCell(cell);
table.AddCell("Next row 1");
table.AddCell("Next row 2");
document.Add(table);
document.Close();
}
cell.UseAscender = true; // This is the line that did the trick for me
Solución
Ajuste el relleno superior a algo pequeño o incluso negativo.Otra opción es
PdfPCell.setUseAscender()
.
ex:
cell.setPaddingTop(0f); // No padding on top cell
o
cell.UseAscender = true;
Pegue el código que tiene.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow