免责声明:我是冷血新手.我正在尝试使用图像和多个选项卡创建Excel 2010文档.我已经能够将其输出到XLS中,但我无法将图像输入到文件中.
我还没有找到如何正确创建XLSx文件的完整示例.我宁愿学习正确的方法,以后养成自己的坏习惯,而不仅仅是养成坏习惯.
这是一个例子:
<!--- Make CF export to Excel --->
<!--- This will create a XLS file --->
<!--- <cfheader name="Content-Disposition" value="attachment; filename=#URL.TRNo#_image.xls">
<cfcontent type="application/vnd.msexcel"> --->
<!--- This does not work to create an XLSX file --->
<cfheader name="Content-Disposition" value="inline; filename=#URL.TRNo#_image.xlsx">
<cfcontent type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
<cfparam name="URL.TRNo" default="AD0310">
<cfoutput>
<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Styles>
<ss:Style ss:ID="Default" ss:Name="Normal">
<ss:Font ss:Size="11" ss:FontName="Calibri"/>
</ss:Style>
<ss:Style ss:ID="Left">
<ss:Alignment ss:Horizontal="Left"/>
</ss:Style>
<ss:Style ss:ID="Center">
<ss:Alignment ss:Horizontal="Center"/>
</ss:Style>
<ss:Style ss:ID="Right">
<ss:Alignment ss:Horizontal="Right"/>
</ss:Style>
</ss:Styles>
<Worksheet ss:Name="#URL.TRNo# page …Run Code Online (Sandbox Code Playgroud)