Issue in workbookOptions() method

1 Answer 146 Views
Excel Export
Procurement
Top achievements
Rank 1
Procurement asked on 22 Jun 2022, 08:02 AM | edited on 22 Jun 2022, 08:05 AM
Hi Team,

We are using the kendoreact library in our react code. There is an issue while using workbookOptions(). 
It fails to recognize date format in dd.mm.yyyy format. Its working fine with dd/mm/yyyy and dd-mm-yyyy format. 
So we end up with excel sheets without data.
Are you ( kendo team) aware of this issue. If so, what is the fix for this?

Regards,

Pratap

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 24 Jun 2022, 06:31 AM

Hi Pratap,

I have tested the following simple example by adding a Date value to one of the cells with "dd.mm.yyyy" format, but it exports correctly:

Could you please share an example demonstrating the issue, so we can test and debug it locally?

Looking forward to your reply.

 

Regards,
Konstantin Dikov
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/.

Procurement
Top achievements
Rank 1
commented on 01 Jul 2022, 02:30 PM

Hi Konstantin,

                      Given the Input Sheet which is 'sheets' in the first line which is attached and the following piece of code.

const workbooks = sheets.map(sheet => this[sheet.ref].workbookOptions());
    workbooks.forEach(book => {
      const rows = book.sheets[0].rows;
      rows.forEach(row => {
        if (row.type === "group-header") {
          row.cells.forEach(cell => {
            var element = document.createElement("textarea");
            element.innerHTML = cell.value;
            cell.value = element.value;
          });
        }
      });
    });
    workbooks[0].sheets = workbooks.reduce((acc, x, i) => {
      x.sheets[0].name = sheets[i].title;
      return [...acc, ...x.sheets];
    }, []);
    this[sheets[0].ref].save(workbooks[0]);
    console.log("workbook", workbooks);

  };

 

We get all data as empty. Not sure what is the issue here. Can u help us with this?

 

Konstantin Dikov
Telerik team
commented on 05 Jul 2022, 09:10 AM

Hi,

The problem that you are facing is due to the fact that the date format with the dots is actually used as field name and the dot is special character in regards of column fields for accessing nested properties (Category.CategoryName for example). What I could suggest is to replace the dots with different symbol while the workbook is created and then replace them back to dots in the generated header cells. 

Please let me know if the issue persists after applying the suggested changes.

 

Tags
Excel Export
Asked by
Procurement
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or