0

HTMLテーブルをPDFドキュメントにエクスポートしようとしてColdFusionに取り組んでいます。この HTML テーブルは、外部の CSS ファイルからスタイルを取得しています。問題は、エクスポート時にテーブル形式が PDF ドキュメントにエクスポートされないことです。ブラウザでレンダリングされたテーブルを(フォーマットとともに)エクスポートする必要があります。

以下は同じコードです。

コンテンツ.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>

どんな助けでも大歓迎です。

4

1 に答える 1

3

作業中のコードを表示すると、この質問に答えるのに役立ちますが、cfdocumentブロック内に CSS リンクがありますか? それでもうまくいかない場合は、次のことを試してください。

<cfdocument ...>
    <html> 
        <head>      
            <style>
                <cfinclude template = "yourCSSfile.css">
            </style>
        </head>
        <body>
            <table>
                ...
            </table>
        </body>
    </html>
</cfdocument>
于 2013-03-05T12:56:44.043 に答える