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
相關問題