Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPPlus won't properly read data validations of .xlsx spreadsheet created with LibreOffice #1714

Open
megakraken opened this issue Nov 25, 2024 · 2 comments · May be fixed by #1717
Open

EPPlus won't properly read data validations of .xlsx spreadsheet created with LibreOffice #1714

megakraken opened this issue Nov 25, 2024 · 2 comments · May be fixed by #1717
Assignees
Labels
bug Something isn't working

Comments

@megakraken
Copy link

megakraken commented Nov 25, 2024

EPPlus usage

Noncommercial use

Environment

Windows

Epplus version

7.5.1

Spreadsheet application

Excel xlsx

Description

When opening an .xlsx spreadsheet with data validations that was created with LibreOffice, the AllowBlank and ShowErrorMessage properties of any ExcelDataValidation will always be false even if they are in fact enabled in the document.

The spreadsheet was created with LibreOffice 24.8.3 which is the most recent version and the version of EPPlus used is 5.7.1 (.NET Framework).

Attached is a minimalist .xlsx file containing a single data validation for the cells of column B. As can be seen on the screenshots below the Allow empty cells and Show error message when invalid values are entered are both checked. The following code, however, will print out false for both properties:

using OfficeOpenXml;
using System;

namespace Test {
    class Program {
        static void Main() {
            using (var p = new ExcelPackage("Test.xlsx")) {
                foreach (var v in p.Workbook.Worksheets[0].DataValidations) {
                    Console.WriteLine(v.AllowBlank);
                    Console.WriteLine(v.ShowErrorMessage);
                }
            }
        }
    }
}

data_validations_1
data_validations_2
Test.xlsx

@megakraken megakraken added the bug Something isn't working label Nov 25, 2024
@AdrianEPPlus
Copy link
Contributor

It appears that when we read the property in the xml we check if it's set to 1. It appears LibreOffice sets this to true. A fix has been made and will be in a future version,

@megakraken
Copy link
Author

It appears that when we read the property in the xml we check if it's set to 1. It appears LibreOffice sets this to true. A fix has been made and will be in a future version,

Great, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants