duanjiaonie6097
2017-10-11 14:57
浏览 240
已采纳

使用Phpexcel复制包含数据透视表和图形的表格

I have to create an Excel file with a data sheet that will vary according to a database and a sheet containing multiple PivotTables that have their own PivotCharts. Having already my sheet containing my PivotTables and PivotCharts. I would just like to automate the action of "copy a sheet on another workbook".

First, I'm just trying to duplicate my file containing the sheet with the TCD and GCD.

that's my piece of code :

    $objPHPExcel1 = PHPExcel_IOFactory::load("example.xlsx");
    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel1, 'Excel2007');
    $objWriter->save('example2.xlsx');

This will create the file "example2.xlsx" but he will be empty with a single sheet instead of two.

Thanks to your help!

图片转代码服务由CSDN问答提供 功能建议

我必须创建一个Excel文件,其数据表将根据数据库和表格而有所不同 包含多个具有自己的数据透视表的数据透视表。 我的工作表已包含我的数据透视表和数据透视图。 我想自动执行“在另一个工作簿上复制工作表”的操作。

首先,我只是尝试使用TCD和GCD复制包含工作表的文件。

这是我的代码:

  $ objPHPExcel1 = PHPExcel_IOFactory :: load(“example.xlsx”); 
 $ objWriter = PHPExcel_IOFactory :: createWriter($ objPHPExcel1,'Excel2007'); 
 $ objWriter-  > save('example2.xlsx'); 
   
 
 

这将创建文件“example2.xlsx”,但他将为空而只有一张而不是两张 。

感谢您的帮助!

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doulu6160 2017-10-11 15:17
    已采纳

    PHPExcel doesn't support pivot tables.

    You'll have to use COM (with MS Excel itself) or Ilia Alshanetsky's Excel extension (with libXL).

    打赏 评论

相关推荐 更多相似问题