Note that there are some explanatory texts on larger screens.

plurals
  1. POExporting from ColdFusion to Excel, how to modify Page Setup?
    text
    copied!<p>I'm exporting from ColdFusion 9 to Excel and I want to set the page orientation and scaling so the exported excel document fits to page and prints landscape. How to accomplish this?</p> <p>Edit with solution:<br> Thanks for the assistance. The page-orientation setting worked as advertised.<br> I used the following hack to get it to fit to page width.</p> <p>This page contains documentation on the various settings that are possible:<br> <a href="http://msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx</a></p> <pre><code>&lt;cfheader name="Content-disposition" value="attachment;filename=export.xls"&gt; &lt;cfcontent type="application/application/vnd.ms-excel"&gt; &lt;!--- mso-page-orientation:landscape causes the exported excel spreadsheet to be printed landscape. Setting Scale=45 causes the printout to fit to page width for me. Per the documentation, I should be able to set &lt;x:Print&gt;&lt;x:FitWidth&gt;1&lt;/x:FitWidth&gt;&lt;x:FitHeight&gt;32767&lt;/x:FitHeight&gt;&lt;x:ValidPrinterInfo/&gt;&lt;/x:Print&gt; but it doesn't want to work. The width and height appear correctly in the Page Setup dialog, but the 'Adjust to' scale size radio button remains selected instead of the 'Fit to' one page wide by 32767 tall radio button. ---&gt; &lt;HTML xmlns:x="urn:schemas-microsoft-com:office:excel"&gt; &lt;HEAD&gt; &lt;STYLE&gt; &lt;!--table @page {mso-page-orientation:landscape;} --&gt; &lt;/STYLE&gt; &lt;!--[if gte mso 9]&gt;&lt;xml&gt; &lt;x:ExcelWorkbook&gt; &lt;x:ExcelWorksheets&gt; &lt;x:ExcelWorksheet&gt; &lt;x:WorksheetOptions&gt; &lt;x:Print&gt; &lt;x:ValidPrinterInfo/&gt; &lt;x:Scale&gt;45&lt;/x:Scale&gt; &lt;/x:Print&gt; &lt;/x:WorksheetOptions&gt; &lt;/x:ExcelWorksheet&gt; &lt;/x:ExcelWorksheets&gt; &lt;/x:ExcelWorkbook&gt; &lt;/xml&gt;&lt;![endif]--&gt; &lt;/HEAD&gt; &lt;BODY&gt; &lt;cfoutput&gt; &lt;cfloop from = "1" to = "#arrayLen(reportItems)#" index = "i"&gt; &lt;table cellpadding="1" cellspacing="1" bgcolor="dcdcdc" width="100%" border="1"&gt; ... table contents ... &lt;/table&gt; &lt;/cfloop&gt; &lt;/cfoutput&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload