Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Writetoexcel character limit fix by truncating (#271)

Nikhil Scaria0c9ca694f43b
diff --git a/src/Business/Grand.Business.System/Utilities/PropertyManager.cs b/src/Business/Grand.Business.System/Utilities/PropertyManager.cs
index 2f5646660..36ef012c5 100644
--- a/src/Business/Grand.Business.System/Utilities/PropertyManager.cs
+++ b/src/Business/Grand.Business.System/Utilities/PropertyManager.cs
@@ -75,7 +75,12 @@ namespace Grand.Business.System.Utilities.System
IRow _row = sheet.CreateRow(row);
foreach (var prop in _properties.Values)
{
- _row.CreateCell(prop.PropertyOrderPosition).SetCellValue(prop.GetProperty(CurrentObject)?.ToString());
+ var cellValue = (prop.GetProperty(CurrentObject)?.ToString());
+ if(cellValue != null && cellValue.Length >= 32767) // 32767 is the max char size of an excel cell
+ {
+ cellValue = cellValue.Substring(0, 32767); //Truncate the content to max size.
+ }
+ _row.CreateCell(prop.PropertyOrderPosition).SetCellValue(cellValue);
}
}