An engineering report generation method, system, storage medium and electronic device
Patent Information
- Application Number
- CN202311830832.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-12-28
AI Technical Summary
[0003]现有技术当中,生成工程报表存在以下缺陷:1由于项目上的计算机设备较差,通常仅使用单一的报表模版,来满足快速生成的需求,导致不能根据工程报表的内容选择最适合的报表模版,影响了业主的观看体验,而为了得到最好的工程报表,不同类型的数据要选择不同的报表模版,对于一些较差的计算机设备,在匹配大量不同的报表模版时,处理较慢,影响了工程报表的生成速度;2.工程报表由于是单一的文件,无法加载至不同的绘制设备中(如显示器、打印机、PDF文档、EXCEL文档、WORD文档等)
比起现有技术中将工程报表的数据强行套入报表模版,通过将工程报表的数据和报表模版模型化,建立原始数据模型和报表模版模型,只需按需求将原始数据模型套入报表模版模型,可以大幅降低计算机的处理负担,并且重新创建多线程排版任务,将排版任务与原始数据模型一一对应,使得在进行格式计算的时候能够在多线程中直接使用,而不用进行同步等待,充分发挥了现代计算机多核心的性能优势,以输出报表数据排版文件集,该输出报表数据排版文件集可以通过序列化/反序列化实现报表数据排版文件的可持续存储,让报表数据排版文件可以导出于各种绘制设备中(如显示器、打印机、PDF文档、EXCEL文档、WORD文档等),由于报表数据排版文件具有独立性和完备性,让其可以随机得进行加载,大幅降低了硬件需求。
Smart Images

Figure CN117910442B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of engineering report technology, and in particular to an engineering report generation method, system, storage medium, and electronic device. Background Technology
[0002] Engineering reports are documents that reflect the implementation status of engineering projects. In order to clearly present the actual situation of the engineering project to the owner, it is necessary to generate corresponding engineering reports.
[0003] The existing technology for generating engineering reports has the following drawbacks: 1. Due to the poor computer equipment on the project site, only a single report template is usually used to meet the needs of rapid generation. This results in the inability to select the most suitable report template based on the content of the engineering report, which affects the viewing experience of the client. In order to obtain the best engineering report, different report templates should be selected for different types of data. For some poor computer equipment, the processing is slow when matching a large number of different report templates, which affects the generation speed of engineering reports; 2. Since engineering reports are single files, they cannot be loaded onto different drawing devices (such as monitors, printers, PDF documents, EXCEL documents, WORD documents, etc.). Summary of the Invention
[0004] In view of the shortcomings of the prior art, the purpose of this invention is to provide an engineering report generation method, which aims to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solution: A method for generating engineering reports includes the following steps: S10: Obtain the data of the engineering report to be formatted in order to create the original data model; S20, parse the report template associated with the project report, obtain various information data of the report template, and generate a report template model; S30, input the original data model into the report template model to create a multi-threaded layout task, wherein the layout task corresponds one-to-one with the original data model; S40, execute the typesetting task, perform row height calculation, pagination calculation, and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; S50: Load the report data layout file set as needed, generate page-drawable graphics, and export the page-drawable graphics to the required drawing device.
[0006] Furthermore, the specific steps of step S10 include: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries i The data corresponding to the project report i row, the field j The data corresponding to the project report j Columns, text (entries) i Fields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model; S102, the scope of some of the entries ( i 1- i 2) Within, or in part of, the range of the fields described ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2); S103, the data obtained from the processing in steps S101 and S102 is used to generate a unique identifier, thereby generating the original data model.
[0007] Furthermore, step S20 specifically includes the following steps: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set, and then generate a report template model.
[0008] Furthermore, in step S40, the specific steps for calculating the row height include: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; Furthermore, in step S40, after the row height calculation is completed, the specific steps for performing pagination calculations and special processing of cross-page text, and outputting the report data layout file set include: S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special processing of cross-page text is performed on the starting row and the ending row, and the text in the cell that needs to be processed is split; S406: Input single-page information, perform serialization processing to output a single-page layout format data file set, and record the corresponding page index and page identifier relationship at the same time; S407 Input the page index information, perform serialization processing, and output the report page index file; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files.
[0009] Furthermore, the specific steps for calculating the row height information of the original data model according to the row sequence number include: S4031, preprocess the string text in the line, perform a first format determination, and perform first format processing according to the determination result of the first format determination; S4032, perform word segmentation on the string text after the first format processing, and select whether to output the word segmentation set based on the judgment result of the word segmentation. S4033, perform a second format determination on the string text that has not undergone the first format processing, and select whether to output the word segmentation set based on the determination result of the second format determination; S4034, perform second format processing on the string text that has undergone the second format determination but has not output a word segmentation set, and perform the word segmentation determination on the string text after the second format processing, and select whether to output a word segmentation set based on the determination result of the word segmentation determination; The specific steps of the word segmentation process include: S4035, preprocess the string text that needs to be segmented; S4036, Traverse the characters in the string text and determine whether to output the text height and the set of newline insertion positions; S4037, determine the newline character in the string text; if it is, reset the accumulated width to 0. S4038, determine the word segmentation index of the characters in the string text; if so, calculate the width of the substring of the word segmentation through the font engine set, and perform word segmentation width processing. S4039, Calculate the current character width of the string text that has not undergone word segmentation width processing using the font engine set, and then perform character width processing; S4040, return the characters processed by the above steps to step S4036. Furthermore, the specific steps of step S50 include: Input the report data layout file, decompress it to a temporary file directory, load the report page index file, deserialize it to generate a report page index manager object, and establish a cache of the relationship between page index and page identifier; Input the page index, find the associated single-page layout format data file, load the single-page layout format data file and deserialize it to generate a single-page object; Update the key-value pair cache of the single-page object; Input a page object, generate page drawable primitives, and export them to the required drawing devices through different rendering engines.
[0010] The present invention also provides an engineering report generation system, comprising: Raw data model acquisition module: Used to acquire data from the engineering report to be formatted in order to create the raw data model; The original data model acquisition module is specifically used for: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries i The data corresponding to the project report i row, the field j The data corresponding to the project report j Columns, text (entries) iFields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model; S102, the scope of some of the entries ( i 1- i 2) Within, or in part of, the range of the fields described ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2); S103, generate a unique identifier from the data obtained by the processing of steps S101 and S102, and then generate the original data model; Report template model acquisition module: used to parse the report template associated with the project report, obtain various information data of the report template, and generate a report template model; The report template model acquisition module is specifically used for: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set, and then generate a report template model; Typesetting task creation module: used to input the original data model into the report template model and create multi-threaded typesetting tasks, wherein each typesetting task corresponds one-to-one with the original data model; Typesetting task execution module: used to execute the typesetting task, and perform row height calculation, pagination calculation and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; The typesetting task execution module is specifically used for: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special processing of cross-page text is performed on the starting row and the ending row, and the text in the cell that needs to be processed is split; S406: Input single-page information, perform serialization processing to output a single-page layout format data file set, and record the corresponding page index and page identifier relationship at the same time; S407, Input the page index information, perform serialization processing, and output the report page index file; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files. The typesetting task execution module includes a line height calculation unit, which is specifically used for: S4031, preprocess the string text in the line, perform a first format determination, and perform first format processing according to the determination result of the first format determination; S4032, perform word segmentation on the string text after the first format processing, and select whether to output the word segmentation set based on the judgment result of the word segmentation. S4033, perform a second format determination on the string text that has not undergone the first format processing, and select whether to output the word segmentation set based on the determination result of the second format determination; S4034, perform second format processing on the string text that has undergone the second format determination but has not output a word segmentation set, and perform the word segmentation determination on the string text after the second format processing, and select whether to output a word segmentation set based on the determination result of the word segmentation determination; The specific steps of the word segmentation process include: S4035, preprocess the string text that needs to be segmented; S4036, Traverse the characters in the string text and determine whether to output the text height and the set of newline insertion positions; S4037, determine the newline character in the string text; if it is, reset the accumulated width to 0. S4038, determine the word segmentation index of the characters in the string text; if so, calculate the width of the substring of the word segmentation through the font engine set, and perform word segmentation width processing. S4039, Calculate the current character width of the string text that has not undergone word segmentation width processing using the font engine set, and then perform character width processing; S4040, return the characters processed by the above steps to step S4036.
[0011] Engineering report export module: used to load the report data layout file set as needed, generate page drawable elements, and export the page drawable elements to the required drawing device; The engineering report export module is specifically used for: Input the report data layout file, decompress it to a temporary file directory, load the report page index file, deserialize it to generate a report page index manager object, and establish a cache of the relationship between page index and page identifier; Input the page index, find the associated single-page layout format data file, load the single-page layout format data file and deserialize it to generate a single-page object; Update the key-value pair cache of the single-page object; Input a page object, generate page drawable primitives, and export them to the required drawing devices through different rendering engines.
[0012] The present invention also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the engineering report generation method described above.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the engineering report generation method described above.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: Compared to existing technologies that forcibly fit data from engineering reports into report templates, this new method models both the data and the template, creating original data models and report template models. Users simply need to fit the original data model into the report template model as needed, significantly reducing the computer's processing load. Furthermore, it recreates multi-threaded typesetting tasks, mapping each task to the original data model. This allows for direct use in multi-threaded calculations without synchronous waiting, fully leveraging the performance advantages of modern multi-core computers. The output report data typesetting file set can be persistently stored through serialization / deserialization, allowing it to be exported to various display devices (such as monitors, printers, PDF documents, Excel documents, and Word documents). The independence and completeness of the report data typesetting files enable random loading, significantly reducing hardware requirements. Attached Figure Description
[0015] Figure 1 This is a flowchart of the engineering report generation method in the first embodiment of the present invention; Figure 2 This is a schematic diagram of the grid data model in the first embodiment of the present invention; Figure 3 This is a schematic diagram of merging cells in the first embodiment of the present invention; Figure 4 This is a schematic diagram of a single-page layout in the first embodiment of the present invention; Figure 5 This is a schematic diagram of the style settings in the first embodiment of the present invention; Figure 6 This is a schematic diagram of a single-page layout format data file in the first embodiment of the present invention; Figure 7 This is a schematic diagram of the report page index file in the first embodiment of the present invention; Figure 8 This is a schematic diagram of the report data layout file set in the first embodiment of the present invention; Figure 9 This is a flowchart illustrating the row height calculation process in the first embodiment of the present invention; Figure 10 for Figure 9 The flowchart for word segmentation processing; Figure 11 This is a structural block diagram of the engineering report generation system in the second embodiment of the present invention; Figure 12 This is a structural block diagram of the computer device in the third embodiment of the present invention; The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0016] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0017] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0019] Example 1 Please see Figure 1 The figure shows a method for generating engineering reports according to the first embodiment of the present invention, which includes the following steps: S10: Obtain the data of the engineering report to be formatted in order to create the original data model; S20, parse the report template associated with the project report, obtain various information data of the report template, and generate a report template model; S30, input the original data model into the report template model to create a multi-threaded layout task, wherein the layout task corresponds one-to-one with the original data model; S40, execute the typesetting task, perform row height calculation, pagination calculation, and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; S50: Load the report data layout file set as needed, generate page-drawable graphics, and export the page-drawable graphics to the required drawing device.
[0020] Understandably, compared to existing technologies that forcibly fit data from engineering reports into report templates, this invention models the data and templates of engineering reports, establishing original data models and report template models. Users only need to fit the original data model into the report template model as needed, significantly reducing the computer's processing burden. Furthermore, it recreates multi-threaded typesetting tasks, mapping each typesetting task to the original data model, allowing for direct use in multi-threaded calculations without synchronous waiting. This fully leverages the performance advantages of modern multi-core computers to output a set of report data typesetting files. This output set can be serialized / deserialized for sustainable storage, enabling export to various drawing devices (such as monitors, printers, PDF documents, EXCEL documents, WORD documents, etc.). Because the report data typesetting files are independent and complete, they can be loaded randomly, significantly reducing hardware requirements.
[0021] Specifically, step S10 includes the following steps: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries i The data corresponding to the project report i row, the field j The data corresponding to the project report j Columns, text (entries) i Fields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model, such as Figure 2 As shown; S102, the scope of some of the entries ( i 1- i 2) Within, or in part of, the range of the fields described ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2), such as Figure 3 As shown; S103, the data obtained from the processing in steps S101 and S102 is used to generate a unique identifier, thereby generating the original data model.
[0022] Furthermore, the specific steps of step S20 include: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout, such as... Figure 4 As shown; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager, such as... Figure 5 As shown; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set (QFontEngine), and then generate the report template model.
[0023] Furthermore, in step S30, the typesetting task is multi-threaded to ensure that the maximum number of typesetting tasks are executed at the same time, and the maximum number of typesetting tasks is no more than twice the number of physical CPU cores of the computer.
[0024] Furthermore, the specific steps of step S40 include: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; When the computer system hardware is idle, the row height calculation is split into tasks, with a preset number of rows of data input, distributed row height calculation subtasks are created and submitted to different sub-threads for execution; It should be noted that this step is optional rather than mandatory. When the system hardware is relatively idle, since the row number calculation is performed with data as input and there is no resource competition between rows, the row height calculation can be split into tasks. In this embodiment, 2000 rows of data input are used to create sub-tasks for calculating row height and submit them to different sub-threads for execution, which further improves the overall typesetting efficiency. S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special cross-page text processing is performed on the starting row and the ending row. The text in the cell that needs to be processed is split to prevent the text from being cut across pages. S406, Input single-page information, perform serialization processing, and output a single-page layout format data file set, such as... Figure 6 As shown, the corresponding page index and page identifier relationship are recorded simultaneously; S407, Input the page index information, perform serialization processing, and output the report page index file, such as... Figure 7 As shown; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set, such as... Figure 8 As shown; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files.
[0025] Specifically, the steps for calculating the row height information of the original data model according to the row sequence number include: S4031, preprocess the string text in the line, perform a first format determination, and perform first format processing according to the determination result of the first format determination; S4032, perform word segmentation on the string text after the first format processing, and select whether to output the word segmentation set based on the judgment result of the word segmentation. S4033, perform a second format determination on the string text that has not undergone the first format processing, and select whether to output the word segmentation set based on the determination result of the second format determination; S4034, perform second format processing on the string text that has undergone the second format determination but has not output a word segmentation set, and perform the word segmentation determination on the string text after the second format processing, and select whether to output a word segmentation set based on the determination result of the word segmentation determination; For more details, please see Figure 9 Mind map in Chinese: The string text in the input line; Iterate through the characters in the string text; The system sequentially determines whether the characters in the string text are numbers or letters, punctuation marks, or currency or numeric symbols. If they are, the system processes them accordingly, either as numbers or letters, punctuation marks, or currency or numeric symbols. Otherwise, the system proceeds to the next step. Determine whether characters processed by numbers or letters, punctuation marks, or currency or numerical symbols need to be segmented. If so, perform segmentation and record the start and end indices of the segmented characters. Otherwise, return to the previous step. Determine whether the characters in the string text are whitespace characters. If they are, record the start and end indices of the word segmentation. Otherwise, proceed to the next step. The characters in the string text are processed with special characters. It is then determined whether the word segmentation process is required. If so, the word segmentation process is performed, and the start and end indices of the word segmentation are recorded. Otherwise, the process returns to the previous step. The characters after recording the start and end subscripts are output to the word segmentation set, or the process is reset and returned to the previous step. The specific steps of the word segmentation process include: S4035, preprocess the string text that needs to be segmented; S4036, Traverse the characters in the string text and determine whether to output the text height and the set of newline insertion positions; S4037, determine the newline character in the string text; if it is, reset the accumulated width to 0. S4038, determine the word segmentation index of the characters in the string text; if so, calculate the width of the substring of the word segmentation through the font engine set, and perform word segmentation width processing. S4039, Calculate the current character width of the string text that has not undergone word segmentation width processing using the font engine set, and then perform character width processing; S4040, return the character processed by the above steps to step S4036; For more details, please refer to the mind map in section 10: Input the corresponding processed string text and process bracket symbols; Iterate through the characters in the corresponding processed string text; Determine whether the characters in the corresponding processed string text have been traversed to the end. If so, use the font engine set to calculate the height required for inserting the newline string, and then output the text height and the set of newline insertion positions. Otherwise, proceed to the next step. Determine if the character in the processed string is a newline character. If it is, reset the accumulated width to 0; otherwise, proceed to the next step. Determine whether a character in the processed string text is the starting index of a certain word segment. If so, use the font engine set to calculate the width of the substring of the word segment; otherwise, use the font engine set to calculate the width of the current character. After calculating the width of the substring of the word segmentation and the width of the current character, it is determined whether the word segmentation width exceeds the limit width. If it does, the font engine set is used to calculate the current character width; otherwise, the next step is performed. After the current character width is calculated as described in step b, it is determined whether the accumulated width exceeds the limit width. If so, the newline position index is recorded, a newline character is inserted, the accumulated width is reset to 0, and the process returns to the previous step. Otherwise, the process returns directly to the previous step. Determine whether the accumulated width exceeds the limit width. If so, record the line break position index, insert a line break character, set the starting index to the word segmentation end index, reset the accumulated width to the word segmentation width, and then return to the previous step. Otherwise, use the font engine set to calculate the current character width, add the widths together, and then return to the previous step.
[0026] Furthermore, the specific steps of step S50 include: Input the report data layout file, decompress it to a temporary file directory, load the report page index file, deserialize it to generate a report page index manager object, and establish a cache of the relationship between page index and page identifier; Input the page index, find the associated single-page layout format data file, load the single-page layout format data file and deserialize it to generate a single-page object; Update the key-value pair cache of the single-page object; Input a page object, generate page drawable primitives, and export them to the required drawing devices (such as monitors, printers, PDF documents, EXCEL documents, WORD documents, etc.) through different rendering engines.
[0027] In summary, the engineering report generation method in the above embodiments of the present invention, compared with the prior art of forcibly fitting engineering report data into a report template, by modeling the engineering report data and report template, establishes an original data model and a report template model. The original data model is then simply fitted into the report template model as needed, significantly reducing the computer's processing burden. Furthermore, by recreating multi-threaded typesetting tasks and mapping each typesetting task to the original data model, format calculations can be performed directly in multiple threads without synchronous waiting, fully leveraging the performance advantages of modern multi-core computers to output a set of report data typesetting files. This output set of report data typesetting files can be continuously stored through serialization / deserialization, allowing the report data typesetting files to be exported to various drawing devices (such as monitors, printers, PDF documents, EXCEL documents, WORD documents, etc.). Because the report data typesetting files are independent and complete, they can be loaded randomly, significantly reducing hardware requirements.
[0028] Example 2 Please see Figure 11 The second embodiment of the present invention also provides an engineering report generation system 40, comprising: Original data model acquisition module 11: Used to acquire data from the engineering report to be formatted in order to create the original data model; The original data model acquisition module 11 is specifically used for: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries i The data corresponding to the project report i row, the field j The data corresponding to the project report j Columns, text (entries) i Fields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model; S102, the scope of some of the entries ( i 1- i 2) Within, or in part of, the range of the fields described ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2); S103, generate a unique identifier from the data obtained by the processing of steps S101 and S102, and then generate the original data model; Report template model acquisition module 12: used to parse the report template associated with the project report, acquire various information data of the report template, and generate a report template model; The report template model acquisition module 12 is specifically used for: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set, and then generate a report template model; Typesetting task creation module 13: used to input the original data model into the report template model and create a multi-threaded typesetting task, wherein the typesetting task corresponds one-to-one with the original data model; Typesetting task execution module 14: used to execute the typesetting task, and perform row height calculation, pagination calculation and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; The typesetting task execution module 14 is specifically used for: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special processing of cross-page text is performed on the starting row and the ending row, and the text in the cell that needs to be processed is split; S406: Input single-page information, perform serialization processing to output a single-page layout format data file set, and record the corresponding page index and page identifier relationship at the same time; S407, Input the page index information, perform serialization processing, and output the report page index file; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files. The typesetting task execution module 14 includes a row height calculation unit 141, which is specifically used for: S4031, preprocess the string text in the line, perform a first format determination, and perform first format processing according to the determination result of the first format determination; S4032, perform word segmentation on the string text after the first format processing, and select whether to output the word segmentation set based on the judgment result of the word segmentation. S4033, perform a second format determination on the string text that has not undergone the first format processing, and select whether to output the word segmentation set based on the determination result of the second format determination; S4034, perform second format processing on the string text that has undergone the second format determination but has not output a word segmentation set, and perform the word segmentation determination on the string text after the second format processing, and select whether to output a word segmentation set based on the determination result of the word segmentation determination; The specific steps of the word segmentation process include: S4035, preprocess the string text that needs to be segmented; S4036, Traverse the characters in the string text and determine whether to output the text height and the set of newline insertion positions; S4037, determine the newline character in the string text; if it is, reset the accumulated width to 0. S4038, determine the word segmentation index of the characters in the string text; if so, calculate the width of the substring of the word segmentation through the font engine set, and perform word segmentation width processing. S4039, Calculate the current character width of the string text that has not undergone word segmentation width processing using the font engine set, and then perform character width processing; S4040, return the characters processed by the above steps to step S4036.
[0029] Engineering report export module 15: used to load the report data layout file set as needed, generate page drawable elements, and export the page drawable elements to the required drawing device; The engineering report export module 15 is specifically used for: Input the report data layout file, decompress it to a temporary file directory, load the report page index file, deserialize it to generate a report page index manager object, and establish a cache of the relationship between page index and page identifier; Input the page index, find the associated single-page layout format data file, load the single-page layout format data file and deserialize it to generate a single-page object; Update the key-value pair cache of the single-page object; Input a page object, generate page drawable primitives, and export them to the required drawing devices through different rendering engines.
[0030] The functions or operation steps implemented by the above modules and units are largely the same as those in the above method embodiments, and will not be repeated here.
[0031] The engineering report generation system 40 provided in this embodiment of the invention has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment. Example 3 The present invention also proposes a computer device, please refer to [link / reference]. Figure 12 The diagram shows a computer device according to a third embodiment of the present invention, including a memory 10, a processor 20, and a computer program 30 stored in the memory 10 and executable on the processor 20. When the processor 20 executes the computer program 30, it implements the above-described method for generating engineering reports.
[0032] The memory 10 includes at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10 can be an internal storage unit of a computer device, such as the hard disk of that computer device. In other embodiments, the memory 10 can be an external storage device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Furthermore, the memory 10 can include both internal and external storage units of the computer device. The memory 10 can be used not only to store application software and various types of data installed on the computer device, but also to temporarily store data that has been output or will be output.
[0033] In some embodiments, the processor 20 may be an electronic control unit (ECU), a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip, used to run program code stored in the memory 10 or process data, such as executing access restriction programs.
[0034] It should be pointed out that, Figure 11 The structure shown does not constitute a limitation on the computer device. In other embodiments, the computer device may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0035] This invention also proposes a readable storage medium storing a computer program that, when executed by a processor, implements the engineering report generation method described above.
[0036] Those skilled in the art will understand that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0037] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0038] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0039] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0040] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for generating engineering reports, characterized in that, Includes the following steps: S10: Obtain the data of the engineering report to be formatted in order to create the original data model; S20, parse the report template associated with the project report, obtain various information data of the report template, and generate a report template model; S30, input the original data model into the report template model to create a multi-threaded layout task, wherein the layout task corresponds one-to-one with the original data model; S40, execute the typesetting task, perform row height calculation, pagination calculation, and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; S50, Load the report data layout file set as needed, generate page-drawable graphic elements, and export the page-drawable graphic elements to the required drawing device; The specific steps of step S10 include: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries are represented as... i、 The data corresponding to the project report i The row, the field is represented as j、 The data corresponding to the project report j Columns, text (entries) i Fields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model; S102, the scope of some of the entries ( i 1- i 2) The scope of the fields described, or a portion thereof ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2); S103, generate a unique identifier from the data processed by steps S101 and S102, and then generate the original data model; The specific steps of step S20 include: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set, and then generate a report template model; In step S40, the specific steps for calculating the row height include: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; After calculating the row height, the specific steps for performing pagination calculations and special processing of cross-page text, and outputting the report data layout file set include: S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special processing of cross-page text is performed on the starting row and the ending row, and the text in the cell that needs to be processed is split; S406: Input single-page information, perform serialization processing to output a single-page layout format data file set, and record the corresponding page index and page identifier relationship at the same time; S407, Input the page index information, perform serialization processing, and output the report page index file; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files.
2. The method for generating engineering reports according to claim 1, characterized in that, The specific steps for calculating the row height information of the original data model according to the row sequence number include: S4031, preprocess the string text in the line, perform a first format determination, and perform first format processing according to the determination result of the first format determination; S4032, perform word segmentation on the string text after the first format processing, and select whether to output the word segmentation set based on the judgment result of the word segmentation. S4033, perform a second format determination on the string text that has not undergone the first format processing, and select whether to output the word segmentation set based on the determination result of the second format determination; S4034, perform second format processing on the string text that has undergone the second format determination but has not output a word segmentation set, and perform the word segmentation determination on the string text after the second format processing, and select whether to output a word segmentation set based on the determination result of the word segmentation determination; The specific steps of the word segmentation process include: S4035, preprocess the string text that needs to be segmented; S4036, Traverse the characters in the string text and determine whether to output the text height and the set of newline insertion positions; S4037, determine the newline character in the string text; if it is, reset the accumulated width to 0. S4038, determine the word segmentation index of the characters in the string text; if so, calculate the width of the substring of the word segmentation through the font engine set, and perform word segmentation width processing. S4039, Calculate the current character width of the string text that has not undergone word segmentation width processing using the font engine set, and then perform character width processing; S4040, return the characters processed by the above steps to step S4036.
3. The method for generating engineering reports according to claim 2, characterized in that, The specific steps of step S50 include: Input the report data layout file, decompress it to a temporary file directory, load the report page index file, deserialize it to generate a report page index manager object, and establish a cache of the relationship between page index and page identifier; Input the page index, find the associated single-page layout format data file, load the single-page layout format data file and deserialize it to generate a single-page object; Update the key-value pair cache of the single-page object; Input a page object, generate page drawable primitives, and export them to the required drawing devices through different rendering engines.
4. An engineering report generation system, characterized in that, include: Raw data model acquisition module: Used to acquire data from the engineering report to be formatted in order to create the raw data model; The original data model acquisition module is specifically used for: S101, read the data of the project report according to the categories of entries, fields, text, and cells, wherein the entries are represented as... i、 The data corresponding to the project report i The row, the field is represented as j、 The data corresponding to the project report j Columns, text (entries) i Fields j ) Corresponding cell (Cell: i , j ), thereby generating a grid data model; S102, the scope of some of the entries ( i 1- i 2) The scope of the fields described, or a portion thereof ( j 1- j The data in section 2) is summarized as follows: i 1, i 2, j 1, j 2) And convert it to a merged cell (MergedCell: i 1, i 2, j 1, j 2); S103, generate a unique identifier from the data processed by steps S101 and S102, and then generate the original data model; Report template model acquisition module: used to parse the report template associated with the project report, obtain various information data of the report template, and generate a report template model; The report template model acquisition module is specifically used for: S201, parse the report template associated with the project report, obtain the font settings of the data in the project report, and create a font specification calculation engine; S202, load all font information in the computer system to create a font specification database; S203, parse the report template associated with the project report, obtain the format settings of the report template, combine it with the font settings of the data in the project report, calculate the content area, and then obtain the single-page layout; S204, parse the report template associated with the project report, obtain the style settings of the report template, generate a cell rendering style object, and add the cell rendering style object to the style manager; S205, parse the report template associated with the project report, obtain the font settings of the report template, create a font engine set, and then generate a report template model; Typesetting task creation module: used to input the original data model into the report template model and create multi-threaded typesetting tasks, wherein each typesetting task corresponds one-to-one with the original data model; Typesetting task execution module: used to execute the typesetting task, and perform row height calculation, pagination calculation and special processing of cross-page text based on the original data model and the report template model, so as to output a set of report data typesetting files; The specific steps for calculating the row height include: S401, taking the row as the smallest unit, use the font engine set to perform specification calculations on the text in all the cells of the row, and determine the minimum height required for the text in the cell under the limited width and according to the cell rendering style object; S402, Simultaneously record the line break information of the cell text, and calculate the maximum value of the minimum height required for all the text in the cells of the row, which is the row height of the row; S403, calculate all row height information of the original data model according to the row sequence number; After calculating the row height, the specific steps for performing pagination calculations and special processing of cross-page text, and outputting the report data layout file set include: S404, based on the result of the row height calculation, the content area calculated in step S203, and the calculated row height information, calculate the starting row, ending row, starting column, and ending column that each page can display according to the sequence number; S405, At the same time, special processing of cross-page text is performed on the starting row and the ending row, and the text in the cell that needs to be processed is split; S406: Input single-page information, perform serialization processing to output a single-page layout format data file set, and record the corresponding page index and page identifier relationship at the same time; S407, Input the page index information, perform serialization processing, and output the report page index file; S408, Input the report page index file and the single-page layout format data file set, compress them, and then output the report data layout file set; The single-page layout format data file set consists of multiple single-page layout format data files, and the report data layout file set consists of multiple report data layout files. Engineering report export module: used to load the report data layout file set as needed, generate page drawable elements, and export the page drawable elements to the required drawing device.
5. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the engineering report generation method as described in any one of claims 1-3.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the engineering report generation method as described in any one of claims 1-3.
Citation Information
Patent Citations
Form / report designer and method suitable for multiple platforms and informatization management system
CN110717320A
Report generation method and device, electronic equipment and storage medium
CN116402038A