Repeater export in Excel format

Source: Internet
Author: User
Repeater exports data in Excel format to repeater1. The following is an example of how to export repeater1 content. Code System. Io. stringwriter SW =   New System. Io. stringwriter ();
System. Web. UI. htmltextwriter HW =   New System. Web. UI. htmltextwriter (SW );
This . Repeater1.rendercontrol (HW );

response. clear ();
response. contenttype = " application/vnd. MS-Excel " ;< br> response. charset = " " ;
page. enableviewstate = false ;

Response. appendheader ( " Content-Disposition " , " Attachment?filename=teacher.xls " );
Response. Write ( " <HTML> " Text / HTML; charset = Gb2312 \ " > <Title> copyright by SDU </title> " );
Response. Write (SW. tostring ());
Response. Write ( " </Center> </body> " );
Response. End ();

Note: When a numeric string of the simplified type is exported to excel, it is often changed to scientific notation. The solution is to bind it to repeater1:<TD Style="Vnd. ms-excel.numberformat :@"> <%# Databinder. eval (container. dataitem,"Shenfenzheng")%> </TD>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.