I have a MFC C++(not managed) program and I need to generate a xls.
I’m using xlslib(http://xlslib.sourceforge.net/) version 2.3.4 to generate the xls, but I can’t resize excel columns.
The class “worksheet” has the method “colwidth”:
void colwidth(unsigned32_t col, unsigned16_t width, xf_t* pxformat = NULL); // sets column widths to 1/256 x width of "0"
I invoked this method passing the parameters (0, 5), (0,20), (0,1000) and (1,5), no one worked :/.
I just need that the column fit the size necessary to display all the text.
Any help will be very useful, I’m lost.
Try the following code:
I also meet with this problem,i try it many times and discover that before invoke “colwidth” you must firstly invoke “defaultColwidth”,the parameter of method “defaultColwidth” must be “8”.The codes already work fine on my computer.
I am Chinese,English not mother language,I wish you can understand it.