Open AaronXBI opened 8 years ago
If you're adding a cloned sheet, or a new sheet from a different PHPExcel object, then consider using addExternalSheet()
instead of addSheet()
because that will copy the styles with it, rather than relying on both PHPExcel objects having exactly the same style definitions and indexes
I just tried that; it didn't make a difference in the output. Same problem.
I have an Excel XLSX file with some data and formatting that I want to use as a template, then clone the sheet using PHPExcel. When I clone the sheet using the Excel2007 reader, my background fill colors are set to black (or maybe are 'undefined'...?) - meaning: if I click in one of the fields and try to type in it, the background fill is set to . If I change to use the Excel5 reader (and save my template as an XLS file), it works fine.
This is what happens when I try to type in a cell:
If I look at the format cells options (Right-click > Format Cells > Fill tab), the "Pattern Color" field should be on automatic (as it is in my template file), but it appears to either be unset or on black:
Changing the first two lines to this (and saving my template as an xls file) works fine.
So, I have a workaround that I can use, but I've beat my head against my keyboard for a few days trying to figure this out and am hoping someone knows what I'm doing wrong or if I've stumbled on an obscure bug. I even tried creating the template in Office 2007, 2010, 2013, and 2016 - all with the same results. I thought it was something wrong with my source template file, so I tried starting with a completely empty XLSX file, but got the same results there too.
Edit: I'm using PHPExcel v1.7.7 with PHP 5.2.17 on Windows 2008 R2.