how to maintain the original format/styles of columns

Topics: Developer Forum, User Forum
Apr 30, 2009 at 9:47 AM
so i have this existing excel sheet that i need to modify.
basically i'm just adding data after the last row in the sheet.
this sheet has style formats in its columns (eg. bold, large font, etc.)
i am able to write data, but after saving it, the original format is lost.
bold fonts, borders, etc are lost.
is there anyway to maintain the original formats of the columns?
pls advise...
Apr 30, 2009 at 9:57 AM
The problem could be that there is missing support for column styles in PHPExcel. Can you check if this is the problem:

Apr 30, 2009 at 10:14 AM
hi sir. does this mean there's no way to retain the original format/styles of the excel file i am manipulating?
there must be a workaround. pls advise...
May 1, 2009 at 5:30 AM
Cell styles are supported, but not column styles. I think there is a good chance that this will be supported in the future. Meanwhile, the workaround is to use cell styles, apply the styles in your template by selecting rectangular cell regions instead of entire columns.

May 1, 2009 at 6:31 AM
even cell styles are not maintained...
i created an excel sheet with one cell containing a "TEXT ORIG" value in bold font, underlined.
i then opened this file for reading and
wrote a "TEXT APPEND" value after the last row then i saved it.
when i opened the file, the "TEXT ORIG" text is no longer in bold and underlined font.
pls advise...

May 1, 2009 at 6:36 AM
The problem could be that there is missing support for Rich-Text in PHPExcel_Writer_Excel5:

How did you apply the font properties? Was that by Selecting the text (Rich-Text) or by selecting the cell (Cell style)?

May 1, 2009 at 6:50 AM
i right-clicked on the cell->choose properties->selected font->bold->underlined->ok
May 1, 2009 at 8:06 AM
Can you try to send me the Excel file so I can inspect? (erik at phpexcel dot net)

May 1, 2009 at 2:52 PM
What code are you using? I tried a plain read / write and it came out with all the formatting, bold / underline ok.

$reader = PHPExcel_IOFactory::createReader('Excel5');
$excel = $reader->load('Book1.xls');

$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');

May 2, 2009 at 7:59 AM
hi. i shifted to perl in order to solve this.
thanks for all the help!