Data exporting method, device and equipment based on rich text editor

By receiving and processing data insertion and style setting instructions in a rich text editor, and generating and converting data export templates, the problem of fixed data export styles in the prior art is solved, and the adaptation of diversity and user-defined needs is achieved.

CN119415580APending Publication Date: 2025-02-11QINGDAO HISENSE TRANS TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411268248.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The prior art cannot meet users' diverse needs for data export styles, and the template style is fixed and cannot be edited.

Method used

Adopt the data export method based on the rich text editor, by receiving data insertion instructions and data style setting instructions, displaying and setting data content in the rich text editor, generating a data export template, and converting it into HTML source code to adapt to different documents Format.

Benefits of technology

It realizes the diversity and flexibility of data export styles, adapts to user custom style needs, and improves the efficiency and user experience of data export.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415580A_ABST
    Figure CN119415580A_ABST
Patent Text Reader

Abstract

The invention discloses a data exporting method, device and equipment based on a rich text editor, after a data insertion instruction is received, data content is displayed at an insertion position in the rich text editor according to information carried in the data insertion instruction, after a data style setting instruction is received, style setting is carried out on the data content according to a carried target style, and the data content is exported. And generating a data export template. And converting the data export template into a hypertext markup language (HTML) source code, and when a data export instruction is received, converting the HTML source code into a data file in a target document format according to the target document format carried in the data export instruction and exporting the data file. According to the method and the device, based on the rich text editor, a user can input the data insertion instruction and the data style setting instruction to the electronic equipment in a self-defined manner, so that the data export template is designed in a self-defined manner according to user requirements. And generating and exporting a data file in a target document format according to a user demand. And data export adaptive to user-defined requirements is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data export method, device and equipment based on a rich text editor. Background Art

[0002] With the continuous update of electronic applications, more and more people rely on the Internet, which has brought great convenience to our lives. Various functions are becoming more and more powerful, and users have also put forward various requirements for their own convenience. When we encounter business scenarios of editing reports in our work, there are often a large number of reports with the same format but different data. Business personnel need to edit them one by one, which consumes a lot of time. Therefore, this can be solved by editing report templates and dynamically loading data.

[0003] In the related art, one or more templates are generally pre-set, a template is selected according to the dynamic data to be exported, and the export method is written in Java to dynamically replace the variable data and template in the template to achieve data export. The technical problem of the related art is that the template style is fixed and cannot be edited. With the user's diversified data export requirements for multiple templates, the related art can no longer meet user needs, so it is necessary to provide a data export solution that adapts to user needs. Summary of the invention

[0004] The present application provides a data export method, apparatus and device based on a rich text editor to solve the problem of how to increase the diversity of data export styles and adapt data export to user-defined style requirements.

[0005] In a first aspect, the present application provides a data export method based on a rich text editor, the method comprising:

[0006] receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0007] Receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0008] The data export template is converted into a Hypertext Markup Language HTML source code. When a data export instruction is received, the HTML source code is converted into a data file in the target document format according to the target document format carried in the data export instruction and exported.

[0009] In a second aspect, the present application provides a data export device based on a rich text editor, the device comprising:

[0010] A data insertion module, configured to receive a data insertion instruction, and display the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0011] A template generation module, used to receive a data style setting instruction, perform style setting on the data content according to a target style carried in the data style setting instruction, and generate a data export template;

[0012] The data export module is used to convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, the HTML source code is converted into a data file in the target document format and exported according to the target document format carried in the data export instruction.

[0013] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0014] Memory, used to store computer programs;

[0015] The processor is used to implement the data export method based on the rich text editor when executing the program stored in the memory.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data export method based on the rich text editor is implemented.

[0017] The present application provides a data export method, apparatus and device based on a rich text editor, the method comprising: receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor; receiving a data style setting instruction, and setting the style of the data content according to the target style carried in the data style setting instruction to generate a data export template; converting the data export template into a hypertext markup language HTML source code, and when receiving a data export instruction, converting the HTML source code into a data file in the target document format according to the target document format carried in the data export instruction and exporting it.

[0018] The above technical solution has the following advantages or beneficial effects:

[0019] In the present application, the electronic device uses a rich text editor as a template designer, and edits the template content through the template designer. The rich text editor is a user interface tool that can intuitively edit and layout to facilitate user operation. After the electronic device receives the data insertion instruction, it displays the data content at the insertion position in the rich text editor according to the information carried therein. The electronic device receives the data style setting instruction, and sets the style of the data content according to the target style carried in the data style setting instruction, that is, sets the style of the data content to the target style, and then generates a data export template. The data export template is converted into a hypertext markup language HTML source code. When the data export instruction is received, the HTML source code is converted into a data file in the target document format and exported according to the target document format carried therein. In the present application, based on the rich text editor, the user can customize the input of the data insertion instruction and the data style setting instruction to the electronic device, thereby realizing the custom design of the data export template according to the user's needs. And the target document format can be customized, and the electronic device generates and exports the data file in the target document format according to the user's needs. The data export scheme provided in the present application improves the diversity of data export styles and realizes data export that adapts to user customization needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 A schematic diagram of the first data export process based on a rich text editor provided for this application;

[0022] Figure 2 A schematic diagram of the second data export process based on a rich text editor provided for this application;

[0023] Figure 3 A schematic diagram of the third data export process based on a rich text editor provided for this application;

[0024] Figure 4 A schematic diagram of the fourth data export process based on a rich text editor provided for this application;

[0025] Figure 5 A fifth data export process diagram based on a rich text editor provided for this application;

[0026] Figure 6 A diagram of the configuration of the rich text editor provided for this application;

[0027] Figure 7 Schematic diagram of the parsed source code provided for this application;

[0028] Figure 8 Schematic diagram of data export provided for this application;

[0029] Fig. 9 A schematic diagram of the structure of a data export device based on a rich text editor provided in this application;

[0030] Fig.10 This is a schematic diagram of the electronic device structure provided in this application. DETAILED DESCRIPTION

[0031] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0032] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0033] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0034] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0035] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0036] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0037] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.

[0038] This application takes into account the business scenarios of editing reports encountered in our work. There are often a large number of reports with the same format but different data. Business personnel need to edit them one by one, which consumes a lot of time. Therefore, it can be solved by editing the report template and dynamically loading data. There are two main existing solutions: 1) Editing the template through the back-end template method. The disadvantage is that it cannot be edited visually, the template syntax is complex to use and the learning cost is high, which is not suitable for general users; 2) The front-end template supports relatively simple content, and the template content does not support inserting existing echarts charts and tables in the project; loop statements, conditional statements and other forms.

[0039] In order to solve the above problems, this application proposes a data export solution based on a rich text editor. This application uses a rich text editor as a report designer. The template content is edited through the report designer. The content can be dynamically configured by dragging and dropping, and automatically converted into code for processing and compilation. The data is assigned dynamically and then exported. The rich text editor is a user interface tool that can intuitively edit and format for user convenience.

[0040] This application template is easy to configure: you can quickly build a template without relying too much on professional development knowledge. The rich text editor supports setting the template style through configuration, and then lowers the usage threshold by building common statements into the rich text editor, dragging echarts charts into the rich text editor, etc. Template writing does not require coding basics, and supports online editing and previewing. The template layout is flexible: it supports online editing and modification, and can preview the export effect in real time; the template content is rich: it supports loop statements, conditional statements, variables; the template supports multiple statements such as loops and if, and multiple statements are built into the rich text editor. You can select them, and the template not only includes text and multiple elements such as charts, tables, pictures, etc., but also can directly introduce echarts charts generated by the existing low-code platform in the project as template content.

[0041] In order to realize the use of a rich text editor as a report designer, this application converts the report designer template content into code form for processing and exports after data assignment. First, configure the rich text editor, which is configured to have the ability to select page charts, support variables, loops and other statements. Then configure the template: introduce the echarts chart in the project by dragging and dropping in the template; configure the template format through the rich text editor style setting menu, and then arrange the content by selecting the built-in loops and conditional statements. Parse the template again: parse the template content generated by the rich text editor into source code, and parse the variables, loops, pictures, and tables in the source code according to custom parsing rules; support real-time data acquisition: set the data replacement symbol in the position to be filled in the template, and the data replacement symbol corresponds to the data one by one. Finally export the word document.

[0042] Figure 1 The first data export process based on the rich text editor provided in this application is a schematic diagram, and the process includes the following steps:

[0043] S101: receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0044] S102: receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0045] S103: Convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, convert the HTML source code into a data file in the target document format according to the target document format carried in the data export instruction and export it.

[0046] The data export method based on the rich text editor provided in the present application is applied to an electronic device, which may be a terminal device such as a PC, a smart phone, a computer, or a server.

[0047] The electronic device is equipped with a rich text editor. As a user interface tool, the user can intuitively edit and layout the design template in the rich text editor. The rich text editor is, for example, the WangEditor rich text editor. The user can enter the data insertion instruction in the rich text editor, the data content carried in the data insertion instruction and the insertion position in the rich text editor. Optionally, the user can enter the data content in the rich text editor, and the input position clicked by the user is the insertion position of the data content carried in the data insertion instruction in the rich text editor, and the data content entered by the user is the data content carried in the data insertion instruction. Optionally, for the fixed data content in the template, each data content can also be configured in the rich text editor in advance, and the user can select a data content and drag it to the insertion position in the rich text editor, and the data content is displayed at the insertion position in the rich text editor. Alternatively, the user can select a data content by clicking, and then click the operation at the insertion position of the rich text editor, so that the position corresponding to the second click operation is used as the insertion position of the data content, and the data content selected by the first click operation is displayed at the insertion position in the rich text editor.

[0048] It should be noted that this application does not limit the number and content of data content. Optionally, a data content and the corresponding data insertion position can be carried in a data insertion instruction; multiple data contents and their corresponding data insertion positions can also be carried in a data insertion instruction. In addition, the picture library and hyperlink library can also be configured in the rich text editor, and users can customize the pictures selected from the picture library to be inserted, and customize the hyperlinks selected from the hyperlink library to be inserted. Pictures, hyperlinks, text, charts, etc. are all data content.

[0049] The rich text editor includes a style setting menu. The user sends a data style setting instruction to the electronic device by selecting a setting style in the style setting menu. The style selected by the user in the style setting menu is used as the target style carried in the data style setting instruction. The style of each data content is customized based on the style setting menu. Among them, the style setting menu includes but is not limited to options such as font style, paragraph style, color style, font size style, etc. You can customize the font style in the font style option. The font style options include but are not limited to Kaiti, Songti, Heiti, Fangsong, Cartoon, Ancient Style, Traditional Chinese and other fonts. Users only need to select the font they want to set in the font style options. You can customize the paragraph style in the paragraph style options. The paragraph style options include but are not limited to indentation, alignment, line spacing, paging and other options. Users only need to select the paragraph style they want to set in the paragraph style options.

[0050] The data style setting instruction is for each piece of data content, that is, the user can customize the style setting for each piece of data content. The data style setting instruction is received, and the data content is styled according to the target style carried in the data style setting instruction to generate a data export template.

[0051] The generated data export template can be converted into a Hypertext Markup Language HTML source code through a rich text editor. When a data export instruction is received, a data file is generated based on the HTML source code and exported. Optionally, the data export instruction can carry a target document format, which can be a word format, a PDF format, an EXCEL format, etc. The electronic device can use a conversion tool corresponding to the target document format to convert the HTML source code into a data file in the target document format and export it.

[0052] Optionally, when exporting a data file, a preview version can be generated first. If the preview version is correct, the data file can be exported after receiving the user's export instruction. After the preview version is generated, an export button can be displayed on the display interface. When the user clicks the export button, the electronic device determines that the user's export instruction has been received. In addition, an instruction input box can also be displayed on the display interface. When the user enters "export" or "confirm" and other content in the instruction input box, the electronic device determines that the user's export instruction has been received. Preferably, relevant prompt words used to characterize confirmation of export and relevant prompt words for confirmation of non-export can be pre-specified. After the user clicks the instruction input box, the above-mentioned relevant prompt words appear in the drop-down menu of the instruction input box, and then the user can select the relevant prompt words in the drop-down menu. The electronic device determines whether to export the data based on the relevant prompt words selected by the user.

[0053] In the present application, the electronic device uses a rich text editor as a template designer, and edits the template content through the template designer. The rich text editor is a user interface tool that can intuitively edit and layout to facilitate user operation. After the electronic device receives the data insertion instruction, it displays the data content at the insertion position in the rich text editor according to the information carried therein. The electronic device receives the data style setting instruction, and sets the style of the data content according to the target style carried in the data style setting instruction, that is, sets the style of the data content to the target style, and then generates a data export template. The data export template is converted into a hypertext markup language HTML source code. When the data export instruction is received, the HTML source code is converted into a data file in the target document format and exported according to the target document format carried therein. In the present application, based on the rich text editor, the user can customize the input of the data insertion instruction and the data style setting instruction to the electronic device, thereby realizing the custom design of the data export template according to the user's needs. And the target document format can be customized, and the electronic device generates and exports the data file in the target document format according to the user's needs. The data export scheme provided in the present application improves the diversity of data export styles and realizes data export that adapts to user customization needs.

[0054] In the present application, according to the data content carried in the data insertion instruction and the insertion position in the rich text editor, displaying the data content at the insertion position in the rich text editor includes:

[0055] If the data insertion instruction is a text data insertion instruction, displaying the text data content at the first insertion position in the rich text editor according to the text data content carried in the text data insertion instruction and the first insertion position in the rich text editor;

[0056] If the data insertion instruction is a chart data insertion instruction, the chart data content is displayed at the second insertion position in the rich text editor based on the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor; wherein the chart data content includes a chart style and chart identification information.

[0057] The data content carried in the data insertion instruction includes text data content and chart data content. The text data content includes data content such as text, numbers, and characters, and the chart data content includes echarts charts.

[0058] For the text data content, according to the text data content carried in the text data insertion instruction and the first insertion position in the rich text editor, the text data content is displayed at the first insertion position in the rich text editor. Optionally, the text data insertion instruction is sent to the electronic device by inputting the text data content, dragging the text data content, or clicking the text data content.

[0059] For the chart data content, according to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor, the chart data content is displayed at the second insertion position in the rich text editor; wherein the chart data content includes chart style and chart identification information. Taking echarts charts as an example, chart styles are, for example, line charts, bar charts, scatter plots, pie charts, candlestick charts, box plots for statistics, maps for geographic data visualization, heat maps, line charts, relationship diagrams for relationship data visualization, treemaps, parallel coordinates for multidimensional data visualization, and funnel charts and dashboards for BI, and support for mixing and matching between charts. Optionally, a chart library can be configured in the rich text editor, and a chart data insertion instruction can be sent to the electronic device by dragging the chart data content in the chart library list or clicking the chart data content.

[0060] In the present application, displaying the text data content at the first insertion position in the rich text editor includes:

[0061] If the text data content includes a variable to be inserted, displaying the text data content at the first insertion position in the rich text editor, and inserting a data replacement symbol corresponding to the dynamic data at the variable position in the text data content;

[0062] After converting the data export template into HTML source code and before converting the HTML source code into a data file in the target document format and exporting it, the method further includes:

[0063] Determine the query statement corresponding to the text data content in the HTML source code and the data replacement symbol in the text data content; obtain the dynamic data corresponding to the variable from the database according to the query statement, and use the dynamic data to replace the data replacement symbol.

[0064] For the text data content containing the variable to be inserted, after the text data content is displayed at the first insertion position in the rich text editor, the variable position in the text data content is determined, and then the data replacement symbol corresponding to the dynamic data is inserted at the variable position. The data export template thus generated contains the text data content and the data replacement symbol. After the dynamic data corresponding to the variable is subsequently obtained, the corresponding data replacement symbol is replaced with the dynamic data, and then the data is exported.

[0065] After the data export template is converted into HTML source code, the query statement corresponding to the text data content in the HTML source code and the data replacement symbol in the text data content are determined. Different text data contents correspond to different query statements. According to the query statement, the dynamic data corresponding to the variable in the database can be queried, and then the data replacement symbol in the text data content is replaced by the dynamic data, so that the complete text data content can be obtained. Then the HTML source code is converted into a data file in the target document format and exported, so that the exported data file contains the dynamic data in the text data content, that is, contains the complete text data content. The query statement includes a structured query language sql statement.

[0066] Figure 2 A second data export process diagram based on a rich text editor provided in this application includes the following steps:

[0067] S201: receiving a text data insertion instruction, and if the text data content includes a variable to be inserted, displaying the text data content at the first insertion position in the rich text editor, and inserting a data replacement symbol corresponding to the dynamic data at the variable position in the text data content;

[0068] S202: receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0069] S203: Convert the data export template into a Hypertext Markup Language HTML source code, determine the query statement corresponding to the text data content in the HTML source code and the data replacement symbol in the text data content; obtain the dynamic data corresponding to the variable from the database according to the query statement, and replace the data replacement symbol with the dynamic data; when receiving a data export instruction, convert the HTML source code into a data file in the target document format according to the target document format carried in the data export instruction and export it.

[0070] In the present application, displaying the text data content at the first insertion position in the rich text editor includes:

[0071] If the text data content contains variables, when a variable screening instruction is received, the text data content is displayed at the first insertion position according to the variable screening condition carried in the variable screening instruction, and a data replacement symbol corresponding to the dynamic data is inserted at the variable position in the text data content, and a variable screening identifier corresponding to the variable screening condition is inserted at the starting position of the text data content;

[0072] After converting the data export template into HTML source code and before converting the HTML source code into a data file in the target document format and exporting it, the method further includes:

[0073] Determine a filter statement corresponding to the variable filter identifier in the HTML source code, a query statement corresponding to the text data content, and a data replacement symbol in the text data content; obtain candidate dynamic data corresponding to the variable from a database according to the query statement, filter the candidate dynamic data according to the filter statement, determine target dynamic data that meets the variable filter condition, and replace the data replacement symbol with the target dynamic data.

[0074] In this application, if the text data content contains variables, the user can also input variable filtering instructions to the electronic device. Taking the text data content of a class of students as an example, the variables included include the student's name and gender. Through the variable filtering instruction, determine to filter out the names and genders of students in a class that meet the filtering conditions. For example, the variable filtering condition carried in the variable filtering instruction is to filter out students with male gender. After the names and genders of all students in a class in the database are queried according to the query statement corresponding to the text data content, the names and genders of students with male gender are replaced with data replacement symbols. In addition, it can also be instructed to obtain the names and genders of all students in a class in the database and replace the data replacement symbol.

[0075] When a variable filtering instruction is received, the variable filtering condition carried in the variable filtering instruction is obtained, the text data content is displayed at the first insertion position, and a data replacement symbol corresponding to the dynamic data is inserted at the variable position in the text data content, and a variable filtering identifier corresponding to the variable filtering condition is inserted at the starting position of the text data content. The variable filtering condition can generally be parsed into filtering statements such as loop statements or conditional statements in the HTML source code. When inserting a variable filtering identifier in a rich text editor, the correspondence between different variable filtering identifiers and statements in the HTML source code can be pre-specified. For example, the variable filtering identifier "#" represents a loop statement, and the variable filtering identifier " / " represents a conditional statement, etc.

[0076] When converting the data export template to HTML source code, the rich text editor can convert it into a loop statement based on the variable filtering identifier "#", and can convert it into a conditional statement based on the variable filtering identifier " / ". According to the query statement, the candidate dynamic data corresponding to the variable is obtained from the database, and then the candidate dynamic data is filtered according to the loop statement or conditional statement. The candidate dynamic data that meets the variable filtering conditions is used as the target dynamic data, and the data replacement symbol is replaced with the target dynamic data. Then the HTML source code is converted into a data file in the target document format and exported. In this way, the exported data file contains the target dynamic data corresponding to the user's filtering conditions in the text data content. This further improves the customization and flexibility of data export.

[0077] Figure 3 A third data export process diagram based on a rich text editor provided in this application includes the following steps:

[0078] S301: receiving a text data insertion instruction, and if the text data content includes a variable to be inserted, when receiving a variable screening instruction, displaying the text data content at the first insertion position according to the variable screening condition carried in the variable screening instruction, inserting a data replacement symbol corresponding to the dynamic data at the variable position in the text data content, and inserting a variable screening identifier corresponding to the variable screening condition at the starting position of the text data content;

[0079] S302: receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0080] S303: Convert the data export template into a Hypertext Markup Language HTML source code, determine the filter statement corresponding to the variable filter identifier in the HTML source code, the query statement corresponding to the text data content, and the data replacement symbol in the text data content; according to the query statement, obtain the candidate dynamic data corresponding to the variable from the database, filter the candidate dynamic data according to the filter statement, determine the target dynamic data that meets the variable filtering condition, and replace the data replacement symbol with the target dynamic data; when receiving a data export instruction, according to the target document format carried in the data export instruction, convert the HTML source code into a data file in the target document format and export it.

[0081] In this application, if the data export template contains a chart, converting the HTML source code into a data file in the target document format and exporting it includes:

[0082] Determine the chart identification information in the HTML source code, and determine the chart statistical data corresponding to the chart identification information according to the pre-saved correspondence between the chart identification information and the chart statistical data;

[0083] According to the chart style and the chart statistical data, a data file containing chart data in the target document format is determined and exported.

[0084] The chart identification information is, for example, the unique serial number of the chart. The electronic device pre-saves the correspondence between the chart identification information and the chart statistical data, and displays the chart data content including the chart style and the chart identification information in the rich text editor. The chart style can be represented by different placeholders, for example, the placeholders for bar charts and pie charts are different. Optionally, if the chart style is fixed for the chart, the chart identification information can be displayed only in the rich text editor, and the candidate can determine the corresponding chart statistical data and chart style based on the chart identification information when exporting data.

[0085] In the process of converting HTML source code into a data file in the target document format and exporting it, the processing process for the chart is to determine the chart statistical data corresponding to the chart identification information according to the chart identification information in the HTML source code and the correspondence between the pre-saved chart identification information and the chart statistical data; then determine the chart style, generate chart data corresponding to the chart style according to the chart statistical data, determine the data file containing the chart data in the target document format and export it. Thus, the export of chart data content is realized.

[0086] In the present application, displaying the chart data content at the second insertion position in the rich text editor according to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor includes:

[0087] Acquire the chart format carried in the chart data insertion instruction and the target chart format supported by the rich text editor; if the chart format is different from the target chart format, convert the chart format to the target chart format;

[0088] According to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor, the chart data content in the target chart format is displayed at the second insertion position in the rich text editor.

[0089] For example, the echarts chart format supported by the rich text editor is base64 format, that is, the rich text editor supports rendering base64-encoded images. If the format of the inserted echarts chart is base64 format, there is no need to convert the format of the inserted echarts chart. If the format of the inserted echarts chart is not base64 format, that is, the format of the inserted echarts chart is different from the supported echarts chart format, the inserted echarts chart will be converted to base64 format, and then the chart data content of the target chart format will be displayed at the second insertion position in the rich text editor, that is, the chart data content in base64 format will be displayed. This ensures the subsequent correct export of the echarts chart.

[0090] In the present application, before receiving the data insertion instruction, the method further includes:

[0091] Receive an insert chart configuration instruction, configure a chart function button in the toolbar of the rich text editor according to the insert chart configuration instruction; and configure the chart library carried in the insert chart configuration instruction into a selection list of the chart function button;

[0092] Receive a variable filtering configuration instruction, configure a variable filtering function button in the toolbar of the rich text editor according to the variable filtering configuration instruction; and configure each variable filtering identifier carried in the variable filtering configuration instruction into a selection list of the variable filtering function button.

[0093] Among them, the rich text editor supports customizing the Toolbar toolbar, allowing users to configure the buttons of the toolbar according to their own needs and define the button behavior. Therefore, based on the Toolbar toolbar of the rich text editor, you can customize the configuration of chart function buttons, variable filtering function buttons, etc. When receiving the insert chart configuration instruction, configure the chart function button in the toolbar of the rich text editor according to the insert chart configuration instruction; and configure the chart library carried in the insert chart configuration instruction to the selection list of the chart function button, providing a prerequisite for the subsequent insertion of the chart by dragging and dropping. When receiving the variable filtering configuration instruction, configure the variable filtering function button in the toolbar of the rich text editor according to the variable filtering configuration instruction; and configure each variable filtering identifier carried in the variable filtering configuration instruction to the selection list of the variable filtering function button. Provide a prerequisite for the subsequent insertion of variable filtering identifiers before the text data content.

[0094] Figure 4 A fourth data export process diagram based on a rich text editor provided in this application includes the following steps:

[0095] S401: receiving an insert chart configuration instruction, configuring a chart function button in the toolbar of the rich text editor according to the insert chart configuration instruction; and configuring the chart library carried in the insert chart configuration instruction into a selection list of the chart function button;

[0096] S402: receiving a variable filtering configuration instruction, configuring a variable filtering function button in the toolbar of the rich text editor according to the variable filtering configuration instruction; and configuring each variable filtering identifier carried in the variable filtering configuration instruction to a selection list of the variable filtering function button;

[0097] S403: receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0098] S404: receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0099] S405: Convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, convert the HTML source code into a data file in the target document format according to the target document format carried in the data export instruction and export it.

[0100] In the present application, converting the HTML source code into a data file in the target document format and exporting the data file includes:

[0101] A target document format framework is created using a document conversion tool, and based on the target document format framework, the HTML source code is converted into a data file in the target document format and exported; wherein the target document format framework includes a word format framework, a PDF format framework, or an EXCEL format framework.

[0102] In this application, the target document format framework includes a word format framework or a PDF format framework or an EXCEL format framework. Different target document format frameworks correspond to different document conversion tools. Taking the word format framework as an example, the document conversion tool can be an html-docx-js tool. The html-docx-js tool has the ability to convert HTML source code to word. Use the html-docx-js tool to create a word format framework, and convert the HTML source code into a word format data file based on the word format framework and export it.

[0103] Figure 5A fifth data export process diagram based on a rich text editor provided in this application includes the following steps:

[0104] S501: receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0105] S502: receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template;

[0106] S503: Convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, create a target document format framework using a document conversion tool according to the target document format carried in the data export instruction, and convert the HTML source code into a data file in the target document format based on the target document format framework and export it; wherein the target document format framework includes a word format framework, a PDF format framework, or an EXCEL format framework.

[0107] In this application, commonly used loop statements, conditional statements, and variables can be configured in the rich text editor, and users can customize selection statements. Customize data content through the style setting menu of the rich text editor to generate a data export template. In addition, for the variable position in the data export template, set the data replacement symbol corresponding to the dynamic data at the variable position.

[0108] The generated data export template can be converted into source code through a rich text editor, and the source code format is Hypertext Markup Language HTML. In the source code, the sql statements, loop statements, conditional statements and data replacement symbols corresponding to the data content containing the variables exist in different forms. According to the difference in the forms of the sql statements, loop statements, conditional statements and data replacement symbols corresponding to the data content containing the variables, the sql statements, loop statements, conditional statements and data replacement symbols in the source code can be determined. By parsing the loop statements and conditional statements, the variable screening conditions can be determined. By parsing the sql statements, the candidate dynamic data corresponding to the variables in the database can be determined. The candidate dynamic data is screened according to the variable screening conditions to determine the target dynamic data, and the target dynamic data is used to replace the data replacement symbol, and then the data export process is performed. Among them, taking the export of word format data files as an example, html-docx-js is a JavaScript library that can convert HTML content into word document format, so data files can be exported through html-docx-js.

[0109] In order to improve the richness of the data export template, in this application, based on the rich text editor, the echarts chart is inserted by dragging and dropping; thereby increasing the richness of the data export template.

[0110] The echarts chart list can be displayed in the rich text editor. The echarts chart list displays the identification information of each echarts chart in the echarts chart library. For the echarts chart that the user wants to insert, select the identification information of the echarts chart to be inserted in the echarts chart list, and then drag it to the insertion position in the rich text editor, so as to insert the echarts chart by dragging and dropping based on the rich text editor. In addition, the text data content is customized through the style setting menu of the rich text editor; the text data content customization includes the font style, paragraph format, insert picture and insert hyperlink customization. Finally, a data export template is generated based on the inserted echarts chart and the customized data content. In this way, the data export template includes the customized font style, paragraph format, insert picture and insert hyperlink, as well as the inserted echarts chart. Thereby enriching the data export template, and realizing that the data export template can introduce the echarts chart generated by the low-code platform.

[0111] In order to insert an echarts chart by dragging and dropping, optionally, according to the input identification information of the echarts chart, search for the echarts chart to be inserted from the echarts chart list; insert the echarts chart into the rich text editor by dragging and dropping; wherein, determine the insertion position of the echarts chart in the rich text editor, and insert an img tag placeholder at the position; when converting HTML later, it can be determined that the current position is an echarts chart according to the img tag placeholder. Determine the storage address information of the statistical data corresponding to the echarts chart in the database, record the chart identification information in the data address src attribute of the img tag placeholder, and save the corresponding relationship between the chart identification information and the storage address information of the statistical data in the database, so as to provide a prerequisite for the subsequent export of the echarts chart based on the chart identification information.

[0112] In the present application, the rich text editor includes an input box for the identification information of the echarts chart, and the user can enter the identification information of the echarts chart to be inserted in the input box. The electronic device searches for the echarts chart to be inserted from the echarts chart list list according to the identification information of the input echarts chart, and then displays the searched echarts chart to be inserted in the drop-down menu of the input box. The user clicks to select the echarts chart to be inserted in the drop-down menu, and then inserts the echarts chart into the rich text editor by dragging. Wherein, the insertion position of the echarts chart in the rich text editor is determined according to the target position dragged by the user, and then the img tag placeholder is inserted at the insertion position. The img tag placeholder is displayed in the data export template in this way. In order to realize the correct display of the echarts chart when exporting data, the storage address information of the statistical data corresponding to the echarts chart in the database is determined, and the data address src attribute of the img tag placeholder is recorded. The chart identification information is recorded, and the corresponding relationship between the chart identification information and the storage address information of the statistical data in the database is saved, and the export of the echarts chart based on the chart identification information is realized later. Provide a prerequisite. In this way, when exporting data, the chart identification information in the HTML source code is determined, and the chart statistical data corresponding to the chart identification information is determined based on the correspondence between the pre-saved chart identification information and the chart statistical data; based on the chart style and chart statistical data, the data file containing the chart data in the target document format is determined and exported.

[0113] In order to further ensure that the echarts chart can be displayed normally when data is exported, in this application, the echarts chart format supported by the rich text editor is obtained; if the format of the inserted echarts chart is different from the supported echarts chart format, the inserted echarts chart is converted to the supported echarts chart format; the supported echarts chart format is assigned to the chart format attribute of the img tag placeholder.

[0114] For example, the echarts chart format supported by the rich text editor is base64, that is, the rich text editor supports rendering base64-encoded images. If the format of the inserted echarts chart is base64, there is no need to convert the format of the inserted echarts chart. If the format of the inserted echarts chart is not base64, that is, the format of the inserted echarts chart is different from the supported echarts chart format, the inserted echarts chart will be converted to base64 format, and the chart format attribute of the img tag placeholder is assigned the supported echarts chart format. In this way, when exporting data, the rich text editor can be determined to render the echarts chart according to the echarts chart format supported by the rich text editor assigned to the chart format attribute of the img tag placeholder, ensuring the correct display of the echarts chart.

[0115] In this application, before customizing the template style through the style setting menu of the rich text editor, based on the Toolbar toolbar of the rich text editor, the function buttons of echarts charts, supported variables, loop statements, and conditional statements are customized and selected; the functions of the rich text editor are configured based on the function buttons.

[0116] Select the function buttons of echarts charts, support variables, loop statements, and conditional statements, and configure the functions of selecting echarts charts, supporting variables, loop statements, and conditional statements in the rich text editor based on the function buttons. Variables, loop statements, conditional statements, and echarts chart libraries are built into the rich text editor through function buttons. Users can add different loop statements by selecting the Insert Loop Statement button, add different conditional statements by selecting the Insert Conditional Statement button, and add echarts chart libraries by selecting the Insert echarts Chart button. In this way, the rich text editor is configured to have the ability to select echarts charts, support variables, loop statements, and conditional statements. Provide prerequisites for the subsequent insertion of echarts charts by dragging and dropping based on the rich text editor, and for data export based on the rich text editor.

[0117] The following is a detailed description of the data export process based on the rich text editor, combined with the schematic diagram of generating a data export template and exporting data based on the data export template.

[0118] The data export process based on the rich text editor of this application includes the following five steps:

[0119] Step 1: The rich text editor is configured to have the ability to select loop statements, conditional statements, ehcarts charts, etc. Figure 6 The rich text editor configuration diagram provided for this application takes WangEditor as an example. WangEditor supports customizing the Toolbar toolbar, allowing users to configure toolbar buttons and define button behaviors according to their needs. Therefore, variables, loop statements, and conditional statements can be built into the editor, and users can add different statements by selecting buttons. Figure 6 As shown in the figure, you can customize the button for inserting loop statements in the Toolbar of the rich text editor. The process of configuring the ability to select conditional statements, ehcarts charts, etc. is similar and will not be repeated here.

[0120] Step 2: The data export template text source code is created by a rich text editor in HTML format.

[0121] Step 3: Parse the data export template content generated by the rich text editor into source code, and parse the variables, loop statements, conditional statements, pictures, tables, etc. in the source code according to the custom parsing rules.

[0122] Step 4: Identify parameter variables based on the data replacement symbol, convert them into database query statements and execute them, obtain data from the data source and replace the data replacement symbol on the report template file.

[0123] Figure 7 The schematic diagram of the parsing source code provided for this application is as follows: Figure 7 As shown in the figure, the array named students is queried through SQL. The Mustache template engine will traverse the "students" array, render the template once for each element, and then concatenate all the results. Figure 7 “Name: 1-1; Name: 2-2; …; Name: Wang Wei-male” in the text box. Figure 7 The "1-1; 2-2; ...; Wang Wei-male" and so on are all dynamic data obtained from the database according to SQL statements.

[0124] Step 5: Convert the data export template content into a word format framework; then export it through FileSaver.

[0125] html-docx-js is a JavaScript library that can convert HTML content to Word (.docx) format.

[0126] For example: let html = ' <h1> Hello World< / h1> This is a paragraph. ';

[0127] Let docx = htmlDocx.asBlob(html); / / Convert HTML (template) to Word format.

[0128] Figure 8 The data export diagram provided for this application is as follows: Figure 8 As shown, the list of data charts of published applications includes: Application July 29, 2024 Chart, Sample Application-Do Not Move Chart 1, Face Collection Management, GY0509, Signal Test, GY0302, Ai Sanguojihua, Admin Create Application 319, GY0315, Office Phone Management, GY Chinese Environment 0314, New Application 3.14lrb. Template writing includes: Laoshan Traffic Police Situation Research and Analysis Report. The text includes "I. October 2023...a year-on-year decrease of 12.89%", and also includes "Chart 1_1803589699102400512". The report preview template includes: Laoshan Traffic Police Situation Research and Analysis Report. The text includes "I. October 2023...a year-on-year decrease of 12.89%", and also includes the correctly displayed bar chart corresponding to "Chart 1_1803589699102400512".

[0129] This application is for users to create report template files: edit the template online through a rich text editor;

[0130] Rich Text Editor is a user interface tool that allows users to create and edit rich text content, such as font style, paragraph formatting, image insertion, hyperlinks, etc. Users can edit and format intuitively.

[0131] Edit template: Set data replacement symbols in the template and specify replacement rules.

[0132] Variable and loop statements: Use the mustache template engine to process variables and loop identifiers. Mustache is a lightweight template engine that is used to insert variables into templates to generate the final text output; variable replacement: Use {{keyName}} for simple variable replacement; loop traversal: Use {{#array}} content {{ / array}} This method can be used to traverse the array and render the corresponding content in each loop.

[0133] The echarts chart is already introduced in the project: the echarts chart itself uses HTML5 Canvas for graphics rendering; the solution is to use the img tag placeholder when editing the template, and assign the echarts chart id to the src of the img; specific implementation: there is an echarts list (ehcarts name and id) in the template page, find the required echarts through search, and drag it to the rich text editor (img placeholder carries the id). For example <img src alt="数据图表_1748174418228600832"> .

[0134] Template parsing: first parse the template content into source code;

[0135] Loops and variables: Use the mustache template engine to process variables and loop identifiers, obtain the data of the current word report to be generated, and replace the data replacement symbol on the report template file.

[0136] Echarts chart: After traversing the template to find the img identifier, convert the echarts chart to base64 format (the rich text editor supports rendering base64-encoded images). Implementation idea: The echarts placeholder img in the template has a unique identifier id. Query the Echarts chart (canvas format) according to the identifier, convert it to base64 format, and assign it to the img tag.

[0137] Export: Convert HTML content to a Word format framework through html-docx-js; then export through FileSaver. html-docx-js is a JavaScript library that can convert HTML content to Word (.docx) files. To create a complete Word document using html-docx-js, you need to import the library first, then use the functions it provides to convert HTML content to Blob, and then save the generated file through FileSaver.js.

[0138] html-docx-js image processing: html-docx-js supports processing base64-encoded images and embedding them into the generated Word document. Let blob = htmlDocx.asBlob().

[0139] FileSaver: FileSaver.js is a solution for saving files on the client side, which can export in Blob format; implementation method: saveAs(blob,fileName).

[0140] Fig. 9The schematic diagram of the data export device structure based on the rich text editor provided for this application includes:

[0141] A data insertion module 91 is used to receive a data insertion instruction, and display the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor;

[0142] The template generation module 92 is used to receive a data style setting instruction, perform style setting on the data content according to a target style carried in the data style setting instruction, and generate a data export template;

[0143] The data export module 93 is used to convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, the HTML source code is converted into a data file in the target document format and exported according to the target document format carried in the data export instruction.

[0144] The data insertion module 91 is specifically used for displaying the text data content at the first insertion position in the rich text editor according to the text data content carried in the text data insertion instruction and the first insertion position in the rich text editor if the data insertion instruction is a text data insertion instruction; and for displaying the chart data content at the second insertion position in the rich text editor according to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor if the data insertion instruction is a chart data insertion instruction; wherein the chart data content includes chart style and chart identification information.

[0145] A data insertion module 91, specifically configured to display the text data content at the first insertion position in the rich text editor if the text data content contains a variable to be inserted, and insert a data replacement symbol corresponding to the dynamic data at the variable position in the text data content;

[0146] The data export module 93 is also used to determine the query statement corresponding to the text data content in the HTML source code and the data replacement symbol in the text data content; according to the query statement, the dynamic data corresponding to the variable is obtained from the database, and the dynamic data is used to replace the data replacement symbol.

[0147] The data insertion module 91 is specifically used for, if the text data content contains variables, when receiving a variable screening instruction, displaying the text data content at the first insertion position according to the variable screening condition carried in the variable screening instruction, inserting a data replacement symbol corresponding to the dynamic data at the variable position in the text data content, and inserting a variable screening identifier corresponding to the variable screening condition at the starting position of the text data content;

[0148] The data export module 93 is also used to determine the filter statement corresponding to the variable filter identifier in the HTML source code, the query statement corresponding to the text data content and the data replacement symbol in the text data content; according to the query statement, the candidate dynamic data corresponding to the variable is obtained from the database, the candidate dynamic data is filtered according to the filter statement, the target dynamic data that meets the variable filtering conditions is determined, and the data replacement symbol is replaced with the target dynamic data.

[0149] The data export module 93 is also used to determine the chart identification information in the HTML source code, and determine the chart statistical data corresponding to the chart identification information based on the pre-saved correspondence between the chart identification information and the chart statistical data; based on the chart style and the chart statistical data, determine and export the data file containing the chart data in the target document format.

[0150] The data insertion module 91 is specifically used to obtain the chart format carried in the chart data insertion instruction and the target chart format supported by the rich text editor; if the chart format is different from the target chart format, convert the chart format into the target chart format; according to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor, display the chart data content of the target chart format at the second insertion position in the rich text editor.

[0151] The device also includes:

[0152] The function configuration module 94 is used to receive an insert chart configuration instruction, configure a chart function button in the toolbar of the rich text editor according to the insert chart configuration instruction; and configure the chart library carried in the insert chart configuration instruction to the selection list of the chart function button; receive a variable filtering configuration instruction, configure a variable filtering function button in the toolbar of the rich text editor according to the variable filtering configuration instruction; and configure each variable filtering identifier carried in the variable filtering configuration instruction to the selection list of the variable filtering function button.

[0153] The data export module 93 is specifically used to create a target document format framework using a document conversion tool, and based on the target document format framework, convert the HTML source code into a data file in the target document format and export it; wherein the target document format framework includes a word format framework, a PDF format framework, or an EXCEL format framework.

[0154] The present application also provides an electronic device, such as Fig.10 As shown, it includes: a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604;

[0155] The memory 603 stores a computer program, and when the program is executed by the processor 601, the processor 601 executes any one of the above method steps.

[0156] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0157] The communication interface 602 is used for communication between the electronic device and other devices.

[0158] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0159] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0160] The present application also provides a computer storage readable storage medium, wherein the computer readable storage medium stores a computer program executable by an electronic device, and when the program runs on the electronic device, the electronic device implements any of the above method steps when executing.

[0161] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0162] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data export method based on a rich text editor, characterized in that: The method comprises: receiving a data insertion instruction, and displaying the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor; Receiving a data style setting instruction, performing style setting on the data content according to a target style carried in the data style setting instruction, and generating a data export template; The data export template is converted into a Hypertext Markup Language HTML source code. When a data export instruction is received, the HTML source code is converted into a data file in the target document format according to the target document format carried in the data export instruction and exported.

2. The method according to claim 1, characterized in that According to the data content carried in the data insertion instruction and the insertion position in the rich text editor, displaying the data content at the insertion position in the rich text editor includes: If the data insertion instruction is a text data insertion instruction, displaying the text data content at the first insertion position in the rich text editor according to the text data content carried in the text data insertion instruction and the first insertion position in the rich text editor; If the data insertion instruction is a chart data insertion instruction, the chart data content is displayed at the second insertion position in the rich text editor based on the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor; wherein the chart data content includes a chart style and chart identification information.

3. The method according to claim 2, characterized in that Displaying the text data content at the first insertion position in the rich text editor includes: If the text data content includes a variable to be inserted, displaying the text data content at the first insertion position in the rich text editor, and inserting a data replacement symbol corresponding to the dynamic data at the variable position in the text data content; After converting the data export template into HTML source code and before converting the HTML source code into a data file in the target document format and exporting it, the method further includes: Determine the query statement corresponding to the text data content in the HTML source code and the data replacement symbol in the text data content; obtain the dynamic data corresponding to the variable from the database according to the query statement, and use the dynamic data to replace the data replacement symbol.

4. The method according to claim 2 or 3, characterized in that Displaying the text data content at the first insertion position in the rich text editor includes: If the text data content contains variables, when a variable screening instruction is received, the text data content is displayed at the first insertion position according to the variable screening condition carried in the variable screening instruction, and a data replacement symbol corresponding to the dynamic data is inserted at the variable position in the text data content, and a variable screening identifier corresponding to the variable screening condition is inserted at the starting position of the text data content; After converting the data export template into HTML source code and before converting the HTML source code into a data file in the target document format and exporting it, the method further includes: Determine a filter statement corresponding to the variable filter identifier in the HTML source code, a query statement corresponding to the text data content, and a data replacement symbol in the text data content; obtain candidate dynamic data corresponding to the variable from a database according to the query statement, filter the candidate dynamic data according to the filter statement, determine target dynamic data that meets the variable filter condition, and replace the data replacement symbol with the target dynamic data.

5. The method according to claim 2, characterized in that Converting the HTML source code into a data file in the target document format and exporting the data file comprises: Determine the chart identification information in the HTML source code, and determine the chart statistical data corresponding to the chart identification information according to the pre-saved correspondence between the chart identification information and the chart statistical data; According to the chart style and the chart statistical data, a data file containing chart data in the target document format is determined and exported.

6. The method according to claim 2, characterized in that The step of displaying the chart data content at the second insertion position in the rich text editor according to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor comprises: Acquire the chart format carried in the chart data insertion instruction and the target chart format supported by the rich text editor; if the chart format is different from the target chart format, convert the chart format to the target chart format; According to the chart data content carried in the chart data insertion instruction and the second insertion position in the rich text editor, the chart data content in the target chart format is displayed at the second insertion position in the rich text editor.

7. The method according to claim 1, characterized in that Before receiving the data insertion instruction, the method further includes: Receive an insert chart configuration instruction, configure a chart function button in the toolbar of the rich text editor according to the insert chart configuration instruction; and configure the chart library carried in the insert chart configuration instruction into a selection list of the chart function button; Receive a variable filtering configuration instruction, configure a variable filtering function button in the toolbar of the rich text editor according to the variable filtering configuration instruction; and configure each variable filtering identifier carried in the variable filtering configuration instruction into a selection list of the variable filtering function button.

8. The method according to claim 1, characterized in that Converting the HTML source code into a data file in the target document format and exporting the data file comprises: A target document format framework is created using a document conversion tool, and based on the target document format framework, the HTML source code is converted into a data file in the target document format and exported; wherein the target document format framework includes a word format framework, a PDF format framework, or an EXCEL format framework.

9. A data export device based on a rich text editor, characterized in that: The device comprises: A data insertion module, configured to receive a data insertion instruction, and display the data content at the insertion position in the rich text editor according to the data content carried in the data insertion instruction and the insertion position in the rich text editor; A template generation module, used to receive a data style setting instruction, perform style setting on the data content according to a target style carried in the data style setting instruction, and generate a data export template; The data export module is used to convert the data export template into a Hypertext Markup Language HTML source code. When a data export instruction is received, the HTML source code is converted into a data file in the target document format and exported according to the target document format carried in the data export instruction.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the data export method based on the rich text editor described in any one of claims 1 to 8 when executing the program stored in the memory.

Citation Information

Cited By

  • Enterprise management information structured data processing method and system

    CN120353838A