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

How to add multiple tables in same Excel Sheet ?????

1 Answer 50 Views
Excel Export
This is a migrated thread and some comments may be shown as answers.
Rohan
Top achievements
Rank 1
Rohan asked on 15 Jun 2020, 03:56 PM
Very Urgent!!!!Pls help

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 17 Jun 2020, 07:58 AM

Hi Rohan,

Let me begin with providing some general information on the Excel Export functionality and then I will provide specific examples of how the requirements can be achieved.

Basically whenever the default Grid Excel Export functionality is used the Grid data is automatically converted to an object of type Workbook. That is the default type of object when creating Excel files manually provided by Microsoft:

https://docs.microsoft.com/en-us/office/vba/api/excel.workbook

One option in order to export two Grids in the same sheet is to construct the desired Workbook manually. Please check the following article from our documentation demonstrating how to create new Workbooks manually:

https://www.telerik.com/kendo-angular-ui/components/excelexport/workbook/new-custom/

Here is an example demonstrating how to export a custom Workbook so that it represents two Grid data sets separated with an empty row:

https://stackblitz.com/edit/angular-l6jymc-ahvbyd?file=app/app.component.ts

Another option would be to use the Grid built-in feature to construct the two separate Workbooks for the two Grids and then combine them. Please check the following example demonstrating such approach:

https://stackblitz.com/edit/angular-equv6d-ffwrhx?file=app/app.component.ts

The essential parts in this example are that the (excelExport) event of the first Grid is prevented. Then the generated Workbook data is saved and then (excelExport) event of the second Grid is fired by calling the second Grid saveAsExcel() method. Finally in the (excelExport) event handler function of the second Grid the automatically generated Workbooks for both Grids are combined.

I hope the provided information helps you to move forward with this case.

Regards,
Svetlin
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.
Tags
Excel Export
Asked by
Rohan
Top achievements
Rank 1
Answers by
Svet
Telerik team
Share this question
or