Hi,
When I export the excel using the ooxml, I try to set the column width of all the columns. The following the the loop i used to set the width:
for (var i = 0; i < sheet.columns.length; i++) {
if (i < 3) {
sheet.columns[i].width = 100;
} else if (i == 3) {
sheet.columns[i].width = 50;
} else {
sheet.columns[i].width = 25;
}
}
It works perfectly for the first 2 conditions, I get 100 pixel for columns A-C and 50 pixels for column D. However, weird thing happens to the third condition. 25 indeed get set to cell but its in the excel default width unit (character) rather than in pixel. So it would be converted to 180 pixels on output excel and its way too wide for my purpose. I used the same code for another grid and that one works out perfectly. In ooxml doc, I don't see anything that allows me to change the width unit for the excel. It doesn't make any sense to me. Can anyone please tell me why?