Export the application form and other documents in the Web Application System of Asp.net

Source: Internet
Author: User

InAsp.netOfWebExport application form and other documents in the Application System

 

In the actual management system, you often need to export the application form, which is available before the system is put into use. This is traditionalDocDocumentation. Generally, the demand side will provide such documents to the development team and how to export the information to such a standardDocWhat about the document?

Follow these steps:

 

1. use word open doc Save the document as" filtered web pages ", the purpose is to obtain the HTML Code .

2.Use NotePad to open thisHtmlPage, and copy the code in it.

3. Do this in the system Aspx Page, and Html . At this time Visual Studio What we see in the design view is the same as the original Doc The document is basically the same.

4. set label , page_load .

5. also in page_load medium, add response converts the returned information stream to a download information.

Response. Clear ();

Response. Buffer =True;

Response. charset ="Gb2312";

Response. appendheader ("Content-disposition","Attachment?filename=filename.doc");

Response. contentencoding = system. Text.Encoding. Getencoding ("Gb2312");//Set the output stream to simplified Chinese

response. contenttype = "application/MS-word" ; // set the output file type to word .

6.In this way, a download box is displayed, that is, a data application form. Now, the basic export is complete. However, the page displays unfriendly information such as the following.


7.To solve the preceding problem, you can change the export trigger event. Simply put, you can set an export button on another page, which redirects to the top page. In this way, only the download box is displayed, and the unfriendly information above is not displayed.

Protected VoidButton#click (ObjectSender,EventargsE)

{

Response. Redirect ("Download. aspx");

}

 

8. One problem is that the saved file is actually Html File, but the suffix is Doc . Use Offic2007 After it is opened and saved, a folder next to the file will be added, as if it were a webpage. If you use Office2003 This is not the case. This disadvantage,

Related Article

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.