1

I have a few excel sheets which I want to parse using EPPlus.

Some cells in my excel worksheet contain texts as Bold, Italics or Underlined.

e.g:

0 = "Water"
1 = "Air"

When I read this cell, I get 2 elements in the RichText collection (one for the bold text and the other for the normal text).

ExcelRichTextCollection cellRichTexts = Worksheet.Cells[row, column].RichText;
foreach (ExcelRichText richText in cellRichTexts)
{
    if (richText.Bold)
    {
         // some code
    }
}

Since the first part of my excel text is in bold, richText.Bold should have returned a true value. But I get a false value here.

Also the same thing happens with the Background color of a cell.

var cellRgb = Worksheet.Cells[row, column].Style.Fill.BackgroundColor.Rgb;

cellRgb returns empty even if there are some colors applied to the cell background.

What's even more confusing to me here is that this doesn't happen always. I have many more such excel files, but the issue seems to happen only in some places and it works well elsewhere.

Is this a known issue in EPPlus package?

P.S.: At present, I have the latest version of MS Office 365, but the excel itself was manually created in one of the older versions.

AKK
  • 35
  • 5
  • It seems like the excel files creates with an older version of MS Excel and later migrated to the newer versions aren't fully compatible with EPPlus. The solution is to re-create (edit) the cells having such problems. – AKK Sep 23 '22 at 11:25

0 Answers0