Use JSP to print reports in Word and Excel formats-JSP tutorial, JSP/Servlet

Source: Internet
Author: User

Here is a tips to convert it to an editable JSP file and then operate it like other JSP pages.

Because documents in MS Word and Excel support HTML text format, you can use Word or Excel to make a template, save it as a Web page, change the HTML to JSP, and enter the data part dynamically, you do not need to adjust the format.

On the word page, you only need to set the following commands in the JSP header:
<% @ Page contenttype = "application/MSWord; charset = gb2312" %>

Excel is as follows:
<% @ Page contenttype = "application/vnd. MS-Excel; charset = gb2312" %>

In this way, you do not need to use other complex technologies and can achieve good results. The so-called walking shortcut is not provided.

============================================

To xia2500004715:

For your question, I tried it and only encountered the first question you said, and did not see the second case you said. I will answer the following questions separately:

First question:

I think there is a checkbox missing in your figure. Is the security setting too high or the word version too high? My current test environment is word2003, And I have installed wps2009, I tried two cases, that is, the default use of word WPS or MS word open, are the same; check the content is "each open are displayed", remove the box, this will not happen when the user calls it again, because I have removed the box, so there is no way to capture the picture for you now, and it will not pop up again, when I call it, the word interface is displayed.

Second question:

Let's take a look at the interface that appears as follows:

I have printed button Oh, which with red circle is, you can try to change the environment (MS Word version and other factors), maybe your environment problems, I think it is possible that you have blocked some toolbar locally, so it cannot be displayed. Could you try another computer?

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.