<i id='f4V8f'><tr id='f4V8f'><dt id='f4V8f'><q id='f4V8f'><span id='f4V8f'><b id='f4V8f'><form id='f4V8f'><ins id='f4V8f'></ins><ul id='f4V8f'></ul><sub id='f4V8f'></sub></form><legend id='f4V8f'></legend><bdo id='f4V8f'><pre id='f4V8f'><center id='f4V8f'></center></pre></bdo></b><th id='f4V8f'></th></span></q></dt></tr></i><div id='f4V8f'><tfoot id='f4V8f'></tfoot><dl id='f4V8f'><fieldset id='f4V8f'></fieldset></dl></div>

      <small id='f4V8f'></small><noframes id='f4V8f'>

        <bdo id='f4V8f'></bdo><ul id='f4V8f'></ul>

      <tfoot id='f4V8f'></tfoot>
    1. <legend id='f4V8f'><style id='f4V8f'><dir id='f4V8f'><q id='f4V8f'></q></dir></style></legend>

      使用 Yii 创建 PDF 或 Word 文档?

      时间:2023-09-24
        <tbody id='Oxj7J'></tbody>

        <small id='Oxj7J'></small><noframes id='Oxj7J'>

          <tfoot id='Oxj7J'></tfoot>
            <bdo id='Oxj7J'></bdo><ul id='Oxj7J'></ul>

              <legend id='Oxj7J'><style id='Oxj7J'><dir id='Oxj7J'><q id='Oxj7J'></q></dir></style></legend>
              <i id='Oxj7J'><tr id='Oxj7J'><dt id='Oxj7J'><q id='Oxj7J'><span id='Oxj7J'><b id='Oxj7J'><form id='Oxj7J'><ins id='Oxj7J'></ins><ul id='Oxj7J'></ul><sub id='Oxj7J'></sub></form><legend id='Oxj7J'></legend><bdo id='Oxj7J'><pre id='Oxj7J'><center id='Oxj7J'></center></pre></bdo></b><th id='Oxj7J'></th></span></q></dt></tr></i><div id='Oxj7J'><tfoot id='Oxj7J'></tfoot><dl id='Oxj7J'><fieldset id='Oxj7J'></fieldset></dl></div>

              1. 本文介绍了使用 Yii 创建 PDF 或 Word 文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                您好,我正在用 Yii 构建一个应用程序,现在将生成报告.我的客户想要在生成报告后编辑这些报告.我认为最好的选择是创建一个 Word 文档,这样我的客户就可以编辑它,但我找不到使用 Yii 框架创建 Word 文档的信息或扩展.

                Hello I'm building an application with Yii that will now generate reports. My client wants to edit the reports after these are generated. I think the best option is creating a Word document so my client will be able to edit it, but I can't find information or extensions to create Word documents with Yii Framework.

                我也看过但还没有测试过一些 PDF 扩展,比如 DOMPDF、tcpdf 和 Zend_PDF.但是,如果我生成 PDF 报告,那么我的客户将如何编辑此文件?

                I've also seen but not test yet a couple of PDF extensions such as DOMPDF, tcpdf and Zend_PDF. But if I generate a PDF report, then, how is my client going to edit this file?

                伙计们,我需要有关如何解决此要求的建议.生成 Word 或 PDF 文档?哪个开发解决方案最快?

                Guys I need recommendations on how to tackle this requirement. Generate Word or PDF documents? Which will be the fastest to develop solution?

                推荐答案

                更新 1:目前我得到了 PDF 的工作.我是这样做的:首先我从它的 site 下载了 TCPdf 并在 Yii 中打开它作为第三方库.然后:

                UPDATE 1: At the moment I got PDFs working. This is how I did it: First I downloaded TCPdf from its site and open it in Yii as a 3rd-party library. Then:

                Controller: protected/controllers/mycontroller.php
                public function actionGeneratePdf() {
                    Yii::import('application.vendors.*');
                    require_once('tcpdf/tcpdf.php');
                    require_once('tcpdf/config/lang/eng.php');
                    $pdf = new TCPDF();
                    $pdf->SetCreator(PDF_CREATOR);
                    $pdf->SetAuthor('Nicola Asuni');
                    $pdf->SetTitle('TCPDF Example 001');
                    $pdf->SetSubject('TCPDF Tutorial');
                    $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
                    $pdf->SetHeaderData('', 0, PDF_HEADER_TITLE, '');
                    $pdf->setHeaderFont(Array('helvetica', '', 8));
                    $pdf->setFooterFont(Array('helvetica', '', 6));
                    $pdf->SetMargins(15, 18, 15);
                    $pdf->SetHeaderMargin(5);
                    $pdf->SetFooterMargin(10);
                    $pdf->SetAutoPageBreak(TRUE, 0);
                    $pdf->SetFont('dejavusans', '', 7);
                    $pdf->AddPage();
                    $pdf->writeHTML("<span>Hello World!</span>", true, false, true, false, '');
                    $pdf->LastPage();
                    $pdf->Output("example_002.pdf", "I");
                }
                
                View: Wherever you want to place a trigger to your controller:
                echo CHtml::link('Generate PDF', array('mycontroller/generatePdf'));
                

                无论如何,我希望能够生成一个 word 文档,因为要求说报告将在生成后由用户编辑.

                Anyway I want to be able to generate a word document as the requirement says the report is going to be edited by the user after generation.

                更新 2:对于 Word 文档的报告生成这就是我正在做的.

                UPDATE 2: For the Word document's report generation this is what I am doing.

                这篇关于使用 Yii 创建 PDF 或 Word 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Yii 中的多个 CJuiAutocomplete - 项目未呈现 下一篇:在 yii 中使用 CSqlDataProvider 进行排序

                相关文章

                <i id='foLzG'><tr id='foLzG'><dt id='foLzG'><q id='foLzG'><span id='foLzG'><b id='foLzG'><form id='foLzG'><ins id='foLzG'></ins><ul id='foLzG'></ul><sub id='foLzG'></sub></form><legend id='foLzG'></legend><bdo id='foLzG'><pre id='foLzG'><center id='foLzG'></center></pre></bdo></b><th id='foLzG'></th></span></q></dt></tr></i><div id='foLzG'><tfoot id='foLzG'></tfoot><dl id='foLzG'><fieldset id='foLzG'></fieldset></dl></div>
                  <bdo id='foLzG'></bdo><ul id='foLzG'></ul>
              2. <legend id='foLzG'><style id='foLzG'><dir id='foLzG'><q id='foLzG'></q></dir></style></legend>

                <tfoot id='foLzG'></tfoot>

                1. <small id='foLzG'></small><noframes id='foLzG'>