We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Column header does not autofit

I am trying to autofit the column headers of a gridDesktop. They do not resize. Snippet:

this.gridDesktop1.Worksheets[0].Columns[0].Header = “A very long value”;
this.gridDesktop1.SheetsBarVisible = false;
this.gridDesktop1.RowHeaderVisible = false;
this.gridDesktop1.Worksheets[0].AutoFitColumns();


After inserting the same content in one of the cells, the column does resize.
this.gridDesktop1.Worksheets[0].Cells[“A1”].SetCellValue(“A very long value”);

How can I autofit column headers without having to fill cells first?

grtz,
Paul

Hi,

The autosize works when Aspose.Cells.GridDesktop calculates new width and height of cells based on values, if there is no value, then it will fail to calculate.

So, if you calculate it first and then place some other long value, you will have to calculate it again.

Hi mshakeel.faiz

Thank you for your fast reply!

So this means that headers are not interpreted as values?

Kind regards as well,
Paul