Method for printing table data

By inserting custom logical code and page styles into open source printing plug-ins, combining custom lists and template libraries, the problem of difficult printing plug-ins in the existing technology is solved, and more flexible printing format adjustments and multiple requirements are achieved. .

CN119396402AInactive Publication Date: 2025-02-07HEBEI TONGFU SHARING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411404771.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing web-side printing plug-ins are difficult to meet the needs of user custom typesetting. The source code of open source components is complex and easily introduced when modified. Future version updates may lead to complex merge conflicts.

Method used

By parsing the code of the open source printing plug-in, inserting custom logical code and page styles, setting custom lists and template libraries, and adjusting template rules to achieve binding and substitution of custom printing settings parameters.

Benefits of technology

It realizes more flexible printing format adjustments, meets the diverse needs of different users, avoids source code complexity and dependency conflicts, and simplifies the merge process of version updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396402A_ABST
    Figure CN119396402A_ABST
Patent Text Reader

Abstract

The invention relates to a method for printing table data. The method comprises the following steps: setting an open source printing component needing to be called; positioning a position where the user-defined logic code is allowed to be inserted in the component source code, and inserting routing information and a calling instruction of the user-defined logic code at the position; positioning a position where the custom page style is allowed to be inserted in the component source code, and inserting routing information and a calling instruction of the custom page style at the position; determining the application range of the template rule in the table through the user-defined list; according to the application range and the template rule, original information in the table data is replaced with the user-defined logic code and / or the user-defined page style, and the replaced table data is cached as the user-defined printing template. According to the method and the device, the codes of the open source printing plug-in are analyzed, and the self-defined contents are newly added through the self-defined logic codes and the page styles, so that more printing format adjustment requirements are met, and multiple requirements of different users are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of web-end printing, and in particular to a method for printing table data. Background Art

[0002] Existing web page projects have different needs for custom layout functions when printing table data, which makes it difficult for printing plug-ins to meet user needs. Open source components are often used, such as kr-print-designer (kr-print-designer is a printing template designer based on Vue, ElementUi, Lodop and other technologies, which implements the design, preview and printing functions of printing templates), and then modify the source code. It has the following shortcomings:

[0003] The source code of open source components may be more complex, especially when they integrate multiple technology stacks (such as Vue, ElementUi, Lodop, etc.), it may take a long time to understand and master the source code or code library.

[0004] When modifying the source code of an open source component, conflicts with existing dependencies of the project may be introduced. These conflicts may manifest as functional anomalies, style confusion, or performance degradation. Resolving these conflicts requires careful inspection and adjustment of project dependencies.

[0005] If an open source component releases a new version in the future and your project has modified its source code, you may need to re-evaluate and merge those changes in. This may involve a complex merge conflict resolution process and may even require re-implementing some functionality.

[0006] The information disclosed in this background technology section is only intended to deepen the understanding of the overall background technology of the present invention, and should not be regarded as acknowledging or suggesting in any form that the information constitutes the prior art already known to those skilled in the art. Summary of the invention

[0007] In view of the defects existing in the prior art, the purpose of the present invention is to provide a method for printing table data, parse the code of an open source printing plug-in, and realize adding customized content through customized logic code and page style, thereby meeting more printing format adjustment needs and meeting the diverse needs of different users.

[0008] In order to achieve the above purpose, the technical solution adopted by the present invention is:

[0009] A method for printing table data, characterized in that it comprises the following steps:

[0010] Set the open source printing component to be called, pull the component source code and cache it locally;

[0011] A first keyword is set, and a position in the component source code where the custom logic code can be inserted is located by using the first keyword, and routing information and calling instructions of the custom logic code are inserted at the position;

[0012] A second keyword is set, and a position in the component source code where the custom page style can be inserted is located by using the second keyword, and routing information and calling instructions of the custom page style are inserted at the position;

[0013] Setting a custom list, maintaining newly added custom print setting parameters through the custom list, and further setting a binding relationship between the newly added custom print setting parameters and the table code elements of the web-side table data;

[0014] Setting a template library, setting at least one template rule for the newly added custom printing setting parameter, wherein the template rule records a custom table code element for replacing a table code element of the web-side table data;

[0015] Determine the required custom logic code and the required custom page style by adjusting the template rules;

[0016] Determine the application scope of template rules in the table through custom lists;

[0017] According to the application scope and template rules, the original information in the table data is replaced with custom logic code and / or custom page style, and the cached replaced table data is a custom printing template.

[0018] On the basis of the above technical solution, it also includes: calling a custom printing template and setting a table data object to be printed;

[0019] Generate basic tables through custom logic code and / or custom page styles;

[0020] Fill the form with data to be printed;

[0021] Preview the form and data to be printed;

[0022] Output print information to the print list.

[0023] Based on the above technical solution, the custom logic code includes by default:

[0024] Set the data binding relationship, the default is to bind to a custom data source;

[0025] Calculate statistical values. By default, the values ​​in the specified cell list are added up. The cell list must contain at least two cells.

[0026] Dynamic table parameters, by default, include: offset and offset reference, fixed row width and height information, fixed row and column information, and the number of printable rows per page.

[0027] Based on the above technical solution, the custom page style includes by default:

[0028] Customize column width and column width effective range. By default, each column is modified to the custom column width.

[0029] Customized table header name. By default, a custom table header name is assigned one by one according to the column number. If the custom table header name is not empty, you need to specify its binding relationship with the data source.

[0030] The blank information includes by default: the width and height information of the blank area and the effective range.

[0031] On the basis of the above technical solution, in response to the received print preview operation, the printing effect of the basic table is first previewed, and then in response to the received data filling operation, each cell in the basic table is dynamically updated to fill the data to be printed into each cell.

[0032] On the basis of the above technical solution, it also includes: storing the basic table as a table template, first selecting the table template, then selecting the data source, and then responding to the received data filling operation, dynamically updating each cell in the basic table, filling the data to be printed into each cell, and generating a web-side H5 page.

[0033] The method for printing table data described in the present invention has the following beneficial effects:

[0034] Parse the code of the open source printing plug-in, and add new customized content through customized logic code and page style, so as to meet more printing format adjustment needs and meet the diverse needs of different users. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The present invention has the following accompanying drawings:

[0036] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0037] Figure 1 A flowchart of a first embodiment of a method for printing table data according to the present invention.

[0038] Figure 2 A flowchart of a second embodiment of a method for printing table data according to the present invention.

[0039] Figure 3 A flowchart of a third embodiment of a method for printing table data according to the present invention.

[0040] Figure 4A flowchart of a fourth embodiment of a method for printing table data according to the present invention. DETAILED DESCRIPTION

[0041] The present invention is further described in detail below in conjunction with the accompanying drawings. The detailed description is an explanation made in conjunction with the exemplary embodiments of the present invention, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0042] like Figure 1 As shown, a method for printing table data according to the present invention comprises the following steps:

[0043] Set the open source printing component to be called, pull the component source code and cache it locally; first determine which open source printing component will be used to print the table data. The printing component provides basic printing functions, and then further customizes it to meet specific printing needs;

[0044] Set the first keyword, use the first keyword to locate the location in the component source code where custom logic code can be inserted, and insert the routing information and calling instructions of the custom logic code at this location; After determining the printing component, the next step is to find the location in the source code where custom logic code can be inserted. These locations are the "hooks" or "slots" reserved by the printing component for inserting additional code to change its behavior; By inserting the routing information and calling instructions of the custom logic code, these codes will guide the printing component on how to process the table data according to your specific needs;

[0045] A second keyword is set, and a position in the component source code where a custom page style can be inserted is located by the second keyword, and routing information and calling instructions of the custom page style are inserted at the position; in response to the need to customize the appearance of the printed output, a position in the source code where a custom page style can be inserted is found, and after finding a suitable position, routing information and calling instructions of the custom page style are inserted, and these styles will affect the format of the printed output, such as font, color, layout, etc.;

[0046] Set a custom list, through which newly added custom print setting parameters are maintained, and further set the binding relationship between the newly added custom print setting parameters and the table code elements of the web-side table data; especially bind the id attribute of the table code element, for example: Header 1, Header2, header1, header2 are the id attributes of the table code element, which can be used to accurately locate the cell after binding; or bind the class attribute of the table code element, for example: ImportantData, highlight is the class attribute of the table code element, which can be used to adjust the style or behavior to be applied to the cell; this step involves determining which table data will be affected by the custom logic and style, which is achieved through a custom list, which defines which parts of the table data need to be replaced by the custom logic and style;

[0047] Setting a template library, setting at least one template rule for the newly added custom printing setting parameter, wherein the template rule records a custom table code element for replacing a table code element of the web-side table data;

[0048] Determine the required custom logic code and the required custom page style by adjusting the template rules;

[0049] Determine the application scope of template rules in the table through custom lists;

[0050] According to the application scope and template rules, the original information in the table data is replaced with custom logic code and / or custom page style, and the replaced table data is cached as a custom print template; after determining the application scope and applicable template rules, the original information in the table data is replaced with custom logic code and / or custom page style, or a new table is created to fill the corresponding content data into the cells; after the replacement is completed, the modified table data is cached so that it can be used as a custom print template for future printing tasks.

[0051] In this embodiment, the printing component is first selected, then the location where the custom code can be inserted is found, then the code and style are inserted for customization, and then the application scope is determined, and finally the data is replaced and the result is cached; the insertion of custom logic and style is to enhance or change the default behavior of the open source printing component to adapt to specific printing needs; the custom printing template is cached to improve efficiency and avoid the need to redo the same customization process every time printing.

[0052] Locating the position in the component source code where custom logic code can be inserted and locating the position in the component source code where custom page style can be inserted is for customizing the behavior and appearance of the printing component; inserting the routing information and calling instructions of the custom logic code and inserting the routing information and calling instructions of the custom page style are specific steps to achieve customization; determining the application scope of the template rules in the table through the custom list is to determine which parts of the table need to be customized; replacing the original information in the table data with custom logic code and / or custom page style according to the application scope and template rules is the actual customization process; caching the replaced table data as a custom printing template is to improve efficiency so that the customized template can be reused.

[0053] Based on the above technical solution, Figure 2 As shown, it also includes: calling a custom printing template and setting a table data object to be printed;

[0054] Generate basic tables through custom logic code and / or custom page styles;

[0055] Fill the form with data to be printed;

[0056] Preview the form and data to be printed;

[0057] Output print information to the print list.

[0058] This embodiment further details how to use a custom print template to process and print table data. After determining the custom logic code and page style, this step is to apply these customized contents to the actual printing task. That is, apply the custom print template to the actual printing task, generate the print output, and preview and print it.

[0059] First, you need to call the custom print template that was cached previously; then, set the table data object you want to print, which is usually a data structure that contains all the data that needs to be printed; use custom logic code to create the basic structure of the table, which may include determining the number of rows and columns, titles, headers, etc. of the table; custom page styles are used to define the appearance of the table, such as borders, background colors, fonts, etc.; once the basic table structure is created, the next step is to fill the table with the data to be printed, which usually involves placing each data item in the data object into the corresponding position of the table; before actually printing, you usually need to preview the table and the data to be printed to ensure that everything is displayed as expected. This step allows the user to check the layout of the table, the accuracy of the data, and whether the style is applied correctly; the last step is to add the print task to the print queue, which usually involves sending the table data and print instructions to the printer or print service; the print list may contain multiple print tasks, each of which is ready to be processed by the printing device.

[0060] Based on the above technical solution, the custom logic code includes by default:

[0061] Set the data binding relationship, the default is to bind to a custom data source;

[0062] Calculate statistical values. By default, the values ​​in the specified cell list are added up. The cell list must contain at least two cells.

[0063] Dynamic table parameters, by default, include: offset and offset reference, fixed row width and height information, fixed row and column information, and the number of printable rows per page.

[0064] Based on the above technical solution, the custom page style includes by default:

[0065] Customize column width and column width effective range. By default, each column is modified to the custom column width.

[0066] Customized table header name. By default, a custom table header name is assigned one by one according to the column number. If the custom table header name is not empty, you need to specify its binding relationship with the data source.

[0067] The blank information includes by default: the width and height information of the blank area and the effective range.

[0068] Based on the above technical solution, Figure 3 As shown, in response to the received print preview operation, the printing effect of the basic table is first previewed, and then in response to the received data filling operation, each cell in the basic table is dynamically updated to fill the data to be printed into each cell.

[0069] This embodiment further refines the process of print preview and data filling.

[0070] When the user requests a print preview, the system first displays the printing effect of the basic table. This basic table is generated using custom logic code and page style. It does not contain the data to be printed, but only displays the structure and style of the table.

[0071] After the user confirms the printing effect of the basic table, the next step is to dynamically fill the data to be printed into each cell of the table. This step is dynamic, which means that the content of the table will be updated according to the changes in the data.

[0072] The entire process is a dynamic, user-driven process that allows users to conduct detailed inspections and adjustments before printing, ensuring that the printouts meet both specific business needs and user aesthetic standards.

[0073] Based on the above technical solution, Figure 4As shown, it also includes: storing the basic table as a table template, first selecting the table template, then selecting the data source, and then responding to the received data filling operation, dynamically updating each cell in the basic table, filling the data to be printed into each cell, and generating a web-side H5 page.

[0074] This embodiment further refines how to store basic tables as templates, and use these templates to dynamically generate and print table data of Web-side H5 pages when needed; by saving the defined custom printing templates (including custom logic code and page styles) for future reuse, efficiency can be effectively improved.

[0075] When printing is needed, first select a stored table template, and then specify the data source to be printed. The data source can be a database, file, or other data storage system. When the user triggers the data filling operation (for example, clicking a button or sending an API request), the system will dynamically fill the data into each cell of the table according to the selected data source. This process is dynamic, which means that the content of the table will be updated according to the changes in the data. Finally, the filled data is rendered to the H5 page on the Web. The user can view this page in the browser, and print preview or print directly, or save the H5 page.

[0076] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.

[0077] The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiment. Any equivalent modifications or changes made by those skilled in the art based on the contents disclosed by the present invention should be included in the protection scope recorded in the claims.

Claims

1. A method for printing tabular data, characterized in that: The steps include: Set the open source printing component to be called, pull the component source code and cache it locally; A first keyword is set, and a position in the component source code where the custom logic code can be inserted is located by using the first keyword, and routing information and calling instructions of the custom logic code are inserted at the position; A second keyword is set, and a position in the component source code where the custom page style can be inserted is located by using the second keyword, and routing information and calling instructions of the custom page style are inserted at the position; Setting a custom list, maintaining newly added custom print setting parameters through the custom list, and further setting a binding relationship between the newly added custom print setting parameters and the table code elements of the web-side table data; Setting a template library, setting at least one template rule for the newly added custom printing setting parameter, wherein the template rule records a custom table code element for replacing a table code element of the web-side table data; Determine the required custom logic code and the required custom page style by adjusting the template rules; Determine the application scope of template rules in the table through custom lists; According to the application scope and template rules, the original information in the table data is replaced with custom logic code and / or custom page style, and the cached replaced table data is a custom printing template.

2. A method for printing table data according to claim 1, characterized in that: Also includes: Call the custom printing template and set the table data object to be printed; Generate basic tables through custom logic code and / or custom page styles; Fill the form with data to be printed; Preview the form and data to be printed; Output print information to the print list.

3. A method for printing table data according to claim 1, characterized in that: The custom logic code includes by default: Set the data binding relationship, the default is to bind to a custom data source; Calculate statistical values. By default, the values ​​in the specified cell list are added up. The cell list must contain at least two cells. Dynamic table parameters, by default, include: offset and offset reference, fixed row width and height information, fixed row and column information, and the number of printable rows per page.

4. A method for printing table data as claimed in claim 1, characterized in that: The custom page styles include by default: Customize column width and column width effective range. By default, each column is modified to the custom column width. Customized table header name. By default, a custom table header name is assigned one by one according to the column number. If the custom table header name is not empty, you need to specify its binding relationship with the data source. The blank information includes by default: the width and height information of the blank area and the effective range.

5. A method for printing table data according to claim 1, characterized in that: In response to the received print preview operation, the printing effect of the basic table is first previewed, and then in response to the received data filling operation, each cell in the basic table is dynamically updated to fill the data to be printed into each cell.

6. A method for printing table data as claimed in claim 5, characterized in that: Also includes: The basic table is stored as a table template. First, the table template is selected, then the data source is selected, and then in response to the received data filling operation, each cell in the basic table is dynamically updated, and the data to be printed is filled into each cell to generate the web-side H5 page.