Use ASP. NET to compare and question the export solution to word !!!

Source: Internet
Author: User

A few days ago, I am developing a web project, using ASP. NET. Currently, the report module is used to program the output of tables and generate charts using the owc Technology of Microsoft. After reading this semi-finished product, the user puts forward the functional requirements for exporting the report page to word or Excel.

After more than a week of inquiry and discussion, the above requirements put forward the following implementation scheme ideas:

1. Save the entire HTML document as Doc directly by using a Java Script. The only advantage of doing so is simple and easy to use, but the disadvantage is that the saved documents include many additional HTML tags (Head, form, hiden, and so on ), in addition, images and so on are downloaded to the files directory. You also need to reorganize and typeset the downloaded items. It is better to allow users to export tables and charts. This is the second method.

2. Use response. Write to save the HTML tag of the control to be downloaded as Doc or XLS. This method has been solved technically, but the only thing that cannot be implemented is to output one or more charts in a DOC (because the downloaded file is encoded, rather than word, GIF, or other), it can only be saved separately. Separate export is also easy to export to xls, because the image cannot be exported to XLS!

3. Call Microsoft Office Automation to implement precise control. You can use macro recording in word or Excel to help implement encoding, and you can also use template to implement fixed-Format documents. However, after in-depth discussion on the server-side programming technology, it is found that this technology has many problems. In addition, Microsoft does not recommend using this technology on the server, nor does it provide technical support. These problems mainly include: reducing the security level to achieve this technology; prone to deadlocks; requires certain configurations to achieve different degrees of automation, and some configurations are also contradictory; and so on (see Microsoft Knowledge Base Article-257757 info: Notes for automatically running office on the server)

4. Use Microsoft Office Automation on the client. This solution has certain requirements on the client, and also needs to implement interaction between B and C. It has certain technical difficulties and maintenance problems, and also has certain risks;

5. Use office2003 to support the XML file format, construct such a stream on the server side, and then download it to the client. This solution should not be too difficult to implement at present, and text can be included in a document at the same time. However, this solution is troublesome to implement, and the office version used on the client must also be office2003.

6. The current user's clients are Windows 98, Office2000, or office97. To support earlier versions, you must use the RTF format. However, it is difficult to understand the RTF and it is difficult to construct it (the sample must be segmented by size ).

In these 6 schemes, some cannot meet the user's needs well, some may pose great risks in implementation, and some may be complicated in implementation. Do you have any other methods ???

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.