How can I set cell width and height in itextsharp pdf cell ceration using c#. I just use
cell.width = 200f;
But it should display the error message.
width can not be set.
What should I do?..
Case 1: relative widthsPdfPTable table = new PdfPTable(new float[] { 1, 3 }); If the width of table is 288, the width of the first column will now be 72 and the width of the second column will be 216. PdfPTable table = new PdfPTable(new float[] { 25, 75 });
What is ITextSharp? iTextSharp is a free and open source assembly that helps to convert page output or HTML content in a PDF file. Now add that DLL in the application.
You don't set the width of a cell.
you should set the width of the columns. And you can do that by applying them on the table object:
float[] widths = new float[] { 1f, 2f };
table.SetWidths(widths);
The answer from Neha is to set the width of the table object
more reference material here: http://www.mikesdotnetting.com/Article/86/iTextSharp-Introducing-Tables
http://indaravind.blogspot.in/2009/02/itextsharp-table-column-width.html
VB:
Dim intTblWidth() As Integer = {12, 10, 26, 10}
C#:
int[] intTblWidth = { 12, 10, 26, 10 };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With