I write applications that create PDF files and Excel files. While generating PDF files, I noticed that some of the features that were inserted in the file, did not show up visually. I was informed of a statement that "refreshes" the file and now all the features are visible.
I am having the exact same problem with Excel generation. I need one of my columns to self-adjust to the width of the widest entry (in the same fashion as double-click interactively). I was told about this solution:
"In OpenXML you can set the spreadsheet column properties so that it will be auto-sized when the spreadsheet is opened in Excel. Set BestFit=true and CustomWidth=true when creating the column."
How to implement the feature that adjusts an Excel column to the precise width, programmatically??
I added this statement to my source code:
Column column2 = new Column() { Min = (UInt32Value)2U, Max = (UInt32Value)2U, Width=7, BestFit = true, CustomWidth = true };
But the column is too narrow. I tried without the Width=7
but in that case the width is assumed to be zero an the column disappears altogether.
TIA