OpenXML: Auto Size column width in Excel -


i have written code generate excel file using openxml. below code generates columns in excel.

  worksheet worksheet = new worksheet();             columns columns = new columns();             int numcols = dt1.columns.count;             (int col = 0; col < numcols; col++)             {                     column c = createcolumndata((uint32)col + 1, (uint32)numcols + 1, 20.42578125d);                  columns.append(c);             }             worksheet.append(columns); 

also, tried below line create columns.

 column c = new column() { min = (uint32value)1u, max = (uint32value)1u, width = 25.42578125d, bestfit = true,  customwidth = true}; 

i thought using bestfit should work. doesn't set auto size.

please me on this.

thank you,

the bestfit property information property (possibly optimisation excel). still need provide width column. means have calculate column width depending on cell contents. open xml sdk doesn't automatically you, it's better use third-party library this.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -