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

toDataURLAsync get error when sheet contain image.

1 Answer 62 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Iron
Vincent asked on 07 Jan 2020, 01:16 AM

I insert a image to the sheet, and transform sheet to datauri format. I get a error message.

function SaveElnFile(e) {
        var spreadSheet = GetSpreadsheet("ElnMain");
        var sheet = spreadSheet.activeSheet();
        spreadSheet.bind("excelExport", function (e) {
            var fileName = "ElnTemplate/" + GetDateTimeString() + ".xlsx";
            e.workbook.fileName = fileName;
            var workbook = new kendo.ooxml.Workbook({
                sheets: e.workbook.sheets
            });

            workbook.toDataURLAsync().then(function (dataURL) {
                xxxxxx....
            });
                e.preventDefault();
        });
        spreadSheet.saveAsExcel();
    }

 

 

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 09 Jan 2020, 01:45 PM

Hi Vincent,

The images definition is part of the Workbook definition(https://docs.telerik.com/kendo-ui/api/javascript/ooxml/workbook/configuration/images). Those images are used in order to properly load the respective drawings of the sheets. Therefore, they are required to be present when having drawings placed somewhere in the Workbook.

From the snippet sent, I can see that you are passing the sheets definition to the kendo.ooxml.Workbook. The Workbook, however, does not contain images definition, which results in the observed error.

Here you could find a small Dojo sample, based on the snippet sent and configuring the exported Workbook with images:

https://dojo.telerik.com/OzobiXOR/3

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
Tags
Spreadsheet
Asked by
Vincent
Top achievements
Rank 1
Iron
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or