I have spent many hours trying to determine a formula to convert .NET pixels to an Excel column width using the OpenXML format. I am using EPPlus to generate xmls documents. I\'
An upgrade to the answer MikeTeeVee gave, as I was seeing discrepancies at the 3rd dp.
In the calculation of points width from the OpenXml file width the documentation states
Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.
width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
This lead me to a mostly stab in the dark experiment and come up with a conversion from pixels to width:
double width = Math.Truncate(px / 7 * 256) / 256
This returns precisely the same value as found in the OpenXml document.