XLSX sheets created with LibreOffice "corrupted" on read/write

Topics: User Forum
Aug 14, 2012 at 9:26 PM

I'm working on a project that requires reading in an existing .xlsx file, modifiying it, and writing out a new copy. I'm getting odd results.

To simplify the testing, I created a spreadsheet in LibreOffice that has "tom", "dick" and "harry" in A1:A3 and 5, 6, and 7 in B1:B3.  I write it out as a .xlsx file.  Then I run what is basically the test program 07reader.php - the only change is to get the file names from the command line.

When I open the copied .xlsx file in LibreOffice, it does not complain about the file format.  However, the row numbers are on the right, and the sheet names are at the right going left (perhaps switched to a right to left language?).  The A, B, C ... column headings are missing and the cell area is all grey.

If I use PHPExcel to create the file, the copy works perfectly, so I'm pretty sure the copy is OK.  For the project I need to preserve formulas, etc., so I've not tried ReadDataOnly.

I'm using PHPExcel v. 1.7.7, PHP v. 5.3.8, and LibreOffice

I've ordered Office 2010 to see if the same thing happens there, but I was hoping LibreOffice would work as well


-- bill

Aug 15, 2012 at 1:01 AM
Edited Aug 15, 2012 at 1:02 AM

What version of Windows are you running with LibreOffice?

I've had issues with LibreOffice 3.5 (not sure about the with Windows XP.

I had to revert back to LibreOffice 3.4 in order to open previously created files (that I created with LibreOffice).

So it's possible it could be LibreOffice. Just something to know.

- Christopher Mulllins

Aug 15, 2012 at 10:33 PM

I'm actually running LibreOffice on a Mac.

However, I'm pretty sure you're right it's a LibreOffice Issue, not a PHPExcel issue.

I purchased Office 2010, and installed it on a Windows XP virtual machine.  If I create a .xlsx file with Excel, then run the copy program mentioned above, the resulting file is OK in both LibreOffice and Excel.

What's even more interesting is this.  As I described above, when I copied a file created by LibreOffice, the resulting file had all sorts of strange results.  But if I first open that file in Excel and save it, then run copy on the saved version from Excel, it's file.  So apparently Excel fixes whatever was wrong.

I'll give an older version a try.

-- bill

Aug 16, 2012 at 12:02 AM

On a side note:

Version 3.6 of LibreOffice was just released.

- Christopher Mullins