I believe that everyone has had the experience of operating word documents and tables, for each row of data recording and operation is more convenient. But this is not enough. For some OA projects, you need to open word documents online and add data to word tables through background settings, or even add new rows to tables. This requires the ability of developers to integrate activex controls into the Java environment. For most Java development engineers, it is too expensive to master activex controls just to meet the needs of their own projects.
So today we will introduce a middleware technology - page office. This middleware technology has integrated most of the functions of operating office documents in the web system. We only need to pay attention to the business logic of our web system. The learning cost is low and the functions are rich. Now let's use page office to realize the function of adding new rows and assigning values to word tables while opening word documents online in Java language.
First look at the effect:
This is the original document
Following is the document opened by the page office background settings
You can see that the document table has been increased from three to five rows, and the corresponding data has been added to the corresponding cells through the background.
Deployment steps (only 4 steps)
1. official website http://www.zhuozhengsoft.com/dowm/ Download integration files, introduce jar packages, configure web.xml
Go to the integration file you just downloaded, find lib, put the contents in the Lib of the project web-inf, introduce the jar package, and then introduce the page office configuration of web.xml into the wb.xml of your project.
2. Place a label or button on the parent page aaa.jsp (page that needs to open the document)
Introduce the js file required by pageoffice before writing a tag
Then add a tag
3. Create a file named WordTable.jsp in the parent page's sibling directory
4. New Documents
Create a new word file named test.doc (if you create a new docx file, change the third step of poCtrl.webOpen ("test.doc", "OpenModeType.docNormalEdit", "Zhang Fan Name"); change the code to poCtrl.webOpen ("test.docx", "OpenModeType.Normal Edit"); and change the code to poCtrl.webOpen ("test.docx", "OpenModeType.Normal Edit").
Place the newly created test.doc file in the WordTable.jsp peer directory.
Open the test.doc file locally, create a table with three rows and five columns, and then click the full selection flag in the upper left corner of the table to select the entire table.
With the entire table selected, click on the menu bar to insert - Bookmark - Book signature set to PO_T001 - click Add.
Then start the project to visit aaa.jsp directly and click on the link. At this time, you will be prompted to install the plug-in. After successful installation, you will be prompted to register, fill in the relevant information, and fill in the registration code Q37LN-W8NI-KFSQ-LEY3Y to open the document.
Note: If you need more functions, you can download the sample code from the page Office website and throw the samples4 folder directly into Tomcat's webapps. Start Tomcat. The browser accesses http://localhost:8080/Samples4/index.html. Look at the following link in the sample and see the code in the WordTable folder under the samples4 folder directly.
If you are new to page office, you can also watch videos and get started quickly. http://www.zhuozhengsoft.com/Technical/