<?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: ODS EXCEL lacks autofit_height in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-lacks-autofit-height/m-p/772744#M25336</link>
    <description>Hi:&lt;BR /&gt;  I think this is a question best addressed by Tech Support because they could involve the PROC REPORT and the ODS EXCEL teams to address your question.&lt;BR /&gt;Cynthia</description>
    <pubDate>Thu, 07 Oct 2021 14:12:49 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2021-10-07T14:12:49Z</dc:date>
    <item>
      <title>ODS EXCEL lacks autofit_height</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-lacks-autofit-height/m-p/772663#M25335</link>
      <description>&lt;P&gt;Dissatisfied with how ODS EXCEL will wrap text by adding a newline to the text in a cell&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose you have some data and a custom style to render values in data cells in 10pt Arial&lt;/P&gt;
&lt;PRE&gt;ods _all_ close;

data a;
s1 = 'aaaaa per AAAAAAA/BBBB ccccccccccc ii ttt SSSSSSSS ii cvvvvvvvvv within the ttttt lllllll to rrrrrrr wwwww [SSSSSSSS &amp;amp;&amp;amp; NULL].';
s2 = 'The aaaaaaaa bbbb is not consistent per dddd eeeeeeee combination';
g_1 = 'xyzzy abba';
g_2 = g_1;
g_3 = g_2;
g_4 = g_3;
output;
output;
s1='aaa'; s2='bbb'; output;
output;

proc template;
  define style special;
  parent = styles.statistical;
  style fonts from fonts /
    'HeadingFont'= ('Arial', 10pt, bold)
    'DocFont'    = ('Arial', 10pt)
  ;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;The simplest ODS EXCEL will wrap text in narrow cells by inserting newline characters into the data value and will set the row height to show the 'wrapped' text.&amp;nbsp; The number of rows is too many and the wrapping is not 'clean' later when a person viewing the Excel widens a column because of those added newlines&lt;/P&gt;
&lt;PRE&gt;ods excel file="!temp\a%sysfunc(monotonic()).xlsx"   style=special 
  options( zoom='85' autofilter = 'ALL' sheet_name='one') ;

proc report data=a;
  columns s1 s2 g_: z;
  define s1  / style(column)=[cellwidth = 2in];
  define s2  / style(column)=[cellwidth = 1in];
  define g_: / style=[cellwidth = 0.5in];
run;
ods excel close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardADeVenezia_1-1633598566265.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64439iEF89369697E01C3D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardADeVenezia_1-1633598566265.png" alt="RichardADeVenezia_1-1633598566265.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ODS EXCEL options flow='TABLES' will tell Excel to wrap text (by turning on the cells format Alignment/Wrap Text) -- no embedded newlines are added to the value by ODS EXCEL.&amp;nbsp; This means when a viewer widens or narrows a column, the text will properly wrap.&lt;/P&gt;
&lt;PRE&gt;ods excel file="!temp\a%sysfunc(monotonic()).xlsx" style=special 
  options( zoom='85' autofilter = 'ALL' flow = 'TABLES' sheet_name='one');

proc report data=a;
  columns s1 s2 g_: ;
  define s1  / style(column)=[cellwidth = 2in];
  define s2  / style(column)=[cellwidth = 1in];
  define g_: / style=[cellwidth = 0.5in];
run;
ods excel close;&lt;/PRE&gt;
&lt;P&gt;How ever, the initial blank space in a cell is now worse.&amp;nbsp; The EXCEL destination is calculating a row height that is too much, or maybe Excel is not autofitting&amp;nbsp; well (hard to tell where the culprit is).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RichardADeVenezia_2-1633600124086.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64441iFDD9FF7FB424E75F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RichardADeVenezia_2-1633600124086.png" alt="RichardADeVenezia_2-1633600124086.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas how to fix that excess empty space induced by excessive row height ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In windows I might use CBTBL and CALL MODULE to use OS routines for computing needed space, but using ODS EXCEL on a Linux host.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If a nominal render length of a value rendered in Arial 10pt could be computed in Proc REPORT, a CALL DEFINE (_row_, 'STYLE', 'STYLE=[height=xx.ddin]') could be issued to set the row height.&amp;nbsp; nominal height xx.dd would be (Arial 10pt inches/line) * (1 + int(nominal length (inches) /&amp;nbsp; column width (inches)))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas on computing a nominal render length of a text string without using a graphics drawing context ?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 10:05:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-lacks-autofit-height/m-p/772663#M25335</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2021-10-07T10:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: ODS EXCEL lacks autofit_height</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-lacks-autofit-height/m-p/772744#M25336</link>
      <description>Hi:&lt;BR /&gt;  I think this is a question best addressed by Tech Support because they could involve the PROC REPORT and the ODS EXCEL teams to address your question.&lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 07 Oct 2021 14:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-lacks-autofit-height/m-p/772744#M25336</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-10-07T14:12:49Z</dc:date>
    </item>
  </channel>
</rss>

