Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: Insert image in excel file and file size growing..

$
0
0
MarkBaker wrote:

If the worksheet contains the data that you expect, then you really shouldn't worry about this. 4MB isn't particularly large for a file.

PHPExcel is not a file editor: it doesn't simply add a few extra cells into the original file that might simply add a few bytes to the resultant size. It loads the file, converting its content to a PHPExcel object; you modify that PHPExcel object; and when you save, it writes a new file from the content of that PHPExcel object. Excel itself has a lot of different options for the way it stores the spreadsheet data, and the resources to optimise to store them extremely efficiently when it saves. PHPExcel stores in a generic manner, without the overhead of determining how best to optimise the resultant file to a minimal size. PHPExcel may, for example, save additional default styles that aren't used in the workbook, whereas Excel itself may discard these. You don't mention which format you're using: .xlsx or .xls... the former is zip compressed; but the zip compression method used by ZipArchive may not match the compression method used by Excel.

So there's a whole host of factors that come into play that affect the size of a saved file: what's generally more important is that the content is correct.


This is the answer that Mark gave me to my question because I was having a similar problem when opening a .xlt template (Excel5 format) and saving as a .xls (Excel5).  If you are using the newer format, Excel2007, then hopefully he will have a different answer that could help you out.

 

~ Mike


Viewing all articles
Browse latest Browse all 2707

Trending Articles