This project has moved. For the latest updates, please go here.

Opening Generated files in LibreOffice

Jun 19, 2012 at 3:53 AM

I have been trying to open generated files in LibreOffice with no luck. I see that there were some previous posts here and here but I am using the latest version and the latest source but with no luck.

Has support for Libre Office been broken in the newer versions of EPPlus?

How can I get excel files generated with EPPlus to open in LibreOffice?

 

Thanks

Jun 19, 2012 at 12:04 PM

OK after trying out the generated excel files on MS Excel 2011 it appears that the issues with the files could be related to the use of Mono. When trying to open the files in MS Excel 2011 I get a corrupted file error. Clicking on the option to repair does not help.

I have seen this here which fixes the issues with URI's. I tried this code. I still get the corrupt error when opening in MS Excel. On repairing, excel keeps the file open but the worksheet is empty.

Is there any up to date status on using EPPlus on Mono? Can EPPlus be used with mono?

Jun 19, 2012 at 12:09 PM

Here is the log output after running the repair:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<
logFileName>Repair Result to Policies 2012 - International 08334.xml</logFileName>
<
summary>Errors were detected in file 'Macintosh HD:Users:liam:Projects:techcertain:TCDocs:SchemeProjectRoot:Policies 2012 -
International.xlsx'</summary>
<additionalInfo>
<info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info>
</additionalInfo><removedRecords summary="Following is a list of removed records:">
<
removedRecord>Removed Records: Worksheet properties from /xl/workbook.xml (Workbook)</removedRecord>
</
removedRecords></recoveryLog>

Jun 27, 2012 at 7:00 AM
Edited Jun 27, 2012 at 7:01 AM

I have just created a workaround for this.

By the way, for testing xlsx files without owning Microsoft Office, and for more detailed error messages:
get the Open XML SDK 2.0 for Microsoft Office from http://www.microsoft.com/en-us/download/details.aspx?id=5124
it is installed then for example here: C:\Program Files (x86)\Open XML SDK\V2.0\tool

I have added a note to http://epplus.codeplex.com/workitem/13096 and committed all the workarounds that I have found for EPPlus to work with Mono to this fork: http://epplus.codeplex.com/SourceControl/network/forks/tpokorra/monoWorkarounds

Jul 19, 2012 at 10:41 PM

Hi tpokorra

Thank you for this. I have tried your branch but I am still having trouble getting it to work. I think it is to do with the uri issue with mono.

I am getting a null reference exception using Epplus on mono on my mac. The exception is happening in:

Class: ExcelWorksheet

Function: CreateXml

Line #: 545

Line: Stream stream = packPart.GetStream();

It seems that the line before this PackagePart packPart = _package.Package.GetPart(WorksheetUri); is not working properly and the pakPart variable is null.

Any ideas on how to fix this? This error seems to occur in the Web Samples 3 and 4.

Thanks

Liam

Jul 22, 2012 at 9:47 PM

Hello Liam,

I have tried to reproduce your problem.

What is the stacktrace of the exception? I assume your exception happens in GetSamples.aspx.cs in line 115, ExcelPackage pckTemplate = new ExcelPackage();
If that is the case, this does work for me on Mono 2.10.5. I did not use the websample though, but copied the code into a normal exe, so if your exception happens somewhere else, I might try that instead.

Which version of Mono are you using?

All the best,

  Timotheus