Simply duplicate an xlsx file failed

Topics: Developer Forum, User Forum
Mar 13, 2013 at 3:02 PM
Edited Mar 13, 2013 at 6:38 PM
Informations :

Server configuration :
PHP 5.3.10-1ubuntu3.5 with Suhosin-Patch (cli) (built: Jan 18 2013 23:45:59)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Framework informations:

The latest one, retrieved from github master.


I'm trying to load an existing xlsx file, and duplicate it into a new one, without success!

I'm doing like this :
$src = PHPExcel_IOFactory::load('./src.xlsx');
$target = $src->copy();
$writer = PHPExcel_IOFactory::createWriter($target, 'Excel2007');
First observations, all sheets have been inserted in a reverted order. Next is that content of the souce file is missing, and the last one: rendering is something crazy!

I attach you some screen capture bellow:

Source :
Dest :
Additionnal informations :

I do this test case :

When I dump the file content, he seems to be good. Then, I add the following lines :

$writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

When I'm opening the file, I can reproduce the same bug I described here.

Edit 3 (or 4...):

It seems to be a default with default height and width on the worksheet.
First think, rightToLeft is setted to true by default. Maybe a fix need to be implemented here, but a call to setRightToLeft(false) is solving the issue of column name on the right side;

Second think
When you select every cells of the sheet, then go to format => cell => width, check the 'Optimal Width' box and then apply, columns are right. Do the same for rows and you will get the right render.

Sorry for my poor english level, that's not my native language!