我從ColdFusion 9導出到Excel,我想設置頁面方向和縮放比例,以便導出的Excel文檔適合頁面和打印景觀。如何做到這一點?從ColdFusion導出到Excel,如何修改頁面設置?
編輯方案:
感謝您的協助。頁面方向設置與廣告一樣工作。
我用下面的hack來使它適合頁面寬度。
此頁面包含了可能的各種設置文檔:
http://msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx
<cfheader name="Content-disposition" value="attachment;filename=export.xls">
<cfcontent type="application/application/vnd.ms-excel">
<!---
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
<x:Print><x:FitWidth>1</x:FitWidth><x:FitHeight>32767</x:FitHeight><x:ValidPrinterInfo/></x:Print>
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.
--->
<HTML xmlns:x="urn:schemas-microsoft-com:office:excel">
<HEAD>
<STYLE>
<!--table
@page {mso-page-orientation:landscape;}
-->
</STYLE>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
<x:Scale>45</x:Scale>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]-->
</HEAD>
<BODY>
<cfoutput>
<cfloop from = "1" to = "#arrayLen(reportItems)#" index = "i">
<table cellpadding="1" cellspacing="1" bgcolor="dcdcdc" width="100%" border="1">
... table contents ...
</table>
</cfloop>
</cfoutput>
</BODY>
</HTML>
你能否提供一個代碼示例,顯示你到目前爲止? – Micah 2012-01-04 21:16:40