Online document visualization processing method and system
Through online document visualization processing methods and systems, based on .Net platform and Aspose technology, the problem of long upgrade cycle of information system analysis reports and unclear charts is solved, enabling users to adjust analysis reports independently, improving user efficiency and reducing operation costs. dimension cost.
Patent Information
- Application Number
- CN202410846900.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-01
AI Technical Summary
The existing information system has a long cycle and high cost in upgrading analysis reports. Users cannot modify system analysis reports online or in batches. Charts and pictures generated by Aspose are not clear. The code of Office native components is unstable after the Windows system is automatically upgraded. Operation and maintenance costs.
Adopt online document visualization processing methods and systems, based on .Net platform, Aspose technology, Office native components and XML tree structure, to realize batch visual adjustment of online documents, support users to independently adjust analysis reports, and use document parsing, chart objectification, and bookmarking and format conversion, generate clear charts, and use Redis cache to reduce database read and write pressure.
It greatly improves user efficiency, solves the problems of unclear charts and unstable code, shortens development and upgrade time, reduces operation and maintenance costs, and enables online batch editing of report templates.
Smart Images

Figure CN118734792A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document parsing, and in particular to an online document visualization processing method and system. Background Art
[0002] The existing information system needs to be manually upgraded by developers according to user needs to support the generation of different data analysis report styles. From the proposal of requirements to the launch of functions, the cycle is long and the cost is high. There are even cases where users no longer need functions before they are launched. This greatly increases the system maintenance cost, and the long waiting time in the development cycle also leads to a decline in user experience. Specifically, the existing technology has the following problems:
[0003] ① The information system analysis report upgrade cycle is long and the investment is high;
[0004] ②Users cannot modify system analysis reports individually or in batches online;
[0005] ③The charts and images of the Word report generated directly by Aspose are not clear;
[0006] ④After the Office native components are automatically upgraded in the Windows system, the component code is often unstable and requires manual code maintenance, increasing operation and maintenance costs. Summary of the invention
[0007] In order to solve the above problems, the present invention proposes an online document visualization processing method and system, which realizes batch visualization adjustment of online documents based on .Net platform, Aspose technology, Office native components and XML tree structure, supports user visualization interface, and users can adjust analysis reports independently, which can effectively solve the pain points of user personalized document adjustment and batch adjustment generation, and greatly improve user efficiency.
[0008] The technical solution adopted by the present invention is as follows:
[0009] In one aspect, the present invention provides an online document visualization processing method, comprising:
[0010] Document parsing: abstract the directory structure of the first type of document into a tree structure and parse out the nodes corresponding to the graph;
[0011] Chart objectification: converting the nodes corresponding to the chart in the first type of document into objects with corresponding attributes to generate chart node objects;
[0012] Chart bookmarking: marking or identifying the chart of the first type of document in the form of a bookmark to generate a chart bookmark;
[0013] Format conversion: converting the tree structure, chart node objects and chart bookmarks of the first type of document into the second type of data format for storage;
[0014] Target document generation: Generate a document structure in a third type of document format based on the tree structure in the second type of data format, and fill in data; and generate a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format, thereby obtaining a third type of document, namely the target document.
[0015] Furthermore, in the objectification of the chart, the properties of the object include: type, height, width, coordinate axis unit, coordinate axis maximum value and coordinate axis minimum value.
[0016] Furthermore, the first type of document includes a Word document, the second type of data format includes a JSON format, and the third type of document includes an Aspose document.
[0017] Furthermore, the method of generating a document structure of a third type of document format according to the tree structure of the second type of data format and performing data filling includes: based on the tree structure of the second type of data format, calling the Aspose.Words package of the Aspose document to generate a Word structure without charts; calling the cell operation of the Asopse document and using the worksheet object of the Aspose document to implement Excel data filling.
[0018] Furthermore, generating a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format includes: completing adjustment processing of chart details through the worksheet object of the Aspose document.
[0019] In another aspect, the present invention provides an online document visualization processing system, comprising:
[0020] A document parsing module is configured to abstract the directory structure of the first type of document into a tree structure and parse out nodes corresponding to the graph;
[0021] A chart objectification module is configured to convert nodes corresponding to the chart in the first type of document into objects with corresponding properties to generate chart node objects;
[0022] A chart bookmarking module is configured to mark or identify the chart of the first type of document in the form of a bookmark to generate a chart bookmark;
[0023] a format conversion module configured to convert the tree structure, chart node objects and chart bookmarks of the first type of document into a second type of data format for storage;
[0024] The target document generation module is configured to generate a document structure in a third type of document format based on the tree structure in the second type of data format and to perform data filling; and to generate a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format, thereby obtaining a third type of document, namely the target document.
[0025] Furthermore, in the chart objectization module, the attributes of the object include: type, height, width, coordinate axis unit, coordinate axis maximum value and coordinate axis minimum value.
[0026] Furthermore, the first type of document includes a Word document, the second type of data format includes a JSON format, and the third type of document includes an Aspose document.
[0027] Furthermore, the method of generating a document structure of a third type of document format according to the tree structure of the second type of data format and performing data filling includes: based on the tree structure of the second type of data format, calling the Aspose.Words package of the Aspose document to generate a Word structure without charts; calling the cell operation of the Asopse document and using the worksheet object of the Aspose document to implement Excel data filling.
[0028] Furthermore, generating a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format includes: completing adjustment processing of chart details through the worksheet object of the Aspose document.
[0029] The beneficial effects of the present invention are:
[0030] 1. The present invention proposes a tree structure of report documents in Json format, which supports the subsequent rapid generation of documents by Aspose and the display of documents in a tree structure by the front end; proposes a document node definition specification based on Aspose, which can be used for the description and manual adjustment of dynamic nodes in documents; proposes an image replacement technology that combines Asopse with Office bookmarks and Office native components to ensure the resolution of report graphics; proposes a Json cache technology based on Redis, which reduces repeated document operations by the front end, database reading and writing pressure, and network load.
[0031] 2. The present invention can solve the problem of Word structure definition. The Word document structure and chart are separated and objectified respectively, making it possible for users to operate documents graphically, greatly shortening the subsequent development and upgrade time; it can solve the problem that users cannot modify documents manually or in batches, and the system defaults to reporting documents, greatly improving user efficiency; because the clarity of charts generated by Asopse's own chart renderer will decrease after being enlarged, the present invention can solve the problem that the rendered graphics are not as clear as those of Office native components when Asopse is used directly.
[0032] 3. Compared with the prior art, the present invention not only performs conventional operations on Word based on Aspose, but also abstracts the Word document structure through the Json data format, connects the document display of the web page with the Word structure generated in the background. The document operation on the user's web page front end will directly update the Word structure and Json structure, and finally directly reflect on the batch-generated Word, realizing the online batch editing function of the report Word template. At the same time, combined with the replacement technology of Office native components, it not only overcomes the problem of unclear images generated by Aspose, but also overcomes the problem of unstable automatic Windows upgrade when using Office components completely. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a flow chart of an online document visualization processing method according to an embodiment of the present invention.
[0034] Figure 2 The present invention is a flowchart of a document generation process according to an embodiment of the present invention.
[0035] Figure 3 It is a schematic diagram of abstracting the Word directory structure into a tree structure in an embodiment of the present invention.
[0036] Figure 4 It is a Json saving flow chart when a web page front end operates a document in an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, the specific implementation methods of the present invention are now described. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the embodiments described are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0038] like Figure 1 As shown, this embodiment provides an online document visualization processing method proposed by the present invention, including:
[0039] Document parsing: abstract the directory structure of the first type of document into a tree structure and parse out the nodes corresponding to the graph;
[0040] Chart objectification: converting the nodes corresponding to the chart in the first type of document into objects with corresponding attributes to generate chart node objects;
[0041] Chart bookmarking: marking or identifying the chart of the first type of document in the form of a bookmark to generate a chart bookmark;
[0042] Format conversion: converting the tree structure, chart node objects and chart bookmarks of the first type of document into the second type of data format for storage;
[0043] Target document generation: Generate a document structure in a third type of document format based on the tree structure in the second type of data format, and fill in data; and generate a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format, thereby obtaining a third type of document, namely the target document.
[0044] Correspondingly, the present embodiment also proposes an online document visualization processing system, including: a document parsing module, configured to abstract the directory structure of the first type of document into a tree structure, and parse out the nodes corresponding to the chart; a chart objectification module, configured to convert the nodes corresponding to the chart in the first type of document into objects with corresponding attributes, and generate chart node objects; a chart bookmarking module, configured to mark or identify the chart of the first type of document in the form of a bookmark, and generate a chart bookmark; a format conversion module, configured to convert the tree structure, chart node object and chart bookmark of the first type of document into a second type of data format for storage; a target document generation module, configured to generate a document structure in a third type of document format according to the tree structure in the second type of data format, and perform data filling; and generate a chart in a third type of document format according to the chart node object and chart bookmark in the second type of data format, thereby obtaining a third type of document, namely, a target document.
[0045] Specifically, the online document visualization processing method of this embodiment is described in detail based on the two aspects of document generation process and graphical operation process.
[0046] 1. Document Generation Process
[0047] The document generation process mainly includes: Figure 2 The six steps shown in the figure are to realize user-defined editing of online documents. The core issues to be solved are: ① Visualization of document structure; ② Customizable adjustment of document structure; ③ Configurable modification of document diagram nodes. Therefore, the structure of the document needs to be separated from the content of the document to support subsequent user modification. Specifically, the document generation process is as follows:
[0048] (1) Word document analysis
[0049] The Word document parsing mainly parses: the structural description of the Word document; what are the nodes of the Word graphic report. This embodiment abstracts the directory structure of the Word document into a tree structure, such as Figure 3 shown.
[0050] Since Word supports up to 9 paragraph structures, the program supports up to 9 layers of document tree description, that is, a parent node can have up to 8 layers of child nodes, which is used to describe the Word document structure. At the same time, as shown in the figure, the chart can be located on any level of tree node through bookmarks. Such a tree structure can be easily converted into a Json structure for storage.
[0051] (2) Graph Node Objectification
[0052] For each chart used in Word, this embodiment defines a node object for description, and the object properties include: type, height, width, axisUnit, axisMax, axisMin, etc., which are used to describe the chart properties.
[0053] At the same time, the generation of charts also depends on data. Referring to the format of chart data in Excel, a two-dimensional array is defined in the node object to describe the chart data. In this way, a chart is objectified.
[0054] Node object description example:
[0055] "outlineLevel": chart level,
[0056] "title": icon name,
[0057] "description": Chart name,
[0058] "type":"chart",
[0059] height:70,
[0060] width:60,
[0061] axisUnit:'%',
[0062] axisMax:100,
[0063] axisMin:8,
[0064] "footNotes":[
[0065] " Figure 1: Used to count the number of construction equipment
[0066]
[0067] (3) Bookmarking of graph nodes
[0068] The purpose of bookmarking a chart node is to locate the position of the chart with a bookmark. In manual Word operation, you can insert a bookmark manually. The bookmark plays a role in positioning, and the system subsequently replaces the bookmark to achieve the role of replacing the chart.
[0069] (4) Word structure converted to Json
[0070] The Word document tree structure + chart node object + chart bookmark obtained in the first three steps are saved in Json format, and a complete description of the Word object is obtained. That is, the Json contains the document structure, document node description, document chart location, and chart data.
[0071] The second benefit of using Json format for storage is that it facilitates front-end parsing. The front-end can directly operate the tree-like chart structure in later operations.
[0072] (5) Aspose chart generation
[0073] ①Generate a Word document framework.
[0074] Based on the Word Json structure obtained in the previous step, call Aspose.Words package of Aspose to generate a Word structure without charts. The reference code segment is as follows:
[0075] using(Workbook workbook=new Workbook())
[0076] {
[0077] workbook.Worksheets.RemoveAt(0);
[0078] int idx=workbook.Worksheets.Add();
[0079] workbook.Worksheets[idx].Name="Sheet1";
[0080] }
[0081] According to the nodes in the chart objectification, use Aspose.cells dll to generate the chart Excel original corresponding to the node.
[0082] ② Fill in Excel data.
[0083] Call the Asopse cell operation and use the Asposed worksheet object to fill in Excels data. The reference code segment is as follows:
[0084] cell=worksheet.Cells[CellsTool.CellIndexToName(X,Y)];
[0085] cell.PutValue(data[x][y]);
[0086] ③Adjust the specific graph style according to the Node object properties.
[0087] By operating Asposed worksheet and worksheet objects, the chart details can be adjusted. The reference code segment is as follows:
[0088] int chartIndex=worksheet.Charts.Add(ChartType.Column,5,4,3,2);
[0089] Chart chart=worksheet.Charts[chartIndex];
[0090] chart.ChartObject.Height=nodeHeight;
[0091] chart.ChartObject.Width=nodeWidth;
[0092] for(int j=1;j<=endColumsIndex;j++){
[0093] var series=chart.NSeries[j-1];
[0094] series.Name=$"={CellsTool.CellIndexToName(0,j)}";
[0095] series.DataLabels.ShowValue=true;
[0096] series.DataLabels.Position=LabelPositionType.OutsideEnd;
[0097] series.DataLabels.NumberFormat="#";
[0098] series.DataLabels.NumberFormatLinked=true;
[0099] }
[0100] In this way, an Excel chart original file is quickly generated through Aspose. Since the chart itself is drawn based on Excel, Aspose is only responsible for adjustment, not generated in Word through Aspose's own renderer. The clarity of the chart after enlarging is consistent with that of native Office. At the same time, Aspose generates Excel charts faster than traditional Office native components, has a high degree of objectification and rich documentation, and the development difficulty is greatly reduced.
[0101] Why not use the cheaper Office native components to directly generate Excel charts? Because Office will be upgraded with the Windows system from time to time, the original code will often report errors, further increasing the operation and maintenance costs and affecting the user experience. In addition, Office native components lack document support, and VisualStudio does not support smart prompts, making development difficult.
[0102] (6) Chart bookmark replacement
[0103] The bookmark of the preset chart position in the Word structure is directly replaced with the generated Excel chart through the Office native component. After completion, the entire Word analysis report is generated.
[0104] When the Office native component replaces the Excel chart, it is mainly implemented by pasting and copying the system clipboard, so it is not affected by the automatic upgrade of Windows and has stable performance.
[0105] 2. Graphical operation process
[0106] (1) Batch modification of document structure
[0107] The system displays the directory structure of the document on the interface according to the defined Word document Json tree structure. Users can graphically drag and drop to move different directory levels. After saving, the new Word and Json structures are saved to the database. When downloading and analyzing documents again, all documents will be generated according to the new document structure, which greatly reduces the time of manual document modification.
[0108] Regarding node deletion: When a user tries to delete a parent node with child nodes, the system will stop and return unless the user deletes the child nodes completely. This avoids logical errors in the subsequent Word section generation by Asopse.
[0109] (2) Document chart modification operations
[0110] ① Document structure and image modification: Users can change the chart type, chart axis style, etc., by dragging and dropping on the interface, such as moving the parent node down, child node 1, to the parent node down, or changing the relevant properties of each chart Node object (length, width, height, icon type, etc.). After the user saves, the document will be generated with a new structure next time.
[0111] The front-end interface will display unused chart node Node objects. Users can add or modify document chart nodes by simply dragging and dropping and synchronously modifying the Json data value of the Word structure.
[0112] ②Web front-end operation documents, Json preservation:
[0113] The editing of Word documents often cannot be completed immediately, that is, it involves multiple edits and needs to be saved step by step. At the same time, the Json length of the Word document structure is large, and when it is stored in the database, it is converted into a binary file. If it is read and written repeatedly, the pressure on the database is also very high. Here, the front end uses Redis cache, with userID + document ID as the primary key, and saves during the process. The process is as follows Figure 4 shown.
[0114] (3) Document maintenance and upgrade
[0115] It can be seen that after the Word document structure is structuralized, the document structure becomes completely customizable, that is, the document structure does not need to be maintained.
[0116] When users have new requirements, the information system only needs to maintain new chart nodes. For example, the system previously only supported bar charts, but now it needs to support pie charts. The traditional method requires maintaining the Word document structure and adding new image support. Now, only the pie chart generation algorithm needs to be maintained, and users can add and modify node objects on the interface.
[0117] In summary, the improvements of the present invention compared to the prior art are shown in the following table:
[0118] Table 1 - Improvements of the present invention compared to the prior art
[0119]
[0120] Example 2
[0121] This embodiment is based on embodiment 1:
[0122] This embodiment provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the online document visualization processing method of embodiment 1 is implemented. The computer program may be in source code form, object code form, executable file, or some intermediate form.
[0123] Example 3
[0124] This embodiment is based on embodiment 1:
[0125] This embodiment provides a computer-readable storage medium storing a computer program, which implements the online document visualization processing method of Embodiment 1 when executed by a processor. The computer program may be in source code form, object code form, executable file, or some intermediate form. The storage medium includes: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium. It should be noted that the content contained in the storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the storage medium does not include electric carrier signals and telecommunication signals.
[0126] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
Claims
1. A method for online document visualization processing, characterized in that: include: Document parsing: abstract the directory structure of the first type of document into a tree structure and parse out the nodes corresponding to the graph; Chart objectification: converting the nodes corresponding to the chart in the first type of document into objects with corresponding attributes to generate chart node objects; Chart bookmarking: marking or identifying the chart of the first type of document in the form of a bookmark to generate a chart bookmark; Format conversion: converting the tree structure, chart node objects and chart bookmarks of the first type of document into the second type of data format for storage; Target document generation: Generate a document structure in a third type of document format based on the tree structure in the second type of data format, and fill in data; and generate a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format, thereby obtaining a third type of document, namely the target document.
2. The online document visualization processing method according to claim 1, characterized in that: In the objectification of the chart, the properties of the object include: type, height, width, coordinate axis unit, coordinate axis maximum value and coordinate axis minimum value.
3. The online document visualization processing method according to claim 1, characterized in that: The first type of document includes a Word document, the second type of data format includes a JSON format, and the third type of document includes an Aspose document.
4. The online document visualization processing method according to claim 3, characterized in that: The method of generating a document structure of a third type of document format according to the tree structure of the second type of data format and performing data filling includes: based on the tree structure of the second type of data format, calling the Aspose.Words package of the Aspose document to generate a Word structure without charts; calling the cell operation of the Asopse document and using the worksheet object of the Aspose document to implement Excel data filling.
5. The online document visualization processing method according to claim 3, characterized in that: The generating of the chart in the third type document format according to the chart node object and the chart bookmark in the second type data format includes: completing the adjustment process of the chart details through the worksheet object of the Aspose document.
6. An online document visualization processing system, characterized in that: include: A document parsing module is configured to abstract the directory structure of the first type of document into a tree structure and parse out nodes corresponding to the graph; A chart objectification module is configured to convert nodes corresponding to the chart in the first type of document into objects with corresponding properties to generate chart node objects; A chart bookmarking module is configured to mark or identify the chart of the first type of document in the form of a bookmark to generate a chart bookmark; a format conversion module configured to convert the tree structure, chart node objects and chart bookmarks of the first type of document into a second type of data format for storage; The target document generation module is configured to generate a document structure in a third type of document format based on the tree structure in the second type of data format and to perform data filling; and to generate a chart in a third type of document format based on the chart node objects and chart bookmarks in the second type of data format, thereby obtaining a third type of document, namely the target document.
7. The online document visualization processing system according to claim 6, characterized in that: In the chart objectification module, the attributes of the object include: type, height, width, coordinate axis unit, coordinate axis maximum value and coordinate axis minimum value.
8. The online document visualization processing system according to claim 6, characterized in that: The first type of document includes a Word document, the second type of data format includes a JSON format, and the third type of document includes an Aspose document.
9. The online document visualization processing system according to claim 8, characterized in that: The method of generating a document structure of a third type of document format according to the tree structure of the second type of data format and performing data filling includes: based on the tree structure of the second type of data format, calling the Aspose.Words package of the Aspose document to generate a Word structure without charts; calling the cell operation of the Asopse document and using the worksheet object of the Aspose document to implement Excel data filling.
10. The online document visualization processing system according to claim 8, characterized in that: The generating of the chart in the third type document format according to the chart node object and the chart bookmark in the second type data format includes: completing the adjustment process of the chart details through the worksheet object of the Aspose document.
