Can I copy cell formats from a template file?

May 13, 2013 at 12:40 AM
Hi Forum,

Apologies if this is a noob question - I have tried doing a bit of Googling first.

I am using PHPExcel to effectively create some invoices while looping through records in a database table for a client. Using a template, I would load the file, throw in some data, and save as an invoice number. Easy peasy.

However, the client now wants all data in one, unbroken sheet in a single file. Without formatting, this is fairly simple with looping.

However, if i want to preserve the cell formats from the .xls I am loading, I am struggling to find a way to do this without individually writing these in.

Is there a way of 'copying' the styles from A1:F55 from an external sheet, for example? If not, how would you suggest getting round this?

Thanks for creating such a great library - it's helped me no end in various projects!