In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to use PageOffice for full-text retrieval of Word documents, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
First, background introduction
Word documents are closely related to daily office work. In practical applications, when there are many Word documents in a document server, if there are thousands of documents, it becomes very difficult for users to find and open documents containing some specified keywords. At present, the solution that can be found on the network is to use server-side Apache POI technology to obtain the text of all documents and store them in the database. Then when the document is opened, the SQL statement is used to retrieve whether the document contains keywords to determine whether the document is open. However, this solution has great disadvantages. First of all, POI technology does not support word documents very well, in which the interface that supports word is single and unstable, and the format of word documents is also highly required. Second, if thousands of documents are stored in the database using poi, this operation will greatly affect the performance of the server.
PageOffice provides the function of obtaining the full-text plain text of Word documents, which can save the acquired text content to the database, and use the database sql statement to retrieve whether the document contains keywords to achieve this requirement. The work of PageOffice to get plain text of documents is performed by the client, which greatly reduces the pressure on the server and improves the performance of the server.
Second, the main implementation code
Get the plain text file in the Word document (without any additional format) and save it to the database, then you can easily use SQL query to realize the full-text retrieval function in document management.
Java Code:
FileSaver fs = new FileSaver (request, response); String strDocumentText = fs.getDocumentText (); / / you can save this text string to the database field. The code saved to the database omits fs.saveToFile (request.getRealPath ("doc/") + "/" + fs.getFileName ()); fs.Close ()
ASP.NET Code:
PageOffice.FileSaver fs = new PageOffice.FileSaver (); string strDocumentText = fs.DocumentText; / / you can save this text string to the database field. The code saved to the database omits fs.SaveToFile (Server.MapPath ("doc/") + fs.FileName); fs.Close ()
Note: this property currently applies only to Word.
Third, the example shows
Please refer to the comprehensive demonstration of the Samples4 example in the PageOffice development package:
Full-text search for Word documents containing keywords (Professional Edition, Enterprise Edition)
Gets the plain text in the document to be saved to the database and retrieves whether the keyword is included in the document based on the keyword.
Description of the storage structure of the documents in the database (take the access database as an example).
Search for documents that contain keywords to display the document name in a list.
The main highlighted js code:
Var sMac = "function myfunc ()" > after reading the above, have you mastered how to use PageOffice for full-text retrieval of Word documents? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.