From 7ac37edfebebc9bee201fad001e2f2f8b780a9a8 Mon Sep 17 00:00:00 2001 From: Arnie97 Date: Sat, 31 Jul 2021 00:31:51 +0800 Subject: Fix data validation issues (#975) * Fix `SetDropList` to allow XML special characters * This closes #971, allow quotation marks in SetDropList() This patch included a XML entity mapping table instead of xml.EscapeText() to be fully compatible with Microsoft Excel. * This closes #972, allow more than 255 bytes of validation formulas This patch changed the string length calculation unit of data validation formulas from UTF-8 bytes to UTF-16 code units. * Add unit tests for SetDropList() * Fix: allow MaxFloat64 to be used in validation range 17 decimal significant digits should be more than enough to represent every IEEE-754 double-precision float number without losing precision, and numbers in this form will never reach the Excel limitation of 255 UTF-16 code units. --- xmlWorksheet.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xmlWorksheet.go') diff --git a/xmlWorksheet.go b/xmlWorksheet.go index a54d51b..4499546 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -436,8 +436,8 @@ type DataValidation struct { ShowInputMessage bool `xml:"showInputMessage,attr,omitempty"` Sqref string `xml:"sqref,attr"` Type string `xml:"type,attr,omitempty"` - Formula1 string `xml:"formula1,omitempty"` - Formula2 string `xml:"formula2,omitempty"` + Formula1 string `xml:",innerxml"` + Formula2 string `xml:",innerxml"` } // xlsxC collection represents a cell in the worksheet. Information about the -- cgit v1.2.1