Data exporting method and device, electronic equipment and computer storage medium
The method and device enable Prosemirror to export rich text editor content as documents by converting HTML text, addressing the lack of document export capability and enhancing content visibility and accuracy.
Patent Information
- Application Number
- CN202310787669.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
Prosemirror, a rich text editor, lacks the capability to export content in document formats like Word and PDF.
A method and device that converts hypertext markup language (HTML) text from a rich text editor into a format suitable for document export, involving element conversion, formatting, and use of a target plug-in with a trained conversion model to produce documents like Word or PDF.
Ensures effective data export from rich text editors to document formats, maintaining data integrity and improving visibility and accuracy of content.
Smart Images

Figure CN119227634A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer information processing technology, and in particular to a data export method, device, electronic device and computer storage medium. Background Art
[0002] Prosemirror is a rich text editor that produces structured, semantic, and meaningful documents while making them easy for users to understand and use. At the same time, content export is a must-have product capability and requirement for any knowledge management product, but Prosemirror currently cannot export content in document form, such as Word and PDF. Summary of the invention
[0003] The embodiment of the present application provides a data export method, device, electronic device and computer storage medium to achieve the demand for exporting documents from a rich text editor and ensure the data export effect. The above technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides a data export method, the method comprising:
[0005] Obtaining a first hypertext markup language text corresponding to the data to be exported in the rich text editor;
[0006] Performing format processing on the first hypertext markup language text to obtain a second hypertext markup language text;
[0007] The second hypertext markup language text is input into the target plug-in, and a target document corresponding to the second hypertext markup language text is output.
[0008] In a possible implementation, the step of obtaining the first hypertext markup language text corresponding to the data to be exported in the rich text editor includes:
[0009] Based on the data structure object corresponding to the data to be exported and the skeleton structure corresponding to the rich text editor, each element in the data to be exported is converted into a corresponding hypertext markup language;
[0010] The hypertext markup languages corresponding to the elements in the data to be exported are combined to obtain a first hypertext markup language text corresponding to the data to be exported.
[0011] In a possible implementation, the formatting of the first hypertext markup language text to obtain the second hypertext markup language text includes:
[0012] Parsing the first hypertext markup language text to obtain a to-be-processed hypertext markup language subtext in the first hypertext markup language text;
[0013] The to-be-processed hypertext markup language subtext in the first hypertext markup language text is formatted according to preset rules to obtain a second hypertext markup language text.
[0014] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0015] The method of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text includes:
[0016] Determine whether the width of the above image label is greater than the preset width;
[0017] If so, the width of the image tag in the first sub-text to be processed is reset based on the preset width, and the height of the image tag is adjusted proportionally to obtain a second hypertext markup language text.
[0018] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0019] The method of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text includes:
[0020] Determine whether the height of the above image label is greater than the preset height;
[0021] If so, the height of the image tag in the first sub-text to be processed is reset based on the preset height, and the width of the image tag is adjusted in proportion to obtain a second hypertext markup language text.
[0022] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the second sub-text to be processed with an attachment tag in the above-mentioned first hypertext markup language text;
[0023] The method of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text includes:
[0024] The second subtext to be processed in the first hypertext markup language text is converted into a hyperlink attachment or a document attachment to obtain a second hypertext markup language text.
[0025] In a possible implementation, the step of inputting the second hypertext markup language text into a target plug-in and outputting a target document corresponding to the second hypertext markup language text includes:
[0026] The second hypertext markup language text is input into the target plug-in, the target plug-in calls the conversion model, the second hypertext markup language text is input into the conversion model, and the target document corresponding to the second hypertext markup language text is output; the conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents.
[0027] In a possible implementation, the target document is a word document or a pdf document.
[0028] In a second aspect, an embodiment of the present application provides a data export device, characterized in that the data export device comprises:
[0029] An acquisition module, used for acquiring a first hypertext markup language text corresponding to the data to be exported in the rich text editor;
[0030] A format processing module, used for performing format processing on the first hypertext markup language text to obtain a second hypertext markup language text;
[0031] The conversion module is used to input the second hypertext markup language text into the target plug-in and output the target document corresponding to the second hypertext markup language text.
[0032] In a possible implementation, the acquisition module includes:
[0033] A conversion unit, used for converting each element in the data to be exported into a corresponding hypertext markup language based on the data structure object corresponding to the data to be exported and the skeleton structure corresponding to the rich text editor;
[0034] The combining unit is used to combine the hypertext markup languages corresponding to the elements in the above-mentioned data to be exported to obtain the first hypertext markup language text corresponding to the above-mentioned data to be exported.
[0035] In a possible implementation, the format processing module includes:
[0036] A parsing unit, used for parsing the first hypertext markup language text to obtain a to-be-processed hypertext markup language subtext in the first hypertext markup language text;
[0037] The format processing unit is used to perform format processing on the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to preset rules to obtain a second hypertext markup language text.
[0038] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0039] The above format processing module includes:
[0040] A first judging unit, used to judge whether the width of the image tag is greater than a preset width;
[0041] The first adjustment unit is used for, if yes, resetting the width of the image tag in the first sub-text to be processed based on the preset width, and proportionally adjusting the height of the image tag to obtain a second hypertext markup language text.
[0042] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0043] The above format processing module includes:
[0044] A second judging unit is used to judge whether the height of the image label is greater than a preset height;
[0045] The second adjustment unit is used for, if yes, resetting the height of the image tag in the first sub-text to be processed based on the preset height, and proportionally adjusting the width of the image tag to obtain a second hypertext markup language text.
[0046] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the second sub-text to be processed with an attachment tag in the above-mentioned first hypertext markup language text;
[0047] The above format processing module is specifically used for:
[0048] The second subtext to be processed in the first hypertext markup language text is converted into a hyperlink attachment or a document attachment to obtain a second hypertext markup language text.
[0049] In a possible implementation, the conversion module is specifically used to:
[0050] The second hypertext markup language text is input into the target plug-in, the target plug-in calls the conversion model, the second hypertext markup language text is input into the conversion model, and the target document corresponding to the second hypertext markup language text is output; the conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents.
[0051] In a possible implementation, the target document is a word document or a pdf document.
[0052] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
[0053] The processor is connected to the memory;
[0054] The above-mentioned memory is used to store executable program code;
[0055] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect.
[0056] In a fourth aspect, an embodiment of the present specification provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the method provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect.
[0057] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:
[0058] In one or more embodiments of the present application, a first hypertext markup language text corresponding to the data to be exported in a rich text editor is obtained, and the first hypertext markup language text is formatted to obtain a second hypertext markup language text. Finally, the second hypertext markup language text is input into a target plug-in, and a target document corresponding to the second hypertext markup language text is output, thereby realizing the requirement of exporting documents from a rich text editor and ensuring the data export effect.
[0059] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in 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.
[0061] Figure 1 A structural schematic diagram of a data export system provided by an exemplary embodiment of the present application;
[0062] Figure 2A flowchart of a data export method provided by an exemplary embodiment of the present application;
[0063] Figure 3 A schematic diagram of an implementation process of format processing provided by an exemplary embodiment of the present application;
[0064] Figure 4 A schematic diagram of another implementation process of format processing provided by an exemplary embodiment of the present application;
[0065] Figure 5 A schematic diagram of an implementation process of document conversion provided by an exemplary embodiment of the present application;
[0066] Figure 6 A schematic diagram of the structure of a data export device provided by an exemplary embodiment of the present application;
[0067] Figure 7 A schematic structural diagram of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0068] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0069] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0070] Please refer to the following Figure 1 , which is a schematic diagram of the architecture of a data export system provided by an exemplary embodiment of this specification. Figure 1 As shown, the data export system may include: a terminal 110 and a server 120 .
[0071] in:
[0072] The terminal 110 may be a user terminal, and specifically may include one or more user terminals. A user version of software may be installed in the user terminal, and the software may include, but is not limited to, a rich text editor such as a prosecutor, which is used to generate structured, semantic, and meaningful documents according to the user's editing operations, and to export corresponding document data according to the user's export requirements. When the terminal 110 receives a data export request triggered by a user based on a rich text editor, it may respond to the data export request and extract the first hypertext markup language text corresponding to the data to be exported from the rich text editor.
[0073] Optionally, after obtaining the first hypertext markup language text corresponding to the data to be exported in the rich text editor, the terminal 110 can format the first hypertext markup language text to obtain a second hypertext markup language text, and input the second hypertext markup language text into the target plug-in, and output the target document corresponding to the second hypertext markup language text, thereby exporting the target document corresponding to the data to be exported in the rich text editor.
[0074] Optionally, the terminal 110 may also establish a data relationship with the network, and establish a data connection relationship with the server 120 through the network, such as sending a first hypertext markup language text corresponding to the data to be exported, receiving a target document determined by the server 120 based on the first hypertext markup language text, etc. The terminal 110 may be, but is not limited to, a mobile phone, a tablet computer, a laptop computer, or other device with a user version software installed.
[0075] The server 120 may be a server that can provide multiple data exports, and may receive data such as the first hypertext markup language text sent by the terminal 110 through the network, and perform format processing on the first hypertext markup language text to obtain the second hypertext markup language text, and input the second hypertext markup language text into the target plug-in to output the target document corresponding to the second hypertext markup language text. After obtaining the target document corresponding to the data to be exported, the server 120 may, but is not limited to, send the target document to the terminal 110 through the network for export, thereby realizing the function of exporting documents by the rich text editor and ensuring the export effect of the document data. The server 120 may, but is not limited to, be a hardware server, a virtual server, a cloud server, etc.
[0076] It can be understood that the data export method provided in the embodiment of the present application can be executed in the terminal 110 or in the server 120, and the embodiment of the present application is not limited to this.
[0077] The network may be a medium providing a communication link between the server 120 and the terminal 110, or may be the Internet including network devices and transmission media, but is not limited thereto. The transmission medium may be a wired link (such as, but not limited to, coaxial cable, optical fiber, and digital subscriber line (DSL)) or a wireless link (such as, but not limited to, wireless fidelity (WIFI), Bluetooth, and mobile device network).
[0078] Understandably, Figure 1 The number of terminals 110 and servers 120 in the data export system shown is only an example. In a specific implementation, the data export system may include any number of terminals and servers. This specification embodiment does not specifically limit this. For example, but not limited to, the terminal 110 may be a terminal cluster composed of multiple terminals, and the server 120 may be a server cluster composed of multiple servers.
[0079] Next, combine Figure 1 , taking the server 120 executing data export as an example, the data export method provided by the embodiment of the present application is introduced. For details, please refer to Figure 2 , which exemplarily shows a flow chart of a data export method provided in an embodiment of the present application. Figure 2 As shown, the data export method includes the following steps:
[0080] S201, obtaining a first hypertext markup language text corresponding to the data to be exported in a rich text editor.
[0081] Optionally, when the user wants to export the data in the rich text editor in the form of a document such as word or pdf, a corresponding data export request can be triggered based on the rich text editor. When the user terminal receives the data export request, it will extract the first hypertext markup language text corresponding to the data to be exported from the rich text editor in response to the request, and send the first hypertext markup language text to the server 120 via the network or Hypertext Transfer Protocol (HTTP). At this time, the server 120 can obtain the first hypertext markup language text corresponding to the data to be exported in the rich text editor through the network or HTTP.
[0082] Optionally, after receiving the data export request, the server 120 will respond to the data export request by first converting each element in the data to be exported into a corresponding hypertext markup language based on the data structure object corresponding to the data to be exported in the rich text editor and the skeleton structure corresponding to the rich text editor, and then combining the hypertext markup language corresponding to each element in the data to be exported, for example but not limited to, in the order corresponding to each element, to obtain the first hypertext markup language text corresponding to the above data to be exported. The above elements may include, but are not limited to, text, pictures, flow charts, mind maps, etc. in the rich text editor.
[0083] S202: Perform formatting on the first hypertext markup language text to obtain a second hypertext markup language text.
[0084] Specifically, Figure 3 As shown, the above-mentioned implementation process of formatting the first hypertext markup language text to obtain the second hypertext markup language text may include: first parsing the first hypertext markup language text to obtain the hypertext markup language sub-text to be processed in the first hypertext markup language text, for example but not limited to using java's jsoup plug-in to parse the first hypertext markup language text, finding the hypertext markup language sub-text to be processed through the Document method, that is, the html fragment to be processed, and then formatting the hypertext markup language sub-text to be processed in the first hypertext markup language text according to preset rules to obtain the second hypertext markup language text, thereby avoiding the problem of incomplete data export in the rich text editor and improving the data export effect of the rich text editor.
[0085] Alternatively, if Figure 4 As shown, the above-mentioned to-be-processed hypertext markup language subtext may include a first to-be-processed subtext with a picture tag in the first hypertext markup language text. The above-mentioned formatting of the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to the preset rules to obtain the second hypertext markup language text may include but is not limited to: first determine whether the width of the picture tag is greater than the preset width, and if so, reset the width of the picture tag in the first to-be-processed subtext based on the preset width, for example but not limited to setting the width of the picture tag in the first to-be-processed subtext to the preset width or 4 / 5 of the preset width, and proportionally adjusting the height of the picture tag according to the adjustment ratio of the picture tag width to obtain the second hypertext markup language text, thereby avoiding the situation where the picture corresponding to the picture tag in the exported target document is incompletely previewed, and improving the validity and accuracy of the picture in the document data exported by the rich text editor. The above-mentioned preset width may be but is not limited to the target width of the target document to be exported or any width value within the target width.
[0086] Alternatively, if Figure 4 As shown, the above-mentioned hypertext markup language subtext to be processed may include a first subtext to be processed with a picture tag in the first hypertext markup language text. The above-mentioned formatting of the hypertext markup language subtext to be processed in the first hypertext markup language text according to the preset rules to obtain the second hypertext markup language text may include but is not limited to: first determine whether the height of the picture tag is greater than the preset height, if so, reset the height of the picture tag in the first subtext to be processed based on the preset height, for example but not limited to setting the height of the picture tag in the first subtext to be processed to the preset height or 3 / 4 of the preset height, and proportionally adjusting the width of the picture tag according to the adjustment ratio of the picture tag height to obtain the second hypertext markup language text, thereby avoiding the situation that the picture preview corresponding to the picture tag in the exported target document is not on the same page to affect the preview experience, and improving the observability of the picture in the document data exported by the rich text editor. The above-mentioned preset height may be but is not limited to the target height of the target document to be exported or any height value within the target height.
[0087] Alternatively, if Figure 4 As shown, the above-mentioned to-be-processed hypertext markup language subtext may include a second to-be-processed subtext with an attachment tag in the first hypertext markup language text. The above-mentioned formatting of the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to the preset rules to obtain the second hypertext markup language text may include, but is not limited to: converting the second to-be-processed subtext in the first hypertext markup language text into a hyperlink attachment or a document attachment to obtain the second hypertext markup language text, thereby, but is not limited to, inserting the attachment in the first hypertext markup language text into the target document to be exported in the form of a hyperlink attachment or a document attachment, avoiding the problem that the attachment in the first hypertext markup language text cannot be forwarded when converting to a target document such as word or pdf, and ensuring the integrity of the data export.
[0088] It can be understood that in order to ensure the integrity and effectiveness of data export as much as possible and improve the visibility of the exported target document, the above-mentioned hypertext markup language sub-text to be processed may but is not limited to simultaneously include a first sub-text to be processed with a picture tag in the first hypertext markup language text and a second sub-text to be processed with an attachment tag. The above-mentioned formatting of the hypertext markup language sub-text to be processed in the first hypertext markup language text according to preset rules to obtain the second hypertext markup language text may but is not limited to include: when the width of the picture tag is greater than the preset width, resetting the width of the picture tag in the first sub-text to be processed based on the preset width, and when the height of the picture tag is greater than the preset height, resetting the height of the picture tag in the first sub-text to be processed based on the preset height, and converting the second sub-text to be processed in the first hypertext markup language text into a hyperlink attachment or a document attachment to obtain the second hypertext markup language text. When the height of the image label is greater than the preset height and its width is also greater than the preset width, the width of the image label can be reset first, and then the height can be adjusted proportionally. If the adjusted height is still greater than the preset height, the height of the image label can be reset on this basis. Alternatively, the height of the image label can be reset first, and then the width can be adjusted proportionally. If the adjusted width is still greater than the preset width, the width of the image label can be reset on this basis, and the embodiments of the present application are not limited to this.
[0089] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S202, after formatting the first hypertext markup language text to obtain the second hypertext markup language text, the data export method further includes:
[0090] S203: Input the second hypertext markup language text into the target plug-in, and output the target document corresponding to the second hypertext markup language text.
[0091] Specifically, a target plug-in may be used to convert the formatted second hypertext markup language text into a corresponding target document for export. The target plug-in may include, but is not limited to, a Java aspose plug-in. The target document may be a word document or a pdf document corresponding to the data to be exported.
[0092] Alternatively, if Figure 5As shown, the implementation process of inputting the second hypertext markup language text into the target plug-in and outputting the target document corresponding to the second hypertext markup language text may include but is not limited to: inputting the second hypertext markup language text into the target plug-in, the target plug-in calls the conversion model, inputting the second hypertext markup language text into the conversion model, and outputting the target document corresponding to the second hypertext markup language text. The above conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents. The embodiment of the present application converts and exports the second hypertext markup language text after format processing by calling the trained conversion model, which can not only improve the efficiency of document data export, but also ensure the accuracy and stability of data export.
[0093] It can be understood that when the above-mentioned target document is required to be a word document, the above-mentioned conversion model is trained based on multiple sample hypertext markup language texts corresponding to the known word documents; when the above-mentioned target document is required to be a pdf document, the above-mentioned conversion model is trained based on multiple sample hypertext markup language texts corresponding to the known pdf documents.
[0094] In an embodiment of the present application, a first hypertext markup language text corresponding to the data to be exported in a rich text editor is obtained, and formatting is performed on the first hypertext markup language text to obtain a second hypertext markup language text. Finally, the second hypertext markup language text is input into a target plug-in, and a target document corresponding to the second hypertext markup language text is output, thereby realizing the requirement of exporting documents from a rich text editor and ensuring the data export effect.
[0095] Please refer to the following Figure 6 , which is a schematic diagram of the structure of a data export device provided in an embodiment of the present application. Figure 6 As shown, the data export device 600 includes:
[0096] An acquisition module 610 is used to acquire a first hypertext markup language text corresponding to the data to be exported in the rich text editor;
[0097] The format processing module 620 is used to perform format processing on the first hypertext markup language text to obtain a second hypertext markup language text;
[0098] The conversion module 630 is used to input the second hypertext markup language text into the target plug-in and output the target document corresponding to the second hypertext markup language text.
[0099] In a possible implementation, the acquisition module 610 includes:
[0100] A conversion unit, used for converting each element in the data to be exported into a corresponding hypertext markup language based on the data structure object corresponding to the data to be exported and the skeleton structure corresponding to the rich text editor;
[0101] The combining unit is used to combine the hypertext markup languages corresponding to the elements in the above-mentioned data to be exported to obtain the first hypertext markup language text corresponding to the above-mentioned data to be exported.
[0102] In a possible implementation, the format processing module 620 includes:
[0103] A parsing unit, used for parsing the first hypertext markup language text to obtain a to-be-processed hypertext markup language subtext in the first hypertext markup language text;
[0104] The format processing unit is used to perform format processing on the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to preset rules to obtain a second hypertext markup language text.
[0105] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0106] The format processing module 620 includes:
[0107] A first judging unit, used to judge whether the width of the image tag is greater than a preset width;
[0108] The first adjustment unit is used for, if yes, resetting the width of the image tag in the first sub-text to be processed based on the preset width, and proportionally adjusting the height of the image tag to obtain a second hypertext markup language text.
[0109] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0110] The format processing module 620 includes:
[0111] A second judging unit is used to judge whether the height of the image label is greater than a preset height;
[0112] The second adjustment unit is used for, if yes, resetting the height of the image tag in the first sub-text to be processed based on the preset height, and proportionally adjusting the width of the image tag to obtain a second hypertext markup language text.
[0113] In a possible implementation, the above-mentioned hypertext markup language sub-text to be processed includes the second sub-text to be processed with an attachment tag in the above-mentioned first hypertext markup language text;
[0114] The format processing module 620 is specifically used for:
[0115] The second subtext to be processed in the first hypertext markup language text is converted into a hyperlink attachment or a document attachment to obtain a second hypertext markup language text.
[0116] In a possible implementation, the conversion module 630 is specifically used to:
[0117] The second hypertext markup language text is input into the target plug-in, the target plug-in calls the conversion model, the second hypertext markup language text is input into the conversion model, and the target document corresponding to the second hypertext markup language text is output; the conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents.
[0118] In a possible implementation, the target document is a word document or a pdf document.
[0119] The division of each module in the above-mentioned data export device is only for illustration. In other embodiments, the data export device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned data export device. The implementation of each module in the data export device provided in the embodiment of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the data export method described in the embodiment of this specification are implemented.
[0120] See next Figure 7 , which is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Figure 7 As shown, the electronic device 700 may include: at least one processor 710 , at least one communication bus 720 , a user interface 730 , at least one network interface 740 , and a memory 750 .
[0121] The communication bus 720 may be used to realize the connection and communication among the above-mentioned components.
[0122] The user interface 730 may include a display screen (Display) and a camera (Camera), and the optional user interface may also include a standard wired interface and a wireless interface.
[0123] The network interface 740 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, and the like.
[0124] Among them, the processor 710 may include one or more processing cores. The processor 710 uses various interfaces and lines to connect various parts within the entire electronic device 700, and executes various functions and processes data of the routing electronic device 700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 750, and calling data stored in the memory 750. Optionally, the processor 710 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 710 can integrate one or a combination of a processor (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 710, and it can be implemented separately through a chip.
[0125] The memory 750 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 750 includes a non-transitory computer-readable medium. The memory 750 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 750 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as an acquisition function, a format processing function, a conversion function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 750 may optionally be at least one storage device located away from the aforementioned processor 710. As Figure 7 As shown, the memory 750 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0126] Specifically, the processor 710 may be used to call the program instructions stored in the memory 750, and specifically perform the following operations:
[0127] A first hypertext markup language text corresponding to the data to be exported in the rich text editor is obtained.
[0128] The first hypertext markup language text is formatted to obtain a second hypertext markup language text.
[0129] The second hypertext markup language text is input into the target plug-in, and a target document corresponding to the second hypertext markup language text is output.
[0130] In some possible embodiments, when the processor 710 executes the above-mentioned obtaining the first hypertext markup language text corresponding to the data to be exported in the rich text editor, it is specifically used to execute:
[0131] Based on the data structure object corresponding to the data to be exported and the skeleton structure corresponding to the rich text editor, each element in the data to be exported is converted into a corresponding hypertext markup language.
[0132] The hypertext markup languages corresponding to the elements in the data to be exported are combined to obtain a first hypertext markup language text corresponding to the data to be exported.
[0133] In some possible embodiments, when the processor 710 performs format processing on the first hypertext markup language text to obtain the second hypertext markup language text, it is specifically configured to execute:
[0134] The first hypertext markup language text is parsed to obtain the hypertext markup language sub-text to be processed in the first hypertext markup language text.
[0135] The to-be-processed hypertext markup language subtext in the first hypertext markup language text is formatted according to preset rules to obtain a second hypertext markup language text.
[0136] In some possible embodiments, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0137] When the processor 710 performs format processing on the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text, the processor 710 is specifically configured to perform:
[0138] Determine whether the width of the above image label is greater than the preset width.
[0139] If so, the width of the image tag in the first sub-text to be processed is reset based on the preset width, and the height of the image tag is adjusted proportionally to obtain a second hypertext markup language text.
[0140] In some possible embodiments, the above-mentioned hypertext markup language sub-text to be processed includes the first sub-text to be processed with a picture tag in the above-mentioned first hypertext markup language text;
[0141] When the processor 710 performs format processing on the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text, the processor 710 is specifically configured to perform:
[0142] Determine whether the height of the above image label is greater than the preset height.
[0143] If so, the height of the image tag in the first sub-text to be processed is reset based on the preset height, and the width of the image tag is adjusted in proportion to obtain a second hypertext markup language text.
[0144] In some possible embodiments, the above-mentioned hypertext markup language sub-text to be processed includes the second sub-text to be processed with an attachment tag in the above-mentioned first hypertext markup language text;
[0145] When the processor 710 performs format processing on the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text, the processor 710 is specifically configured to perform:
[0146] The second subtext to be processed in the first hypertext markup language text is converted into a hyperlink attachment or a document attachment to obtain a second hypertext markup language text.
[0147] In some possible embodiments, when the processor 710 inputs the second hypertext markup language text into the target plug-in and outputs the target document corresponding to the second hypertext markup language text, it is specifically configured to execute:
[0148] The second hypertext markup language text is input into the target plug-in, the target plug-in calls the conversion model, the second hypertext markup language text is input into the conversion model, and the target document corresponding to the second hypertext markup language text is output; the conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents.
[0149] In some possible embodiments, the target document is a word document or a pdf document.
[0150] The embodiment of the present application also provides a computer storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in any of the above methods. If the components of the above data export device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above storage medium.
[0151] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The above computer program product includes one or more computer instructions. When the above computer program instructions are loaded and executed on a computer, the above process or function according to the embodiment of the present application is generated in whole or in part. The above computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above computer instructions can be stored in a computer-readable storage medium or transmitted by the above computer-readable storage medium. The above computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The above computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The above available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0152] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.
[0153] The above-mentioned embodiments are merely preferred embodiments of the present application and are not intended to limit the scope of the present application. Without departing from the design spirit of the present application, various modifications and improvements made to the technical solutions of the present application by ordinary technicians in this field should fall within the protection scope determined by the claims of the present application.
Claims
1. A data export method, characterized in that: The method comprises: Obtaining a first hypertext markup language text corresponding to the data to be exported in the rich text editor; Performing format processing on the first hypertext markup language text to obtain a second hypertext markup language text; The second hypertext markup language text is input into a target plug-in, and a target document corresponding to the second hypertext markup language text is output.
2. The method according to claim 1, characterized in that: The step of obtaining the first hypertext markup language text corresponding to the data to be exported in the rich text editor includes: Based on the data structure object corresponding to the data to be exported and the skeleton structure corresponding to the rich text editor, each element in the data to be exported is converted into a corresponding hypertext markup language; The hypertext markup languages corresponding to the elements in the data to be exported are combined to obtain a first hypertext markup language text corresponding to the data to be exported.
3. The method according to claim 1, characterized in that The step of performing format processing on the first hypertext markup language text to obtain a second hypertext markup language text includes: Parsing the first hypertext markup language text to obtain a to-be-processed hypertext markup language subtext in the first hypertext markup language text; The to-be-processed hypertext markup language subtext in the first hypertext markup language text is formatted according to preset rules to obtain a second hypertext markup language text.
4. The method according to claim 3, characterized in that The to-be-processed hypertext markup language subtext includes a first to-be-processed subtext with a picture tag in the first hypertext markup language text; The step of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text comprises: Determine whether the width of the image label is greater than a preset width; If so, the width of the picture tag in the first sub-text to be processed is reset based on the preset width, and the height of the picture tag is adjusted in proportion to obtain a second hypertext markup language text.
5. The method according to claim 3, characterized in that: The to-be-processed hypertext markup language subtext includes a first to-be-processed subtext with a picture tag in the first hypertext markup language text; The step of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text comprises: Determine whether the height of the image label is greater than a preset height; If so, the height of the picture tag in the first sub-text to be processed is reset based on the preset height, and the width of the picture tag is adjusted in proportion to obtain a second hypertext markup language text.
6. The method according to claim 3, characterized in that The to-be-processed hypertext markup language subtext includes a second to-be-processed subtext with an attachment tag in the first hypertext markup language text; The step of formatting the to-be-processed hypertext markup language subtext in the first hypertext markup language text according to a preset rule to obtain a second hypertext markup language text comprises: The second to-be-processed subtext in the first hypertext markup language text is converted into a hyperlink attachment or a document attachment to obtain a second hypertext markup language text.
7. The method according to claim 1, characterized in that The step of inputting the second hypertext markup language text into the target plug-in and outputting a target document corresponding to the second hypertext markup language text comprises: The second hypertext markup language text is input into a target plug-in, the target plug-in calls a conversion model, the second hypertext markup language text is input into the conversion model, and a target document corresponding to the second hypertext markup language text is output; the conversion model is trained based on multiple sample hypertext markup language texts of known corresponding documents.
8. A data export device, characterized in that: The device comprises: An acquisition module, used for acquiring a first hypertext markup language text corresponding to the data to be exported in the rich text editor; A format processing module, used for performing format processing on the first hypertext markup language text to obtain a second hypertext markup language text; The conversion module is used to input the second hypertext markup language text into the target plug-in and output the target document corresponding to the second hypertext markup language text.
9. An electronic device, characterized in that: include: processor and memory; wherein, The processor is connected to the memory; the memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method steps according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 7.