<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to autofix cell width with ExcelXP tagset? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9984#M2980</link>
    <description>Hi:&lt;BR /&gt;
  If you use TAGSETS.EXCELXP's suboption for documentation:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods tagsets.excelxp file=..... options(doc='Help');&lt;BR /&gt;
or&lt;BR /&gt;
ods tagsets.excelxp file=..... options(doc='All');&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                               &lt;BR /&gt;
you will see (in the SAS log) the options that are available for adjusting column width:&lt;BR /&gt;
 [pre]&lt;BR /&gt;
Width_Fudge:   Default Value '0.75'&lt;BR /&gt;
     Values: None, Number.&lt;BR /&gt;
     By default this value is used along with Width_Points and column width&lt;BR /&gt;
     to calculate an approximate width for the table columns.&lt;BR /&gt;
     width = Data_Font_Points * number_Of_Chars * Width_Fudge.&lt;BR /&gt;
     If 'none' this feature is turned off.&lt;BR /&gt;
                                     &lt;BR /&gt;
Width_Points:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number.&lt;BR /&gt;
     By Default the point size from the data or header style&lt;BR /&gt;
     elements are used to calculate a pseudo column width.&lt;BR /&gt;
     The column width is calculated from the given column width or&lt;BR /&gt;
     the length of the column's header text.  If the header is bigger.&lt;BR /&gt;
     In the case the header length is used, so is the header's point size.&lt;BR /&gt;
     This value overrides that point size.&lt;BR /&gt;
     This value is used along with WidthFudge and column width&lt;BR /&gt;
     to calculate an approximate width for the table columns.&lt;BR /&gt;
     width = Width_Points * number_Of_Chars * Width_Fudge.&lt;BR /&gt;
                        &lt;BR /&gt;
Default_Column_Width:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number, list of numbers.&lt;BR /&gt;
     Most procedures provide column widths, but occasionally a column&lt;BR /&gt;
     will not have a width.  Excel will resize the column to fit any&lt;BR /&gt;
     numbers but will not auto-size for character string headings.&lt;BR /&gt;
     In the case that a column does not have a width, this value will be&lt;BR /&gt;
     used instead.  The value should be the width in characters.&lt;BR /&gt;
     If the value of this option is a comma separated list.&lt;BR /&gt;
     Each number will be used for the column in the same position.  If&lt;BR /&gt;
     the table has more columns, the list will start over again.&lt;BR /&gt;
                      &lt;BR /&gt;
Absolute_Column_Width:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number, list of numbers.&lt;BR /&gt;
     This option works similarly to the default column width option&lt;BR /&gt;
     The difference is that these widths will be used regardless&lt;BR /&gt;
     of any column widths the procedure might provide.&lt;BR /&gt;
     The value should be the width in characters.&lt;BR /&gt;
     If the value of this option is a comma separated list.&lt;BR /&gt;
     Each number will be used for the column in the same position.  If&lt;BR /&gt;
     the table has more columns, the list will start over again.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                     &lt;BR /&gt;
There is no suboption for doing an autofit on width. The Spreadsheet Markup Language XML is not the same as VBA -- so if there is a way to autofit width, it would have to be an XML method, not a VBA method.&lt;BR /&gt;
 &lt;BR /&gt;
When I use Notepad to look in the XML file created by SAS (for a simple PROC PRINT of SASHELP.CLASS using TAGSETS.EXCELXP), I see this ss:AutoFitWidth attribute:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&amp;lt;Table ss:StyleID="_body"&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
    &lt;BR /&gt;
So that means that ODS TAGSETS.EXCELXP is sending the AutoFitWidth attribute with a value of 1 and an explicit ss:Width value.&lt;BR /&gt;
&lt;BR /&gt;
From the Microsoft site:&lt;BR /&gt;
&lt;A href="http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx&lt;/A&gt;&lt;BR /&gt;
it says:&lt;B&gt;&lt;BR /&gt;
[quote]&lt;BR /&gt;
Attribute:   ss:AutoFitWidth &lt;BR /&gt;
          &lt;BR /&gt;
Description: If this attribute is specified as True ("1"), it means that this column should be autosized for numeric and date values only. We do not autofit textual values. &lt;BR /&gt;
              &lt;BR /&gt;
If both ss:Width and ss:AutoFitWidth exist, the behavior is as follows: &lt;BR /&gt;
                        &lt;BR /&gt;
ss:AutoFitWidth="1" and ss:Width is unspecified: Autofit the column width to fit the content. &lt;BR /&gt;
ss:AutoFitWidth="1" and ss:Width is specified: Set the column to the specified width and only autofit if the size of the content is larger than the specified width. &lt;BR /&gt;
ss:AutoFitWidth="0" and ss:Width is unspecified: Use the default column width. &lt;BR /&gt;
ss:AutoFitWidth="0" and ss:Width is specified: Use the specified width. &lt;BR /&gt;
[/endquote] &lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
I think that this sentence bears repeating (from the Microsoft quote above):&lt;BR /&gt;
&lt;B&gt;We do not autofit textual values. &lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
Since that statement is coming from Microsoft, that means TAGSETS.EXCELXP must live by these rules. But, since there are suboptions to explicitly specify a width, you can use those suboptions -- either Default_Column_Width or Absolute_Column_Width should work for you. You will find an example of setting column widths in this user group paper:&lt;BR /&gt;
&lt;A href="http://www.nesug.org/proceedings/nesug08/ap/ap06.pdf" target="_blank"&gt;http://www.nesug.org/proceedings/nesug08/ap/ap06.pdf&lt;/A&gt; &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Thu, 30 Sep 2010 16:00:35 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-09-30T16:00:35Z</dc:date>
    <item>
      <title>How to autofix cell width with ExcelXP tagset?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9983#M2979</link>
      <description>Hi guys,  I'm stumped.  I'm creating an excel workbook via the ExcelXP tagset and I can't seem to figure out how to autofit the width of the cells.  I can manually adjust the size of each field but there are hundreds of fields so this is no good.  &lt;BR /&gt;
&lt;BR /&gt;
In VBA it would be: Cells.EntireColumn.AutoFit</description>
      <pubDate>Thu, 30 Sep 2010 15:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9983#M2979</guid>
      <dc:creator>FrankE</dc:creator>
      <dc:date>2010-09-30T15:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to autofix cell width with ExcelXP tagset?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9984#M2980</link>
      <description>Hi:&lt;BR /&gt;
  If you use TAGSETS.EXCELXP's suboption for documentation:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods tagsets.excelxp file=..... options(doc='Help');&lt;BR /&gt;
or&lt;BR /&gt;
ods tagsets.excelxp file=..... options(doc='All');&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                               &lt;BR /&gt;
you will see (in the SAS log) the options that are available for adjusting column width:&lt;BR /&gt;
 [pre]&lt;BR /&gt;
Width_Fudge:   Default Value '0.75'&lt;BR /&gt;
     Values: None, Number.&lt;BR /&gt;
     By default this value is used along with Width_Points and column width&lt;BR /&gt;
     to calculate an approximate width for the table columns.&lt;BR /&gt;
     width = Data_Font_Points * number_Of_Chars * Width_Fudge.&lt;BR /&gt;
     If 'none' this feature is turned off.&lt;BR /&gt;
                                     &lt;BR /&gt;
Width_Points:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number.&lt;BR /&gt;
     By Default the point size from the data or header style&lt;BR /&gt;
     elements are used to calculate a pseudo column width.&lt;BR /&gt;
     The column width is calculated from the given column width or&lt;BR /&gt;
     the length of the column's header text.  If the header is bigger.&lt;BR /&gt;
     In the case the header length is used, so is the header's point size.&lt;BR /&gt;
     This value overrides that point size.&lt;BR /&gt;
     This value is used along with WidthFudge and column width&lt;BR /&gt;
     to calculate an approximate width for the table columns.&lt;BR /&gt;
     width = Width_Points * number_Of_Chars * Width_Fudge.&lt;BR /&gt;
                        &lt;BR /&gt;
Default_Column_Width:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number, list of numbers.&lt;BR /&gt;
     Most procedures provide column widths, but occasionally a column&lt;BR /&gt;
     will not have a width.  Excel will resize the column to fit any&lt;BR /&gt;
     numbers but will not auto-size for character string headings.&lt;BR /&gt;
     In the case that a column does not have a width, this value will be&lt;BR /&gt;
     used instead.  The value should be the width in characters.&lt;BR /&gt;
     If the value of this option is a comma separated list.&lt;BR /&gt;
     Each number will be used for the column in the same position.  If&lt;BR /&gt;
     the table has more columns, the list will start over again.&lt;BR /&gt;
                      &lt;BR /&gt;
Absolute_Column_Width:   Default Value 'None'&lt;BR /&gt;
     Values: None, Number, list of numbers.&lt;BR /&gt;
     This option works similarly to the default column width option&lt;BR /&gt;
     The difference is that these widths will be used regardless&lt;BR /&gt;
     of any column widths the procedure might provide.&lt;BR /&gt;
     The value should be the width in characters.&lt;BR /&gt;
     If the value of this option is a comma separated list.&lt;BR /&gt;
     Each number will be used for the column in the same position.  If&lt;BR /&gt;
     the table has more columns, the list will start over again.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                     &lt;BR /&gt;
There is no suboption for doing an autofit on width. The Spreadsheet Markup Language XML is not the same as VBA -- so if there is a way to autofit width, it would have to be an XML method, not a VBA method.&lt;BR /&gt;
 &lt;BR /&gt;
When I use Notepad to look in the XML file created by SAS (for a simple PROC PRINT of SASHELP.CLASS using TAGSETS.EXCELXP), I see this ss:AutoFitWidth attribute:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&amp;lt;Table ss:StyleID="_body"&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
&amp;lt;ss:Column ss:AutoFitWidth="1" ss:Width="60"/&amp;gt;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
    &lt;BR /&gt;
So that means that ODS TAGSETS.EXCELXP is sending the AutoFitWidth attribute with a value of 1 and an explicit ss:Width value.&lt;BR /&gt;
&lt;BR /&gt;
From the Microsoft site:&lt;BR /&gt;
&lt;A href="http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx&lt;/A&gt;&lt;BR /&gt;
it says:&lt;B&gt;&lt;BR /&gt;
[quote]&lt;BR /&gt;
Attribute:   ss:AutoFitWidth &lt;BR /&gt;
          &lt;BR /&gt;
Description: If this attribute is specified as True ("1"), it means that this column should be autosized for numeric and date values only. We do not autofit textual values. &lt;BR /&gt;
              &lt;BR /&gt;
If both ss:Width and ss:AutoFitWidth exist, the behavior is as follows: &lt;BR /&gt;
                        &lt;BR /&gt;
ss:AutoFitWidth="1" and ss:Width is unspecified: Autofit the column width to fit the content. &lt;BR /&gt;
ss:AutoFitWidth="1" and ss:Width is specified: Set the column to the specified width and only autofit if the size of the content is larger than the specified width. &lt;BR /&gt;
ss:AutoFitWidth="0" and ss:Width is unspecified: Use the default column width. &lt;BR /&gt;
ss:AutoFitWidth="0" and ss:Width is specified: Use the specified width. &lt;BR /&gt;
[/endquote] &lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
I think that this sentence bears repeating (from the Microsoft quote above):&lt;BR /&gt;
&lt;B&gt;We do not autofit textual values. &lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
Since that statement is coming from Microsoft, that means TAGSETS.EXCELXP must live by these rules. But, since there are suboptions to explicitly specify a width, you can use those suboptions -- either Default_Column_Width or Absolute_Column_Width should work for you. You will find an example of setting column widths in this user group paper:&lt;BR /&gt;
&lt;A href="http://www.nesug.org/proceedings/nesug08/ap/ap06.pdf" target="_blank"&gt;http://www.nesug.org/proceedings/nesug08/ap/ap06.pdf&lt;/A&gt; &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 30 Sep 2010 16:00:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9984#M2980</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-09-30T16:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to autofix cell width with ExcelXP tagset?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9985#M2981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, It would really be helpful if the concpets of width points and width fudge are little more eloberative.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it in terms of the&amp;nbsp; number of characters that the column width is arrived at after the multiplication as stated above?&lt;/P&gt;&lt;P&gt;What is the physican significance of the option width_points and width_fudge?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2013 10:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9985#M2981</guid>
      <dc:creator>vijayanand</dc:creator>
      <dc:date>2013-10-21T10:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to autofix cell width with ExcelXP tagset?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9986#M2982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; It would be better if you didn't add a new post to the end of a post from 3 years ago. If you have a new question, it is better to make a new post and include a reference to the original post that triggered your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; For questions about the internals of how TAGSETS.EXCELXP specifies width (after the calculations), your best bet for an answer is to work with SAS Tech Support. I believe that Width_Points and Width_Fudge use the number of characters as specified by either DEFAULT_COLUMN_WIDTH or ABSOLUTE_COLUMN_WIDTH in their formulas, so they are impacted by either the widths specified with these 2 suboption OR it calculates the width based on the size of the header text compared to the size of the cell values and picks the larger of the 2 values as the number of characters to use in the formulas.&amp;nbsp; But that is my understanding, I am not sure it is entirely correct. It would be better for you to check with Tech Support on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Oct 2013 02:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-autofix-cell-width-with-ExcelXP-tagset/m-p/9986#M2982</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-10-22T02:44:08Z</dc:date>
    </item>
  </channel>
</rss>

