Problem with column widths and inserted images

Topics: User Forum
Dec 30, 2009 at 2:29 PM

Hi!

I have PHP Version 5.2.9, PHPExcel version 1.6.3, 2008-08-25, running on XAMPP for Windows Version 1.7.1.

When I open XLS or XLSX file and save it as another file name without any file alterations, images in Excel file are lost and column widths are not saved (all column widths reset to default column width).

What am I doing wrong?

 

My code:

     /** Error reporting */
        error_reporting(E_ALL);
        
        /** Include path **/
        set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');
        
        /** PHPExcel_IOFactory */
        include 'PHPExcel/IOFactory.php';
        
        if (!file_exists($template_name))
            exit("Excel file '" . $template_name . "' missing.\n");
        
        $objReader = PHPExcel_IOFactory::createReader('Excel5');
        $objPHPExcel = $objReader->load($template_name);
        
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save($file_name);

Jan 4, 2010 at 7:44 AM

Is there anything else than reading and writing excel file in order to keep source file formatting - someone, please?

Jan 4, 2010 at 9:00 AM

OKAY, PROBLEM SOLVED!!!

I've just done some very stupid thing. For every row I have done getRowHeight(), than setRowHeight() and that's it!!??

 

Anyhow, only real problem I now have is being unable to automatically adjust row height after inserting text from PHPExcel.

 

Developer
Jan 14, 2010 at 11:56 AM
ulezacvenje wrote:

Anyhow, only real problem I now have is being unable to automatically adjust row height after inserting text from PHPExcel.

This should be fixed since PHPExcel 1.7.1.

Work item 10503 - AutoFit (autosize) row height not working in PHPExcel_Writer_Excel5

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10503

Jan 16, 2010 at 10:14 AM

Okay, thanx :)