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

export 2 datagrids to excel spreadsheet, each datagrid in a separate worksheet

3 Answers 23 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
peter
Top achievements
Rank 1
peter asked on 22 Sep 2012, 09:22 PM
Hi i have two datagrids on a page, and on the click of a button, i would like to export the datagrids to the same excel spreadsheet, however both have to be in seperate worksheets, how can i achieve this. Thanks

3 Answers, 1 is accepted

Sort by
0
peter
Top achievements
Rank 1
answered on 24 Sep 2012, 10:10 AM
Hi does anyone know if this is possible, thanks
0
Ivan Ivanov
Telerik team
answered on 24 Sep 2012, 01:44 PM
Hi,

Yes, it is possible, but not out of the box. First of all, you should use the ExcelML format, as it is the only one that supports separate worksheets. And this is the trick: you should export both of the RadGridViews in separate MemoryStreams, read them as strings and then write the modified content in the FileStream opened for the exporting operation. You should achieve something like that in the end:
<Workbook . . . >
    <Worksheet . . . >
        <Table . . .>
        Grid1 rows
        </Table>
    </Worksheet>
    <Worksheet . . . >
        <Table . . .>
        Grid2 rows
        </Table>
    </Worksheet>
</Workbook>
Please, let us know in case you need any additional assistance on this.

Greetings,
Ivan Ivanov
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
peter
Top achievements
Rank 1
answered on 29 Sep 2012, 02:27 PM
Hi have you got an example of this, i have no idea what to do, thanks
Tags
General Discussions
Asked by
peter
Top achievements
Rank 1
Answers by
peter
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or