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

    • <bdo id='0YLps'></bdo><ul id='0YLps'></ul>
  • <small id='0YLps'></small><noframes id='0YLps'>

      1. 如何使用 PHPExcel 加入 Excel 文档?

        How can I join Excel documents using PHPExcel?(如何使用 PHPExcel 加入 Excel 文档?)

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

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

                    <tbody id='WYP9a'></tbody>
                2. 本文介绍了如何使用 PHPExcel 加入 Excel 文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 PHPExcel 来动态生成订单收据.

                  I'm using PHPExcel to dynamically generate order receipts.

                  我希望能够生成一个摘要"Excel 文件,其中包含所有订单收据(每个工作表一个).

                  I'd like to be able to generate a "summary" Excel file, containing all the order receipts (one per worksheet).

                  有没有办法用 PHPExcel 将两个(或多个)Excel 文档连接"成一个?

                  Is there a way to "join" two (or more) Excel documents into one with PHPExcel ?

                  推荐答案

                  在 Excel 中,选项卡"被称为工作表".您可以在 PHPExcel 中创建包含多个工作表的 Excel 工作簿.

                  In Excel, "tabs" are known as "worksheets". You can create an Excel workbook with multiple worksheets in PHPExcel.

                  作为参考,关于 SO 的另一个答案有 关于如何向现有工作簿添加其他工作表的易于遵循的指南.

                  For reference, another answer on SO has an easy-to-follow guide on how to add additional Worksheets to an existing workbook.

                  Codeplex 上的这篇文章 有一个添加外部工作表的示例.不过,我不确定是否需要所有重命名舞蹈.(Codeplex 链接鼓励您克隆工作表并复制克隆的工作表,以免将其从原始工作簿中删除,但我认为这不是问题,除非您将输出写入源工作簿.)我认为这样的事情应该可行:

                  This post on Codeplex has an example of adding an external sheet. I'm not sure all of the renaming dance is needed though. (The Codeplex link encourages you to clone the worksheet and copy the cloned sheet so as not to remove it from the original workbook, but I don't think that would be an issue unless you're writing output to the source workbook.) I think something like this should work:

                  function getReceiptWorksheet( $receiptNumber ) {
                      // Do something here to retrieve & return your existing receipt
                  }
                  
                  function createMasterWorkbook( $filename, $receiptNumbers ) {
                      $workbook= new PHPExcel();
                  
                      foreach( $receiptNumbers as $receiptNumber ){
                           $worksheet = getReceiptWorksheet( $receiptNumber )
                           $workbook->addExternalSheet( $worksheet );
                      }
                  
                      $objWriter = new PHPExcel_Writer_Excel2007($workbook);
                      $objWriter->save($filename);
                  }
                  

                  然后你可以调用 createMasterWorkbook('receipts.xlsx', array(1, 2, 3));.

                  这篇关于如何使用 PHPExcel 加入 Excel 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  PHP Upload File Validation(PHP 上传文件验证)
                  PHP Error - Uploading a file(PHP 错误 - 上传文件)
                  How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                  php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                  How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                  change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)
                  <i id='YWa9X'><tr id='YWa9X'><dt id='YWa9X'><q id='YWa9X'><span id='YWa9X'><b id='YWa9X'><form id='YWa9X'><ins id='YWa9X'></ins><ul id='YWa9X'></ul><sub id='YWa9X'></sub></form><legend id='YWa9X'></legend><bdo id='YWa9X'><pre id='YWa9X'><center id='YWa9X'></center></pre></bdo></b><th id='YWa9X'></th></span></q></dt></tr></i><div id='YWa9X'><tfoot id='YWa9X'></tfoot><dl id='YWa9X'><fieldset id='YWa9X'></fieldset></dl></div>

                    <tbody id='YWa9X'></tbody>

                        <bdo id='YWa9X'></bdo><ul id='YWa9X'></ul>
                        • <legend id='YWa9X'><style id='YWa9X'><dir id='YWa9X'><q id='YWa9X'></q></dir></style></legend>

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

                            <tfoot id='YWa9X'></tfoot>