I have a requirement to set custom column width in a table

I am using Aspose.PDF, Version=
i have created a table with 5 columns and i need to set column width of each cells .

code snip

           Aspose.Pdf.Table table = new Aspose.Pdf.Table();
            Aspose.Pdf.Row row = table.Rows.Add();
            row.MinRowHeight = 40;             
            TextState textState = new TextState
                Font = FontRepository.FindFont(fontName),
                FontSize = fontsize               
            foreach (var item in docSplit)
                row.Cells.Add(item, textState);

image.png (334 Bytes)


You can set the column widths with ColumnWidths property:

table.ColumnWidths = "50 100 50 70 150";
1 Like

Yes this is working


It’s good to know that suggested option has proved to be working on your end.

its working for my requirement