Completed
Last Updated: 17 Aug 2021 06:37 by ADMIN
Naveen
Created on: 26 Aug 2020 11:49
Category: Spreadsheet
Type: Bug Report
3
Excel file created with Workbook toDataURL method is corrupted

Bug report

Excel file is corrupted when it is created with the kendo.ooxml.Workbook toDataURL method, using stringified sheet data:

let dataURL = new kendo.ooxml.Workbook(JSON.stringify(data)).toDataURL();

If the data is passed to the Workbook without stringifying it, this causes a circular reference error (check the console).

let dataURL = new kendo.ooxml.Workbook(data).toDataURL();

Reproduction of the problem

Dojo example.

  1. Click the "To Json" button above the Spreadsheet.
  2. Try to open the generated file in Excel.

Current behavior

The generated Excel file is corrupted

Expected/desired behavior

The generated Excel file is not corrupted

Environment

  • Kendo UI version: 2020.2.617
  • jQuery version: x.y
  • Browser: [all]
1 comment
ADMIN
Neli
Posted on: 17 Aug 2021 06:37

Hi,

As marked in the related GitHub issue:

This is not a bug in the Workbook initialization functionality. It is an improper way of initializing the class. The proper way to do so would be:

let dataURL = new kendo.ooxml.Workbook(JSON.parse(JSON.stringify(data))).toDataURL();

Note that the Workbook init would expect a JS object and not a string.

Here is a fully working Dojo sample:

- https://dojo.telerik.com/oQAWIgUS/4

 

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.