?
Solved

export Html Table to Excel sheet asp.net

Posted on 2009-04-20
2
Medium Priority
?
2,082 Views
Last Modified: 2012-08-14
Hi Expert,

I have a label show a report using Html table.

str = "<table>"
        str = str + "<tr>"
        str = str + "<td>ParcelId"
        str = str + "</td>"
        str = str + "</tr>"
        str = str + "<tr>"
        str = str + "<td>43011070008000."
        str = str + "</td>"
        str = str + "</tr>"
        str = str + "</table>"

        lbReport.Text = str

How user click on Export Button, html table can export to excel sheet.


Thanks in advance.
0
Comment
Question by:dshi15
2 Comments
 
LVL 8

Accepted Solution

by:
Faheem Shaikh earned 2000 total points
ID: 24184908
You can use the custom control ExportPanel for this purpose:
http://steveorr.net/articles/ExportPanel.aspx
 
Here is another methos to achieve this:
http://steveorr.net/articles/ExcelExport.aspx
 
0
 
LVL 2

Expert Comment

by:Cognize
ID: 24195538
Hi,

The easiest way I've found is to write XML in a format that excel can read (as below ) and then just save the file with a .xls extension - this xml file will be readable by excel:

Excel does support an xml format - see this article:

http://www.codeproject.com/KB/office/excelxmlspreadsheet.aspx

<Workbook>
    <Styles>
    </Styles>
    <Worksheet ss:Name="Sheet1">
        <Table>
            <Row>
                <Cell>Data</Cell>
                <Cell>Data</Cell>
            </Row>
        </Table> 
        <WorksheetOptions> </WorksheetOptions>
    </Worksheet> 
    <Worksheet ss:Name="Sheet2">
        <Table>
            <Row>
                <Cell>Data</Cell>
                <Cell>Data</Cell>
            </Row>
        </Table> 
    </Worksheet> 
    ......
    ...... 
    ...... 
    ...... 
<Workbook>

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question