Problem with adjusting Cell Column width

Hello,
I am having trouble in adjusting the width of the column(cell) so that entire
cell content is displayed.

This is what I tried.

a) Used AutoFitColumn method. It din’t work when I had a merged cell in the
column
b) I tried AutoFitColumn method after adding header and before adding data.
It sized the column to the size of the headers but not to fit the size of the
data cells.
c) I tried AutoFitColumn after adding my header and data. I had around 4000 rows
of data. When I called AutoFitColumn, it hung indefinitely.

I have a few questions.
a) Is AutoFitColumn method sets the attribute of the column so that MS Excel
automatically adjust the widht of the column or the width of the column is
calculated by verifying the content of each cell in the Aspose.Excel library??

b) If the width is calculated in Aspose.Excel library, then I can’t use the AutoFit
method since my sheet will be very large, then what is best way of adjusting the width? or atleast how to calulate the width of the cell by its content??

c) What is the Unit of the width? is it in pixels or in cm or inches?? I have a string say “Hello World”. I want the cell width to be large enough to show this complete string? What is the method to calculate the width??

Thanks,
Raj

Hi Raj,

1. AutoFitColumn doesn’t work for merged cell. That’s same as MS Excel.
2. AutFitColumn check the content of all other cell, so it’s time-consuming. There isn’t such a attribute to let MS Excel to automatically adjust column width.Please don’t call it repeatedly. Please call it just once for each column.
3. The unit of width is number of characters with standard font.