From a7eea9e2e8928ce93614d43d47587d4c840981ac Mon Sep 17 00:00:00 2001 From: Milen Date: Wed, 20 Nov 2024 17:40:41 +0200 Subject: [PATCH] If cellValue is string no matter that it contains only numbers will put the value as text. Preventing of losing leading zeroes --- src/MiniExcel/SaveByTemplate/ExcelOpenXmlTemplate.Impl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MiniExcel/SaveByTemplate/ExcelOpenXmlTemplate.Impl.cs b/src/MiniExcel/SaveByTemplate/ExcelOpenXmlTemplate.Impl.cs index cf716bc9..efccca4d 100644 --- a/src/MiniExcel/SaveByTemplate/ExcelOpenXmlTemplate.Impl.cs +++ b/src/MiniExcel/SaveByTemplate/ExcelOpenXmlTemplate.Impl.cs @@ -1142,7 +1142,7 @@ private void UpdateDimensionAndGetRowsInfo(IDictionary inputMaps else { var cellValueStr = cellValue?.ToString(); /* value did encodexml, so don't duplicate encode value https://gitee.com/dotnetchina/MiniExcel/issues/I4DQUN*/ - if (isMultiMatch) // if matchs count over 1 need to set type=str ![image](https://user-images.githubusercontent.com/12729184/114530109-39d46d00-9c7d-11eb-8f6b-52ad8600aca3.png) + if (isMultiMatch || cellValue is string) // if matchs count over 1 need to set type=str ![image](https://user-images.githubusercontent.com/12729184/114530109-39d46d00-9c7d-11eb-8f6b-52ad8600aca3.png) { c.SetAttribute("t", "str"); }