It is impossible to Save or generate a PDF file

Hello,

I wanted to report a bug in which I am unable to Save or generate a PDF file from this attached file after opening it in Spreadsheet component. I am getting an error HTTP 500 on my ASP.NET Core backend project's endpoints due to the error "System.FormatException: 'Input string was not in a correct format.'" in saveSettings. However, this error occurs only when I load the specific culture (for example Polish or French) to my backend ASP.NET Core project's Startup.cs file in the following way:

  • public void ConfigureServices function:
services.Configure<RequestLocalizationOptions>(options =>
{ options.DefaultRequestCulture = new RequestCulture("pl-PL"); });

  • public void Configure function:

app.UseRequestLocalization();

I am using the Spreadsheet component v. 19.4.43 on front-end side and Syncfusion.EJ.Spreadsheet.AspNet.Core v. 19.4.0.50 on backend side. 

Also, I have noticed that there is a difference in Request Payload 's (sent from front-end side) saveSettings JSONData's values depending if the culture is set on and off on backend side. When the culture is on the Duplicate ranges are separated by whitespace instead of commas (Please see the attached screenshots)

Best Regards,

Ignacy Mielniczek


Attachment: Screenshots_and_a_sample_file_c415995a.zip

9 Replies

SP Sangeetha Priya Murugan Syncfusion Team April 11, 2022 11:38 AM UTC

Hi Ignacy,


We have checked your reported issue based on your provided excel file and it is exported properly in our end. So, before we proceed further, please share the below details.


1. Please share the JSONData that you have sent to the server in text file format.

2. Please share the sample level customization codes for both client and server.

3. If possible, please share the issue replicable sample


Could you please check the above details and get back to us with above requested details, based on that we will check and provide you a better solution.


Regards,

Sangeetha M



IM Ignacy Mielniczek April 11, 2022 03:22 PM UTC

Hello Sangeetha, 

I have attached two JSONData files which are being sent from the front-end side to the backend, depending from the culture's settings is on or off on the backend side.

Please note that the error occurs even though I am using the Spreadsheet component's default Save method on front-end side which sends a request to <url_to_document_service>/Save URL.

And here is the implementation of Save method on backend side:

        [HttpPost("Save")]
        [Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]
        [Route("[controller]/Save")]
        public IActionResult Save([FromForm] SaveSettings saveSettings)
        {
            return Workbook.Save(saveSettings);
        }

Best Regards,

Ignacy Mielniczek


Attachment: Culture_on_or_off_JSONData_98647696.zip


SP Sangeetha Priya Murugan Syncfusion Team April 12, 2022 12:27 PM UTC

Hi Ignacy,


Based on your provided JSONData the cause of this issue is due to the conditional format ranges are splitted by space instead of comma. But in excel multiple range applied conditional formats are separated by commas, we have also provided this support for comma separated ranges. For more details, please refer the below screenshots


In JSONData



In MS Excel




Could you please share the details, how you have created this JSONData whether by loading the excel file in spreadsheet and save it as JSON? If yes, please share us the excel file or any other way please share the details, how you create this JSONData. Based on that we will check and provide you a better solution quickly.


Regards,

Sangeetha M





IM Ignacy Mielniczek April 20, 2022 03:34 PM UTC

Hello Sangeetha,

I am sending you the exact steps to reproduce this bug:

  • Load the Polish culture by adding its configuration to public void ConfigureServices function in Startup.cs file in ASP.NET Core project. 
    • Add the code shown below to public void ConfigureServices function
            services.Configure<RequestLocalizationOptions>(options =>
            {
                options.DefaultRequestCulture = new RequestCulture("pl-PL");
            });
    • Add the code shown below to public void Configure function: 
app.UseRequestLocalization();
  • Run ASP.NET Core project in docker container and configure the Spreadsheet component to communicate.
  • Open the attached Sample.xlsx file using the Open function from File Menu.
  • After Opening (please don't do any actions in Spreadsheet component) please try to Save As another new MS Excel or PDF file using the Save As function from File Menu. At this moment, it will be easy for you to notice that the JSONData payload which is sent to ASP.NET Core project (with Polish culture loaded) is different from the JSONData payload which is sent to ASP.NET Core project (with default culture).
PS. 
  1. There is also a bug that some colored cells are shown in totally black in generated PDF file from Sample.xlsx file. I have attached Sample.pdf output as well.
  2. The JSONData which was mentioned in your previous comment was generated by the Spreadsheet component's saveAsJson() method on front-end side.

Best Regards,
Ignacy Mielniczek

Attachment: Sample_files_cd603987.zip


SP Sangeetha Priya Murugan Syncfusion Team April 22, 2022 02:31 PM UTC

Hi Ignacy,


We need to validate more on your reported issues. So, we will update you the further details on April 26th, 2022. We appreciate your patience until then.


Regards,

Sangeetha M



SP Sangeetha Priya Murugan Syncfusion Team April 26, 2022 01:20 PM UTC

Hi Ignacy,


Issue 1: Exception throws while exporting the conditional formatting applied discontinues range excel file


We considered this as improvement and the fix will be available in any of our upcoming release. we appreciate your patience until then. You can track the status of this improvement using below link from our feedback portal. 


Feedback Portal Link: https://www.syncfusion.com/feedback/34441/to-apply-conditional-formats-for-discontinuous-range-based-on-loaded-culture


Meanwhile, we would suggest you the workaround solution to avoid this issue by using openComplete event. In this we have replaced the space separator with comma for range value in conditional formats.

Please find the sample link below.


Sample Link: https://stackblitz.com/edit/angular-mfvr8f?file=app.component.ts


Issue 2: Background color not exported properly


We have checked your reported issue and we have confirmed this as defect and the fix will be available in our May 11th, 2022 patch release, we appreciate your patience until then. You can track the status of this defect using below link from our feedback portal, 


Feedback Portal Link:  https://www.syncfusion.com/feedback/34439/background-color-not-exported-properly-when-the-conditional-formatting-contains


Regards,

Sangeetha M



SP Sangeetha Priya Murugan Syncfusion Team May 13, 2022 07:45 AM UTC

Hi Ignacy,


We are glad to announce that our Essential Studio 2022 Volume 1 SP release v20.1.0.55  is rolled out and is available for download under the following link. We have provided the fix for the reported issue(Background color not exported properly) in this release.


https://www.syncfusion.com/forums/174993/essential-studio-2022-volume-1-service-pack-release-v20-1-0-55-is-available-for-download


Release Notes: https://ej2.syncfusion.com/angular/documentation/release-notes/20.1.55/?type=all#spreadsheet


Feedback: https://www.syncfusion.com/feedback/34439/background-color-not-exported-properly-when-the-conditional-formatting-contains


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,          

Sangeetha M



IM Ignacy Mielniczek May 16, 2022 02:39 PM UTC

Hello Sangeetha,

Thank you very much for the update. I will check and let you know soon if the issue was resolved on our side.

Best Regards,

Ignacy Mielniczek



SP Sangeetha Priya Murugan Syncfusion Team May 17, 2022 11:58 AM UTC

Hi Ignacy,


Thanks for your update, take your time and we will wait to hear from you.


Regards,

Sangeetha M


Loader.
Up arrow icon