Excel 2003 XML format - AutoFitWidth not working

Peter picture Peter · Oct 5, 2008 · Viewed 27.5k times · Source

I have a program that spits out an Excel workbook in Excel 2003 XML format. It works fine with one problem, I cannot get the column widths to set automatically.

A snippet of what I produce:

  <Table >
   <Column ss:AutoFitWidth="1" ss:Width="2"/>
   <Row ss:AutoFitHeight="0" ss:Height="14.55">
    <Cell ss:StyleID="s62"><Data ss:Type="String">Database</Data></Cell>

This does not set the column to autofit. I have tried not setting width, I have tried many things and I am stuck.

Thanks.

Answer

s&amp;#248;ren Jacobi picture s&#248;ren Jacobi · Oct 5, 2008

Only date and number values are autofitted :-( quote: "... We do not autofit textual values"

http://msdn.microsoft.com/en-us/library/aa140066.aspx#odc_xmlss_ss:column