nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.74k stars 1.44k forks source link

Validation cannot handle double quote #1369

Open zsolthungary opened 5 months ago

zsolthungary commented 5 months ago

NPOI Version

2.7.0

File Type

Upload the Excel File

Please attach your original Excel File to help us reproduce the issue

Reproduce Steps

Here is the code: CellRangeAddressList addressList = new CellRangeAddressList(); addressList.AddCellRangeAddress(1, 12, 1, 12); XSSFDataValidationHelper helper = new XSSFDataValidationHelper(pSheet); XSSFDataValidationConstraint constraint = (XSSFDataValidationConstraint)helper.CreateExplicitListConstraint( listConstraintValues); XSSFDataValidation validation = (XSSFDataValidation)helper.CreateValidation(constraint, addressList);

validation.ShowErrorBox = true; validation.CreateErrorBox("Title", pErrorMsg); validation.SuppressDropDownArrow = pIsSuppressDropDownArrow; pSheet.AddValidationData(validation);

Issue Description

if listConstraintValues contains double quote (") in a form that c# can handle (\"), then excel will return error. Excel uses double quote different way. See excel attached: M2 cell should be validated Without double quote it works fine. Error.xlsx