Excel Export does not work if column width has too many decimals.

Hey guys, we just have the following issue: 

We have a grid with resized column widths -> the colmun.Width property gets values like "72.239123". 

The code in yourGridExcelExport.cs looks like this:

Decimal result;
if (Decimal.TryParse(gridColumn.Width, out result))
gridColumn.Width = Math.Round(result).ToString((IFormatProvider) CultureInfo.InvariantCulture);
this.Sheet.Columns[this.colIndex - 1].Width = string.IsNullOrEmpty(gridColumn.Width) || !(gridColumn.Width != "auto") ? 120 : (gridColumn.Width.IndexOf("px", StringComparison.Ordinal) > 0 ? Convert.ToInt32(gridColumn.Width.Split("px")[0], (IFormatProvider) CultureInfo.InvariantCulture) : Convert.ToInt32(gridColumn.Width, (IFormatProvider) CultureInfo.InvariantCulture));


The issue: Decimal.TryParse call turns " 72.239123" into  72239123 (I guess because we are in germany and the culture is "de-DE", so we use ',' for decimals and '.' for thousands). If the number has more decimal widgets the "Convert.ToInt32" call will throw an exception because the value is bigger than allowed for Int32. I think there should be an option to pass the current culture. and use it if given for parsing.

We did not get any exceptions, and the application works fine, but nothing happens. Maybe a log would be great. We just found this while deepdiving into the issue.


Best regards

Patrick


3 Replies

RN Rahul Narayanasamy Syncfusion Team February 10, 2022 03:35 PM UTC

Hi Patrick, 

Greetings from Syncfusion. 

We have validated and considered your query as a bug and logged the defect report “Excel export not working with other cultures after column resizing” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and will include the fix in our upcoming patch release which is expected to be rolled out on or before mid of March, 2022. Until then we appreciate your patience.  
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.   


Regards 
Rahul 



RN Rahul Narayanasamy Syncfusion Team March 22, 2022 04:09 AM UTC

Hi Patrick,   
  
Sorry for the inconvenience caused.   
  
Due to unforeseen circumstances, we are unable to include the fix for the reported issue “Excel export not working with other cultures after column resizing”  in our mentioned patch release as promised. Fix for issue will be included in our weekly patch release which is excepted to be rolled out on or before mid of April 2022. 
  
  
Till then we appreciate your patience.   We will notify you once the fix is included. 
  
Regards,  
Rahul 
 



VN Vignesh Natarajan Syncfusion Team April 22, 2022 03:40 AM UTC

Hi Patrick,


Thanks for your patience. 


We are glad to announce that our Essential Studio 2022 Volume 1 release v20.1.0.47 is rolled out and is available for download under the following link.


Essential Studio 2022 Volume 1 Main Release v20.1.0.47 is available for download | Announcements Forums | Syncfusion


In this release, we have included the fix for the issue Excel export not working with other cultures after column resizing”.

https://www.syncfusion.com/feedback/32592/excel-export-not-working-with-other-cultures-after-column-resizing


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,          

Vignesh Natarajan


Loader.
Up arrow icon