简体   繁体   中英

Merge cells of excel sheet from the data from database PHPExcel class

Im trying to format the excel sheet with PHPExcel class. The scenario is i fetch data from the database and i want to merge the header cells according to the count of items.

database output and the cell merging i need is shown in the image screenshot

Use the worksheet's mergeCells() method: eg

`$objPHPExcel->getActiveSheet()->mergeCells('B1:B3');`

as shown in the examples such as 05featuredemo.php and described in the PHPExcel Documentation

But your code will have to keep track of the item headers that you're adding,an work out the range of cells that need merging

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM