Webpage comment implementation method and device for Word document, equipment and storage medium
By converting Word documents to HTML format and building comment lists and connections, the problems of missing annotation information and unclear connections are solved, and efficient document review and analysis are achieved.
Patent Information
- Application Number
- CN202510775543.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-23
AI Technical Summary
The existing online Word document annotation function cannot be flexibly adjusted in fields such as finance, medical care, and home-based elderly care, resulting in the loss of annotation information and unclear connections, affecting the efficiency and quality of review.
The Word document is converted into HTML format through document conversion technology, the annotation objects and their comment information are extracted, a comment list is constructed, and the comment information and connections are displayed on the web page, and the annotation content is organized using a preset comment layout.
Ensuring that annotation information is completely and accurately mapped to HTML data improves the efficiency of review work, allowing users to clearly and accurately view the corresponding positions of annotations and original text, and quickly locate relevant parts.
Smart Images

Figure CN120688457A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for implementing web page annotation of a Word document. Background Art
[0002] In today's digital office and information processing fields, collaborative document editing, review, and annotation functions are indispensable and important links in various business processes. Especially in scenarios such as home-based elderly care, health care, and financial-related contract and report review, there is an urgent need for efficient, convenient, and accurate Word document review solutions.
[0003] With the development of information technology, online review of Word documents has gradually become a trend, but existing online solutions still have many limitations. For example, while the common WPS plug-in on the market has certain online editing and annotation functions, it is difficult to flexibly adjust and optimize it to meet the specific needs of different industries (such as the annotation of elderly health data in home-based elderly care programs, the annotation of medical record details in the health and medical field, and the annotation of contract clause risks in the financial field). In addition, some third-party libraries for document conversion, such as Mammoth, will lose annotation content and incomplete styles when converting Word to HTML format, resulting in the inaccurate presentation of annotation information, affecting users' comprehensive understanding and grasp of the document annotation content. Moreover, when processing line operations, line drawing tools such as jsplumb lack the control precision of the intermediate nodes of the connection, making the connection between the original text and the annotation unclear and inaccurate, causing trouble for users when viewing the corresponding relationship between the annotation and the original text, reducing the efficiency and quality of the review work.
[0004] In the financial sector, financial institutions, when processing large volumes of documents such as contracts, risk assessment reports, and financial statements, need to accurately annotate and review key clauses and data. Inadequate annotation functionality, such as the inability to accurately extract annotation information, poorly organized comment lists, and unclear connections, can easily lead to reviewers missing important information, potentially leading to potential financial risks.
[0005] Therefore, how to improve the efficiency of Word document review business has become a technical problem that needs to be solved urgently. Summary of the Invention
[0006] The present invention provides a method, device, equipment and medium for implementing web page annotation of Word documents, so as to solve the technical problem that the online annotation function of the prior art is imperfect, resulting in low efficiency of online review of Word documents.
[0007] In a first aspect, a method for implementing web page annotation in a Word document is provided, comprising:
[0008] Based on the document conversion technology, the document content of the target document is converted into the Hypertext Markup Language HTML format to obtain HTML data;
[0009] Extracting annotation objects and comment information of each annotation object from the HTML data based on the annotation tags, and constructing a comment list;
[0010] Loading the HTML data into a web page display page to display the original document and at least one annotation object in the original document;
[0011] Based on a preset comment layout, displaying each comment information in the comment list on the web page display page;
[0012] Based on the corresponding relationship between each comment information and each annotation object in the original document, a connection line is constructed between each comment information and each annotation object in the original document to realize the web page annotation display of the Word document.
[0013] In a second aspect, a device for implementing web page annotation of a Word document is provided, comprising:
[0014] The document conversion module is used to convert the document content of the target document into a hypertext markup language HTML format based on the document conversion technology to obtain HTML data;
[0015] A comment information extraction module is used to extract the comment objects and the comment information of each of the comment objects in the HTML data based on the comment tags, and construct a comment list;
[0016] A web page display module, configured to load HTML data into a web page display page, and display an original document and at least one annotation object in the original document;
[0017] A comment display module, configured to display the comment information in the comment list on the web page display page based on a preset comment layout mode;
[0018] The connection operation module is used to construct a connection between each comment information and each annotation object in the original document based on the corresponding relationship between each comment information and each annotation object in the original document, so as to realize the web page annotation display of the Word document.
[0019] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for implementing web page annotations for Word documents are implemented.
[0020] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the web page annotation implementation method of the above-mentioned Word document are implemented.
[0021] In the solution implemented by the web page annotation implementation method, device, computer equipment and storage medium of the above-mentioned Word document, the target document content is converted into HTML format through document conversion technology, and the annotation object and its comment information are extracted based on the annotation tag, which can effectively avoid the problem of loss of annotation content and ensure that the annotation information can be completely and accurately converted from the Word document and mapped to HTML data. The various comment information in the comment list is displayed on the web page display page through a preset comment layout method, which can reasonably organize and present the annotation content, making it easier for users to browse and view the annotation information, thereby efficiently reviewing and analyzing the document. According to the corresponding relationship between each comment information and each annotation object in the original document, a connection is constructed, so that when the user views the annotation, he can clearly and accurately see the corresponding position of the annotation and the original text, thereby quickly locating the relevant part in the original text and improving the efficiency of the review work. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0023] Figure 1 This is a schematic diagram of an application environment of a method for implementing web page annotation of a Word document in one embodiment of the present invention;
[0024] Figure 2 A flowchart of a first embodiment of a method for implementing web page annotations in a Word document provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram showing the effects of displaying annotations in Word documents and web page annotations provided by an embodiment of the present invention;
[0026] Figure 4 This is a structural diagram of a device for implementing web page annotation for Word documents in one embodiment of the present invention;
[0027] Figure 5 is a structural diagram of a computer device in one embodiment of the present invention;
[0028] Figure 6 FIG. 2 is another structural diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0030] The method for implementing web page annotation of Word document provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In an application environment, the client communicates with the server through a network. After receiving the document to be processed uploaded by the client, the server can convert the document content of the target document into a hypertext markup language HTML format based on document conversion technology to obtain HTML data; based on the annotation tag, extract the annotation objects and the comment information of each annotation object in the HTML data to construct a comment list; load the HTML data into a web page display page to display the original document and at least one annotation object in the original document; based on a preset comment layout method, display each comment information in the comment list on the web page display page; based on the corresponding relationship between each comment information and each annotation object in the original document, construct a connection between each comment information and each annotation object in the original document to realize the web page annotation display of the Word document.
[0031] In the present invention, in view of the fact that the online annotation function in the financial and medical fields is not perfect, which leads to the low efficiency of online review of Word documents, the target document content can be converted into HTML format through document conversion technology, and the annotation object and its comment information can be extracted based on the annotation tag, which can effectively avoid the problem of loss of annotation content and ensure that the annotation information can be completely and accurately converted from the Word document and mapped to HTML data. By displaying each comment information in the comment list on the web page display page through a preset comment layout method, the annotation content can be reasonably organized and presented, making it easier for users to browse and view the annotation information, thereby efficiently reviewing and analyzing the document. According to the corresponding relationship between each comment information and each annotation object in the original document, a connection line is constructed, so that when the user views the annotation, he can clearly and accurately see the corresponding position of the annotation and the original text, thereby quickly locating the relevant part in the original text and improving the efficiency of the review work.
[0032] The client can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0033] The present invention is described in detail below through specific examples.
[0034] See also Figure 2 As shown, Figure 2 The flowchart of the first embodiment of the method for implementing web page annotation of a Word document provided by the embodiment of the present invention includes the following steps:
[0035] S101: Based on the document conversion technology, the document content of the target document is converted into a Hypertext Markup Language HTML format to obtain HTML data;
[0036] In one embodiment, the target document may be a Word document, or other document files that can be edited, annotated, and commented on, such as documents in PDF, text document (TXT) and other formats.
[0037] In one embodiment, the target document may be obtained from a local file web application, a network server, a database, or another document management web application. Depending on the data source, different acquisition methods may be used to obtain the target document. For example, if the target document is obtained from a local file web application, a file read operation may be used; if the target document is obtained from the network, an HTTP request or other method may be used to download the document; and if the target document is obtained from a database, a corresponding database query operation may be performed to extract the document data.
[0038] For example, for a Word document that needs to be annotated, the document can be obtained by uploading a file, downloading it from the network, or reading it locally. For example, in a document management web application, a user can select a local Word file and upload it to the server; or in an online collaborative office platform, a user can directly open a Word document stored in the cloud.
[0039] For example, on the home-based elderly care service platform, caregivers need to write health assessment reports, life care records and other documents for the elderly. These documents can be written in Word format and include descriptions of the elderly's physical condition, care suggestions, service records and other content. After completing the writing of a health assessment report for the elderly, caregivers will upload the Word document to the home-based elderly care service platform.
[0040] For example, the medical record management web application within a medical institution needs to process a large number of medical record documents, which are often stored in Word or other formats. After completing a patient's electronic medical record, the doctor submits it in the form of a Word document to the hospital's medical record management web application.
[0041] Similarly, financial institutions (such as banks, securities firms, and insurance companies) process large volumes of documents daily, including financial contracts, risk assessment reports, and financial statements. These documents are typically stored in Word or PDF format and need to be integrated with various business web applications (such as credit approval web applications and investment analysis web applications) for automated processing and online review.
[0042] In one embodiment, document conversion technology refers to a technology and method for converting one document format (such as Word, PDF, text, etc.) into another document format (such as HTML, text, other office software formats, etc.).
[0043] Among them, HyperText Markup Language (HTML) is a standard markup language used to create web pages and other content that can be displayed in a browser. It uses a series of tags (such as Indicates paragraphs, Indicates pictures,
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057] Figure 3 Figure 3 Figure 3
[0058]
[0059]
[0060]
[0061]
[0062]
[0063] Figure 3
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100] Figure 4
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128] Figure 5
[0129] Figure 6
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145] To define the structure and content of a web page, a tool or library is used to convert the target document into HTML format (to represent a table, etc.). In one embodiment, according to the format of the target document and the technology stack of the project, a suitable document conversion tool or library is selected, the acquired target document is loaded into the document conversion tool or library, and the document content of the target document is converted into HTML format to obtain HTML data. For example, according to the actual technology stack and needs, a tool or library that can accurately convert a Word document into HTML format is selected. Common ones include Python's python-docx library with the mammoth.py library, or JavaScript's docx4js, etc. During the conversion process, attention should be paid to retaining the format information of the original text, such as font, font size, color, paragraph format, list, etc., so that the display effect of the Word document can be restored as much as possible on the web page. S102: Based on the annotation tag, the annotation objects in the HTML data and the comment information of each annotation object are extracted to construct a comment list; in one embodiment, when performing document conversion, annotation identification rules can be defined to determine the specific tags or formats used to identify the annotation content in the converted HTML data. For example, custom comment tags such as "[comment_start_x]" and "[comment_end_x]" can be used to mark the start and end positions of the comment content respectively, where "x" represents the unique identifier of the comment. Furthermore, based on the comment tag, at least one of the comment objects in the HTML data is identified; the comment information of each comment object is extracted and a comment list is constructed; wherein the comment information includes the comment content, comment author information, creation time and the location information of the comment object in the original document. In one embodiment, after obtaining the HTML data, code can be written to parse the converted HTML data to find the comment objects that meet the comment tags. Regular expressions or HTML parsing libraries (such as BeautifulSoup, jsoup, etc.) can be used to locate the content between the "[comment_start_x]" and "[comment_end_x]" tag pairs and extract them as comment objects. Wherein, the comment object refers to the commented document content with the comment tag in the original document of the target document. The comment content refers to the specific comment text content for each annotation object. In one embodiment, the extracted comment objects can be marked and their position information in the original text (such as the paragraph, line number, starting and ending character positions, etc.) can be recorded. If the HTML data contains a special comment list part (such as in a specific tag or comment), it is necessary to parse the structure of this part and extract the comment information therein. For example, for a structure in the format of "[comment_list]...[ / comment_list]", the "[comment_list_item]" tag is searched therein to obtain the comment information of each comment object.For example, in HTML data, author is the author's name, content is the annotation content, rect is the position and size of the selected content in the original text, top is the value from the top, and left is the value from the left. Based on the extracted comment information, a comment data structure is constructed, which usually contains the comment's id, author, creation date, content, and associated position with the original text (such as the corresponding paragraph id or element) and other attributes. These data are stored in an array or object collection to facilitate subsequent management and operation. Based on the extracted comment information, a comment data structure is constructed, which usually contains the comment's id, comment author information, creation time, comment content, and the position information of the annotation object in the original document (such as the corresponding paragraph id or element) and other attributes. Exemplarily, the comment information corresponding to a certain annotation object can be stored in a data structure, such as an array or object. The comment information of at least one annotation object is stored in a list to construct a comment list. S103: Loading the HTML data into a webpage display page, displaying the original document and at least one annotation object within the original document. In one embodiment, within a webpage application, the converted HTML data is loaded onto the webpage display page for rendering and display, allowing the user to view document content similar to the original Word document. As shown, a is a schematic diagram of the annotation display of a Word document. The original document content is displayed on the main page, and the comment information corresponding to the annotation object ("Content" in the figure) is displayed in the right display column. Similarly, as shown in b, two display columns can also be provided on the webpage display page: the left display column is used to display the original document of the target document, and the right display column is used to display the annotation corresponding to the annotation object, namely, comment information such as the comment ID, comment author information, creation time, and comment content. In one embodiment, before loading the HTML data onto the webpage display page, the process further includes: replacing the annotation identifier of each annotation object in the HTML data based on a preset display tag, so that each annotation object is displayed on the webpage display page in the display format corresponding to the preset display tag. Among them, the preset display tag refers to the HTML tag and its corresponding CSS style class that are pre-defined in web page development for presenting a specific content style. These tags and style classes specify the display format of the content on the web page, including font, color, background color, margin, alignment, etc. In this embodiment, the preset display tag can be an attribute tag that makes the annotation object stand out in the original document, such as a highlight tag, a bold tag, an italic tag, etc. In one embodiment, the style and format that the annotation needs to be presented on the web page is determined based on the business scenario and user needs. For example, the annotation object can be set to be displayed in the form of highlighted text, special borders, different colors or font styles, etc., so as to distinguish it from non-annotation text, and the annotation object can also be highlighted. For example, taking the highlight tag as an example, the annotation identifier of each annotation object in the annotation object is replaced with a highlight tag.Specifically, by searching for the tag pair "[comment_start_x]" and "[comment_end_x]" in HTML, replace them with span tags with specific styles, such as adding the "highlight" class. Through CSS style settings, when the document content of the target document is displayed on the web page display page, the annotation object in the original document is displayed in a highlighted manner. As shown in b, the "content" of the annotation object is displayed in a highlighted manner, making the annotation object more eye-catching in the original document so that the user can intuitively identify the location of the annotation. S104: Based on the preset comment layout method, each comment information in the comment list is displayed on the web page display page; in one embodiment, the comment layout method of absolute position layout can be adopted, so that each comment information in the comment list can be accurately displayed on the web page display page according to the specified position and order. Furthermore, the position information of the annotation object corresponding to each comment information in the original document is obtained; based on the position information of each annotation object, each comment information is sorted to determine the arrangement order of each comment information; based on the arrangement order of each comment information, each comment information in the comment list is displayed in the web page display page. In one embodiment, the position information of the annotation object may include the vertical position and horizontal position of the annotation object in the original document. In one embodiment, for the annotation objects that are highlighted in the original document displayed on the web page display page, the position and size information of the span tag element corresponding to each annotation is obtained through front-end technologies such as JavaScript, such as the distance from the top and left side of the page (rect.top and rect.left). Among them, rect.top and rect.left are attributes used to describe the position of the element. rect.top represents the vertical position of the element in the page, that is, the distance of the element from the top of the page; rect.left represents the horizontal position of the element in the page, that is, the distance of the element from the left side of the page. Furthermore, based on the vertical position of each annotation object in the original document, the comment information is sorted to determine the initial arrangement order of each comment information; when there are multiple annotation objects with the same vertical position, the comment information is sorted based on the horizontal position of each annotation object to determine the final arrangement order of each comment information. The obtained position information is updated to the comment information corresponding to each annotation object in the comment list as the rect attribute of the comment information. Then, in the comment list, the comment information is sorted according to the rect attributes (rect.top and rect.left attributes) of each comment information.First, the comments are sorted from smallest to largest by top value to obtain the initial sorting order. If, after the initial sorting order is determined, multiple comments with the same top value exist, the comments corresponding to the same top value are re-sorted, sorted from smallest to largest by left value, to obtain the final sorting order. When sorting and displaying comments, the comments corresponding to each annotation object are treated as independent comment items. Each comment item is the display result of the comment information corresponding to each annotation object on the web page. Comment items can be text box-style data display structures. Specifically, the comment items are sorted by comparing the rect.top and rect.left properties of each comment. The rect.top value is prioritized for comparison, with the comment item with the smaller rect.top value placed first. If the rect.top values are the same, the rect.left values are compared, with the comment item with the smaller rect.left value placed first. When displaying the comment list on the web page, absolute positioning is used to arrange the comments from top to bottom according to the sorted order and position information. When there are multiple annotation objects in a line of text in the original document, the comment items corresponding to each annotation object are laid out relative to the comment items corresponding to the previous annotation object. The starting left value of the current annotation is calculated based on the left value and width of the previous annotation, ensuring that the annotations are closely arranged and do not overlap, making the display of the comment items more neat and orderly, and improving the readability of the page. A certain amount of spacing can be reserved between adjacent comment items to improve visual clarity and aesthetics. S105: Based on the correspondence between each comment information and each annotation object in the original document, a connection line is constructed between each comment information and each annotation object in the original document to realize the web page annotation display of the Word document. It can be understood that to realize the web page annotation display of the Word document, a connection line between the comment information and the original annotation object can be constructed on the web page display page based on the correspondence between the comment information and the original annotation object. Visual connections can be created based on the position of the annotation object in the original document to associate the comments and annotations, thereby helping users quickly understand the connection between the annotation content and the original text. Furthermore, a temporary node is constructed based on the position information of the annotation object in the original document; and a connection is constructed between the comment information and the corresponding annotation object based on the connection algorithm and the temporary node. In one embodiment, a temporary node is created between the annotation object in the original document and its corresponding comment item to assist in the connection operation. Since rect.top represents the vertical position of the annotation content in the original text, the top position of the temporary node can be set to be the same as the rect.top value corresponding to the annotation object. Aligning the top value of the temporary node with the annotation object can provide an accurate reference point for subsequent connection operations, ensuring that the connection can start from the position of the annotation object in the original document and accurately connect to the corresponding comment information.Wherein, temporary node can be an invisible HTML element that plays an auxiliary role in line operation, is used for helping to determine the starting point and the path of line, guarantees that line can be connected to corresponding comment from the annotation position of original text accurately.After temporary node is created, can use line tool library (as jsplumb) or self-defined line algorithm, carry out line to temporary node from the highlight content position (being the annotation object in original text document) of annotation in original text.In a specific embodiment, when using line tool library, first need to initialize line tool library, and set the style (as color, line width, line type etc.) of line, to meet the design requirement of user interface.Then, by specifying the highlight content position (can obtain the coordinate information of highlight content element) of annotation object in original text document and the coordinate information of temporary node, call the line method of line tool library to create line. In another specific embodiment, if a custom connection algorithm is used, two point coordinates can be selected based on the position information of the annotation object and the coordinate information of the temporary node, such as the coordinates of the head of the annotation object and the coordinates of the head of the temporary node, and the path of the connection between the two point coordinates can be calculated, and the connection can be drawn using technologies such as HTML5Canvas or SVG. When drawing the connection, different connection styles and effects can be achieved according to needs, such as straight lines, curves, dotted lines, etc. Before the connection operation, check whether the current annotation object already has a connection with other comment information or temporary nodes. This can be achieved by setting a unique identifier for the connection or recording the starting point and end point information of the connection. If the current annotation object has been connected, skip the repeated connection operation to avoid unnecessary connections on the page and maintain the neatness and performance of the page. After completing the connection between the original text and the temporary node, the temporary node needs to be connected to the corresponding comment information. Similarly, a connection tool library or a custom connection algorithm can be used to implement this connection operation. By obtaining the coordinate information of the temporary node and the comment item (the data display structure of the comment information), a connection is created and added to the web page display page. Connect the temporary node to the corresponding comment item to complete the accurate connection between the annotation object in the original document and the corresponding comment item. In this way, the path and style of the connection can be effectively controlled. Since the position of the temporary node is closely related to the annotation object, connecting the temporary node to the comment item can ensure that the starting point of the connection accurately corresponds to the annotation object, avoiding the situation where the connection is crossed or confused, so that the user can clearly see the correspondence between the comment information and the annotation object in the original document, and quickly understand the specific annotation object to which the comment information is directed. Furthermore, based on the annotation operation instruction, the annotation operation corresponding to the annotation operation instruction is performed on the target annotation object; after the annotation operation is completed, the comment information of the target annotation object is collected; based on the annotation operation and the comment information of the target annotation object, the comment list is updated so that the comment list maintains data consistency with the original document.Provide users with annotation operation functions on the web page, including adding, modifying and deleting operations. In one embodiment, the user can provide the function of adding annotations when viewing a document. The user can select the original document content to be annotated as the annotation object by clicking on the text area, and enter the annotation text as the comment content. The annotation object (that is, the original document content selected by the user to add annotations) is highlighted or otherwise highlighted in the original document; at the same time, the web application automatically collects the comment information of the newly added annotation, adds it to the comment list, and updates the corresponding annotation display order and connection. In one embodiment, the user can also be allowed to modify existing annotations, including editing the comment content, updating the position of the annotation object or comment item, etc. After the user completes the modification, the web application updates the comment list and the highlight in the original document, as well as the related connection relationship in real time. In one embodiment, a comment deletion function can be provided, allowing users to delete unnecessary comments. After selecting a comment, the web application automatically deletes the corresponding comment from the comment list, adjusts the order and layout of other comments, and removes the highlighted markup and corresponding connecting lines in the original text to ensure accurate page display. In a specific embodiment, the specific operations for adding and deleting comments can include obtaining the position and size information of the span tag element (the tag used to highlight the annotation object, facilitating positioning and manipulation of the annotation). Then, based on this information, the rect value of the corresponding comment information is updated (rect contains left and top attributes, indicating the horizontal and vertical position of the annotation object in the original text, respectively). Next, the comments are sorted according to the left and top attributes of the rect. When sorting, the top value is compared first, with the comment with the smaller top value placed first. If the top values are the same, the left value is compared, with the comment with the smaller left value placed first. This method ensures a more reasonable display order for the comments, making it easier for users to quickly find key comments. For example, in the web page display page of the health assessment report, the comment list can be defined as a list layout, and each comment item displays information such as the comment content, the commenter (such as the name of the caregiver, the name of the family member, etc.), and the comment time. When the caregiver adds a comment to the report, the web application automatically generates the corresponding comment information and adds it to the comment list in chronological order. When viewing the report, family members and managers can quickly browse the comment list to understand the opinions and suggestions of all parties on the report, and communicate and coordinate nursing work in a timely manner. In the web page display page of the medical record document, a card-style layout can be used to display the comment list, and each comment card contains information such as the comment content, the name of the commenter, the department to which it belongs, and the comment time. When the doctor adds a comment to the medical record, the comment information will be added to the comment list in the form of a card, and can be sorted and filtered according to the commenter's department or the comment time.When reviewing medical records, other medical personnel can easily view the comment list to understand the treatment recommendations and diagnostic thinking of doctors from different departments, promoting multidisciplinary collaboration and improving medical quality. On the contract document webpage display page of the credit approval web application, the comment list can be set to a waterfall layout, automatically adjusting the order of comment items based on their importance and urgency. Each comment item displays information such as the comment content, the commenter's position, department, and the time of the comment. When a credit approver adds a comment to a contract, the comment information is added to the comment list according to the predefined rules. When reviewing a contract, other relevant personnel can clearly see the various comments and follow the prompts in the comment list to conduct focused review and decision-making, thereby improving credit approval efficiency and risk control capabilities. In one embodiment, after the user completes the annotation operation, the annotation data (including added, modified, and deleted annotations) is stored in the browser's local storage (such as localStorage) so that the user can restore the previous annotation status the next time they access the same document. To ensure data security and consistency across multiple devices, the annotation data can be synchronized to the server-side database periodically or in real time. During the synchronization process, attention should be paid to data transmission security and version control to prevent data loss or conflicts. It can be seen that in the above scheme, the target document content is converted into HTML format through document conversion technology, and the annotation objects and their comment information are extracted based on the annotation tags. This can effectively avoid the problem of annotation content loss and ensure that the annotation information can be completely and accurately converted and mapped from the Word document to the HTML data. The comments in the comment list are displayed on the web page using a preset comment layout, which can reasonably organize and present the annotation content, making it easier for users to browse and view the annotation information, thereby efficiently reviewing and analyzing the document. Connections are constructed based on the corresponding relationship between each comment information and each annotation object in the original document, so that when viewing the annotation, the user can clearly and accurately see the corresponding position of the annotation and the original text, thereby quickly locating the relevant part in the original text and improving the efficiency of the review work. It should be understood that the size of the sequence number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. In one embodiment, a device for implementing web page annotation for Word documents is provided. This device corresponds to the method for implementing web page annotation for Word documents in the above-mentioned embodiment. As shown, the device for implementing web page annotation for Word documents includes: a document conversion module 201, a comment information extraction module 202, a web page display module 203, a comment display module 204, and a connection operation module 205.Each functional module is described in detail as follows: a document conversion module 201 is used to convert the document content of the target document into a hypertext markup language HTML format based on document conversion technology to obtain HTML data; a comment information extraction module 202 is used to extract the annotation objects and the comment information of each annotation object in the HTML data based on the annotation tag, and construct a comment list; a web page display module 203 is used to load the HTML data into a web page display page to display the original document and at least one annotation object in the original document; a comment display module 204 is used to display each comment information in the comment list on the web page display page based on a preset comment layout method; a connection operation module 205 is used to construct a connection between each comment information and each annotation object in the original document based on the correspondence between each comment information and each annotation object in the original document, so as to realize the web page annotation display of the Word document. In one embodiment, the comment information extraction module 202 includes: an annotation object identification unit for identifying at least one annotation object in the HTML data based on the annotation tag; a comment information extraction unit for extracting comment information for each annotation object and constructing a comment list; wherein the comment information includes comment content, comment author information, creation time, and location information of the annotation object in the original document. In one embodiment, the apparatus for implementing web page annotation for Word documents further includes: an annotation identifier replacement unit for replacing the annotation identifier of each annotation object in the HTML data based on a preset display tag, so that each annotation object is displayed on the web page display page in the display format corresponding to the preset display tag. In one embodiment, the comment display module 204 includes: a location information acquisition unit for acquiring location information of the annotation object corresponding to each comment information in the original document; an arrangement order determination unit for sorting each comment information based on the location information of each annotation object and determining an arrangement order for each comment information; and a comment display unit for displaying each comment information in the comment list on the web page display page based on the arrangement order of each comment information. In one embodiment, the position information of the annotation object includes the vertical position and horizontal position of the annotation object in the original document; the arrangement order determination unit includes: a vertical arrangement subunit, which is used to sort the comment information based on the vertical position of each annotation object in the original document, and determine the initial arrangement order of each comment information; a horizontal arrangement subunit, which is used to sort the comment information based on the horizontal position of each annotation object when there are multiple annotation objects with the same vertical position, and determine the final arrangement order of each comment information.In one embodiment, the webpage annotation implementation device for Word documents further includes an annotation operation module, including: an annotation operation execution unit for executing an annotation operation corresponding to the annotation operation instruction on a target annotation object based on the annotation operation instruction; a comment information collection unit for collecting comment information of the target annotation object after the annotation operation is completed; a comment list updating unit for updating the comment list based on the annotation operation and the comment information of the target annotation object so that the comment list maintains data consistency with the original document. In one embodiment, the connection operation module 205 includes: a temporary node construction unit for constructing a temporary node based on the position information of the annotation object in the original document; and a connection construction unit for constructing a connection between the comment information and the corresponding annotation object based on a connection algorithm and the temporary node. The present invention provides a webpage annotation implementation device for Word documents, which converts the target document content into HTML format through document conversion technology and extracts the annotation object and its comment information based on the annotation tag, effectively avoiding the problem of loss of annotation content and ensuring that the annotation information can be completely and accurately converted from the Word document and mapped to HTML data. By displaying each comment information in the comment list on the web page display page in a preset comment layout mode, the comment content can be reasonably organized and presented, making it easier for users to browse and view the comment information, thereby efficiently reviewing and analyzing the document. According to the corresponding relationship between each comment information and each annotation object in the original document, a connection line is constructed so that when the user views the annotation, he can clearly and accurately see the corresponding position of the annotation and the original text, thereby quickly locating the relevant part in the original text and improving the efficiency of the review work. Regarding the specific definition of the web page annotation implementation device for Word documents, please refer to the definition of the web page annotation implementation method for Word documents above, which will not be repeated here. The various modules in the above-mentioned web page annotation implementation device for Word documents can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules. In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as shown. The computer device includes a processor, a memory, a network interface and a database connected via a web application bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage medium stores an operating web application, a computer program, and a database. The internal memory provides an environment for the operation of the operating web application and computer program in the non-volatile storage medium.The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it implements the functions or steps on the server side of a method for implementing web page annotation of a Word document. In one embodiment, a computer device is provided, which can be a client, and its internal structure diagram can be as shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a web application bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores operating web applications and computer programs. The internal memory provides an environment for the operation of the operating web applications and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, the functions or steps on the client side of a method for implementing web page annotation of a Word document are implemented. In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the following steps are implemented: based on document conversion technology, the document content of the target document is converted into a hypertext markup language HTML format to obtain HTML data; based on the annotation tag, the annotation objects and the comment information of each annotation object in the HTML data are extracted to construct a comment list; the HTML data is loaded into a web page display page to display the original document and at least one annotation object in the original document; based on a preset comment layout method, each comment information in the comment list is displayed on the web page display page; based on the correspondence between each comment information and each annotation object in the original document, a connection line is constructed between each comment information and each annotation object in the original document to realize the web page annotation display of the Word document. In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which implements the following steps when executed by a processor: based on document conversion technology, converting the document content of the target document into a hypertext markup language HTML format to obtain HTML data; based on annotation tags, extracting annotation objects and comment information of each annotation object in the HTML data, and constructing a comment list; loading the HTML data into a web page display page to display the original document and at least one annotation object in the original document; based on a preset comment layout method, displaying each comment information in the comment list on the web page display page; based on the correspondence between each comment information and each annotation object in the original document, constructing a connection between each comment information and each annotation object in the original document to realize web page annotation display of the Word document.It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device mentioned above can be referred to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM). Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A method for implementing web page annotation in a Word document, characterized in that: The method comprises: Based on the document conversion technology, the document content of the target document is converted into the Hypertext Markup Language HTML format to obtain HTML data; Extracting annotation objects and comment information of each annotation object from the HTML data based on the annotation tags, and constructing a comment list; Loading the HTML data into a web page display page to display the original document and at least one annotation object in the original document; Based on a preset comment layout, displaying each comment information in the comment list on the web page display page; Based on the corresponding relationship between each comment information and each annotation object in the original document, a connection line is constructed between each comment information and each annotation object in the original document to realize the web page annotation display of the Word document.
2. The method for implementing web page annotation of a Word document according to claim 1, characterized in that: The step of extracting the annotation objects and the comment information of each annotation object from the HTML data based on the annotation tags and constructing a comment list includes: Based on the annotation tag, identifying at least one of the annotation objects in the HTML data; Extract the comment information of each annotation object and construct a comment list; wherein the comment information includes the comment content, comment author information, creation time and location information of the annotation object in the original document.
3. The method for implementing web page annotation of a Word document according to claim 1, characterized in that: Before loading the HTML data into the webpage display page and displaying the original document and at least one annotation object in the original document, the method further includes: Based on a preset display tag, the annotation identifier of each annotation object in the HTML data is replaced, so that each annotation object is displayed in the web page display page in a display format corresponding to the preset display tag.
4. The method for implementing web page annotation of a Word document according to claim 1, characterized in that: The step of displaying each comment information in the comment list on the webpage display page based on the preset comment layout method includes: Obtaining location information of the annotation object corresponding to each comment information in the original document; sorting the comment information based on the position information of each annotation object to determine the arrangement order of each comment information; Based on the arrangement order of each piece of comment information, each piece of comment information in the comment list is displayed on the web page display page.
5. The method for implementing web page annotation of a Word document according to claim 4, characterized in that: The position information of the annotation object includes the vertical position and the horizontal position of the annotation object in the original document; The step of sorting the comment information based on the position information of each annotation object to determine the arrangement order of the comment information includes: sorting the comment information based on the vertical position of each annotation object in the original document to determine an initial arrangement order of each comment information; When there are multiple annotation objects corresponding to the same vertical position, the comment information is sorted based on the horizontal position of each annotation object to determine the final arrangement order of each comment information.
6. The method for implementing web page annotation of a Word document according to claim 1, characterized in that: After constructing a connection between each comment information and each annotation object in the original document based on the correspondence between each comment information and each annotation object in the original document to realize the webpage annotation display of the Word document, the method further includes: Based on the annotation operation instruction, perform the annotation operation corresponding to the annotation operation instruction on the target annotation object; After the annotation operation is completed, collecting comment information of the target annotation object; Based on the annotation operation and the comment information of the target annotation object, the comment list is updated so that the comment list maintains data consistency with the original document.
7. The method for implementing web page annotation of a Word document according to claim 1, characterized in that: The constructing a connection between each comment information and each annotation object in the original document based on the corresponding relationship between each comment information and each annotation object in the original document includes: Constructing a temporary node based on the position information of the annotation object in the original document; Based on the connection algorithm and the temporary node, a connection between the comment information and the corresponding annotation object is constructed.
8. A device for implementing web page annotation of Word documents, characterized in that: The webpage annotation implementation device of the Word document includes: The document conversion module is used to convert the document content of the target document into a hypertext markup language HTML format based on the document conversion technology to obtain HTML data; A comment information extraction module is used to extract the comment objects and the comment information of each of the comment objects in the HTML data based on the comment tags, and construct a comment list; A web page display module, configured to load HTML data into a web page display page, and display an original document and at least one annotation object in the original document; A comment display module, configured to display the comment information in the comment list on the web page display page based on a preset comment layout mode; The connection operation module is used to construct a connection between each comment information and each annotation object in the original document based on the corresponding relationship between each comment information and each annotation object in the original document, so as to realize the web page annotation display of the Word document.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for implementing web page annotation of a Word document as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for implementing web page annotation of a Word document as described in any one of claims 1 to 7 are implemented.