This is a migrated thread and some comments may be shown as answers.

Edit excel file in backend and load on spreadsheet component.

4 Answers 778 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Rei
Top achievements
Rank 1
Rei asked on 01 Jun 2020, 10:26 AM

Hello,

 

I have a controller action where I can read an excel file, convert it to base64 send it to the front end, and decode it using a javascript function I found here on this forum.

However the problem arises when I make edits to the loaded excel through a library such as OpenXML/ClosedXML, etc... Sometimes the array size of the excel changes, sometimes it is the same but, no matter what the spreadsheet component CAN NOT read a file saved by either packages. They work fine when saved through normal excel.

 

Is there any way I can fix this? Maybe some other excel library I'm missing? The edits I need to do are fairly trivial. I'll just replace cell values, nothing more.

 

Thanks!

 

Ps: Project is in .NET Core 3.1

4 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 03 Jun 2020, 05:37 AM

Hi Rei,

We have not tested how files created by the OpenXML/ClosedXML libraries are loaded in the Spreadsheet widget. Nevertheless, if the file format is the correct one, the created files should be properly loaded in the widget. Could you, please, prepare and send us a small isolated .Net Core sample demonstrating how you load the file in the Spreadsheet and a sample file revealing the issue observed? This way we will be able to troubleshoot the issue locally and to provide you with the most appropriate assistance on the above.

As per alternative approaches to manipulate XLSX files on the server, I would recommend you our SpreadProcessing library. Here is where you could find further information on the above:

https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Rei
Top achievements
Rank 1
answered on 03 Jun 2020, 01:49 PM

Hi Veselin,

I thought that library is not available on .NET Core. I'll give that one a shot. I'll provide feedback or submit a sample .NET core app if I can't get it done myself.

Thank you!

0
Veselin Tsvetanov
Telerik team
answered on 04 Jun 2020, 11:23 AM

Hello Rei,

Take your time to test the suggested and let me know if you need any assistance in using the Telerik SpreadProcessing library with the Spreadsheet widget.

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Alex
Top achievements
Rank 1
Iron
answered on 10 May 2023, 02:28 PM | edited on 10 May 2023, 02:55 PM
Hi! Is there any solutions for this problem? I have very similiar one... Spreadsheet doesn't import  .xlsx files, which were generated by ClosedXML, while these files are not re-saved in Excel or OnlyOffice apps.
Veselin Tsvetanov
Telerik team
commented on 11 May 2023, 03:00 PM

Hi Alex,

In general, if ClosedXML produces valid non-corrupted xlsx files the Spreadsheet widget should handle them. Can you send as a very small test file that reveals the issue in question? We may be able to identify the exact issue causing the failure.

Alex
Top achievements
Rank 1
Iron
commented on 11 May 2023, 03:21 PM

Hi Veselin. Here in attachment is the file, generated by ClosedXml. It contains an empty workbook, but Spreadsheet can't import even this one.
Veselin Tsvetanov
Telerik team
commented on 15 May 2023, 09:54 AM

Hi Alex and thank you for the sample file prepared.

I have validated the file in question with the OOXML Validator available for VS Code:

https://marketplace.visualstudio.com/items?itemName=mikeebowen.ooxml-validator-vscode

but I did not identify any issues in the file.

Moreover, I have compared the structure and contents of the file in question to the version of the same file created by Excel upon saving it (that loads properly in the Spreadsheet). I did not manage to identify important differences apart from the package folder that is not present in the Excel created file. Unfortunately, even if removed from the package, the Spreadsheet widget did not load the file properly.

I am afraid, that at this stage I cannot think of any other steps that would allow me to further troubleshoot the case.

Tags
Spreadsheet
Asked by
Rei
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Rei
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Iron
Share this question
or