0
votes

I have xlsx-file which opens succesfully with Excel and which can be parsed with other excel-libraries than EPPlus. We are likely to continue using EPPlus, so it will be nice to get some advice with this issue.

Excel data in is plain text data without formatting.

When parsing with EPPlus with C#, let's say 3x3 sheet, parsed data is fragmented following way to memory (empty cells added to every row so total size is 3x9 or something):

r1c1 r1c2 r1c3
               r2c1 r2c2 r2c3
                              r3c1 r3c2 r3c3

instead of 3x3 array

r1c1 r1c2 r1c3
r2c1 r2c2 r2c3
r3c1 r3c2 r3c3

When opening xlsx-archive with zip viewer it seems that xl\worksheets\sheet.xml contains following data.

<x:row>
  <x:c t="inlineStr">
    <x:is>
      <x:t>Data in cell</x:t>
    </x:is>
  </x:c>
  ..
</x:row>

So no any row/column identifiers are present in previous snippet. Maybe the root cause of problem?

Another thing to notice is that when open and save same file in Excel without modifications, file size increases and sheet data seem to be moved from sheet.xml to sharedstrings.xml. After succesful saving in Excel, only row/column indices are present in sheet1.xml and file can be properly parsed with EPPlus.

1
Accoding to the source code of the latest version 4.1.0 inline strings is supported epplus.codeplex.com/SourceControl/changeset/view/… (search for xr.LocalName == "is"). Maybe download the source code and step through it to see if you can spot the problem.Ernie S
That's right. Inline strings was not the problem in this case. Problem was that there were no row/column identifiers present in sheet data. This is error against Excel data format so problem was not in library at all.Risto M

1 Answers

0
votes

Problem in this case was that there were no row/column identifiers present in sheet data. Incorrect Excel file was created with custom program using Open XML SDK.

According to Open XML SDK Guidelines (https://msdn.microsoft.com/en-us/library/office/gg278309.aspx), missing row/column identifiers is error against Excel data format so problem was not in EPPlus library.