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,