0
我正在尝试将HTML表格导出为PDF文档的ColdFusion。该HTML表格从外部CSS文件派生其样式。问题在于,在导出时,表格格式不在PDF文档中导出。我需要将表格导出为在浏览器中呈现(以及其格式)。在ColdFusion中将HTML表格及其样式导出为PDF
以下是相同的代码。
Content.cfm
<cfsavecontent variable="pdfREPORT">
<table id="dep" class="main_table" cellpadding="0">
<tr class="h1">
<th>cell1</th>
<th>cell2</th>
<th>cell3</th>
<th>cellN</th>
</tr>
.
.
.
<cfoutput query="qry1">
<tr>
<td>#qry1.col1#</td>
<td>#qry1.col2#</td>
<td>#qry1.col3#</td>
<td>#qry1.colN#</td>
</tr>
</cfoutput>
</table>
</cfsavecontent>
extract_to_pdf.cfm
<cfsetting enablecfoutputonly="true">
<cfheader name="Content-Disposition" value="inline;filename=test.pdf">
<cfcontent type="application/pdf">
<cfdocument format="PDF" localurl="yes" marginTop=".25" marginLeft=".25" marginRight=".25" marginBottom=".25"
pageType="custom" pageWidth="8.5" pageHeight="10.2" mimetype="text/html">
<html>
<head>
<style>
<cfinclude template = "styles/tableStyle.css">
</style>
</head>
<body>
<cfoutput>#Form.pdfREPORT#</cfoutput>
</body>
</html>
</cfdocument>
任何帮助,高度赞赏。
请张贴您的代码。没有看到它,我们无法真正帮助。 – 2013-03-05 13:34:46
不要将CSS样式内联?你尝试过吗? – ale 2013-03-05 13:42:36
@AlEverett文档样式不需要内联'
回答
显示您正在使用的代码将帮助我们回答此问题,但是,您的
cfdocument
区块内是否有您的CSS链接?如果你这样做,它仍然无法正常工作,请尝试:来源
2013-03-05 12:56:44 Travis
感谢Travis的建议。我已经上传了上面的代码。但这似乎并不奏效。我也试过 @import url(“styles/tableStyle.css”); 但还没有运气。 – 2013-03-05 15:17:13
非常感谢特拉维斯!这有帮助。 – 2013-03-05 18:24:45
相关问题