Standard width of cells


#1


Steve, I post your question here:

I would reply to the online board, but for some reason I cannot login.

Here is a new bug which is a pretty major thing I think.

If you reset the standard width of your cells at say 1.57 programattically, then you resize any of the columns say the first one (0), the second column (1) will actually have a width of 8.43 (the default column width [my template was 8.43]).


Here is an example:


//create the new excel object from the template.


Excel excel = new Excel();

Sheet sheet = excel.Worksheets.GetAt(0);

sheet.Cells.StandardWidth = 1.57;

sheet.Cells.SetColumnWidth(1, 31.29);

If you do the code above, the 3’rd column (Column 2) will be reset to the worksheets standard width (8.43), not the standard width set by the program.


#2

Dear Steve,

Please check the latest hot fix.


#3

This does not seem to fix the problem.


#4

Dear Steve,

Sorry for the inconvenience. I have some questions.

1. Do you really using the following code?

Excel excel = new Excel();
excel.Open(designFile);
Worksheet sheet = excel.Worksheets.GetAt(0);
sheet.Cells.StandardWidth = 1.57;
sheet.Cells.SetColumnWidth(1, 31.29);

2. In result file, the width of column two is 31.29 and the width of all other columns is 8.43. Is that true?

3. In sheet1 of designer file, you select all, and set the column width to 8.43. Is that true?

Let me explain. There are several method to set column width. So I set priorities to these methods. From lowest to highest:
1. Default column width in designer file
2. Default column width in api
3. Setting column width in designer file
4. Setting column width in api

If you select all, and set the column width to 8.43, then the designer file will record all the column width is changed by user. So the width of columns is not default column width.
You can test by following: Select All| -> Set Column Widht to 10.
Then you click the menu: Format| -> Column| -> Standard Width
You will find that the default width is still 8.43.

Since the column width is set in the designer file, so setting the default column width in api will not override the column width in the designer file.

If my guess is right, then it is not a bug. You can create a new file with default width of 8.43, and default width set by the api will work.

Otherwise, please give me your designer file and exact test code. My email address is hanyu_chen@hotmail.com.

Thank you.