CN112632165A - Page form export EXCEL method and device, computer equipment and storage medium - Google Patents

Page form export EXCEL method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112632165A
CN112632165A CN202011528250.4A CN202011528250A CN112632165A CN 112632165 A CN112632165 A CN 112632165A CN 202011528250 A CN202011528250 A CN 202011528250A CN 112632165 A CN112632165 A CN 112632165A
Authority
CN
China
Prior art keywords
preset
target
excel
html
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011528250.4A
Other languages
Chinese (zh)
Inventor
杨笑男
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011528250.4A priority Critical patent/CN112632165A/en
Publication of CN112632165A publication Critical patent/CN112632165A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • G06F40/143Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application belongs to the technical field of data display, and provides a method and a device for exporting EXCEL from a page table, computer equipment and a computer-readable storage medium. According to the method and the device, the preset form identification corresponding to the preset form to be downloaded in the page is obtained by responding to the form downloading instruction, the preset DOM structure corresponding to the preset form is obtained according to the preset form identification, the preset HTML template corresponding to the preset form is obtained, the preset DOM structure is embedded into the preset HTML template, the target HTML is obtained, the target Excel file is generated according to a preset generation mode through the target HTML, the target Excel file is downloaded to derive the preset form, the XML-based mode is realized, the form conversion Excel in the front-end page is derived to carry out form derivation, the derivation efficiency of form data can be improved, and the page performance is improved.

Description

Page form export EXCEL method and device, computer equipment and storage medium
Technical Field
The application relates to the technical field of data display, in particular to a method and a device for exporting EXCEL from a page table, computer equipment and a computer-readable storage medium.
Background
The export function of the Table (namely Table) contained in the front-end page is common, the exported Table is convenient for a user to check, compare, screen and edit information in the Excel Table, and the data storage or backup in various devices is facilitated. In the conventional technology, a table included in a front-end page is exported, and the front-end often chooses to rely on a backend interface for implementation, which generally includes the following two ways:
firstly, the front end transmits the Table data to the back end, the Excel download link is returned after the Table data is processed by the back end, and the front end accesses the link into the HTML < a > tag to realize the download function.
Secondly, the front end transmits the Table data to the back end, the data in the Json format is returned after the data is processed by the back end, the data is converted into URL links by the front end through the processing of the data, and the downloading is realized through HTML < a > tags.
It can be seen that, in the conventional technology, the table data is generally transmitted to the back end through the front end to export the table contained in the front-end page, and after the back end processes the table data, the back end returns the download link to the front end to realize the table download through the front end. If the joint debugging interface between the front end and the back end is abnormal or the network environment is not good, the realization of the form downloading function by the front end is affected, and the form data downloading efficiency is low.
Disclosure of Invention
The application provides a method, a device, computer equipment and a computer-readable storage medium for exporting EXCEL from a page form, which can solve the technical problem of low efficiency of exporting form data in a front end of a page in the prior art.
In a first aspect, the present application provides a method for exporting EXCEL from a page form, including: responding to a table downloading instruction, and acquiring a preset table identifier corresponding to a preset table to be downloaded in a page; acquiring a preset DOM structure corresponding to the preset form according to the preset form identification; acquiring a preset HTML template corresponding to the preset form, and embedding the preset DOM structure into the preset HTML template to obtain a target HTML; and generating a target Excel file by the target HTML according to a preset generation mode, and downloading the target Excel file to export the preset table.
In a second aspect, the present application further provides a page form export EXCEL apparatus, including: the first obtaining unit is used for responding to the table downloading instruction and obtaining a preset table identifier corresponding to a preset table to be downloaded in the page; the second obtaining unit is used for obtaining a preset DOM structure corresponding to the preset form according to the preset form identifier; the embedding unit is used for acquiring a preset HTML template corresponding to the preset form and embedding the preset DOM structure into the preset HTML template to obtain target HTML; and the export unit is used for generating a target Excel file by the target HTML according to a preset generation mode, downloading the target Excel file and exporting the preset table.
In a third aspect, the present application further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the page table exporting EXCEL method when executing the computer program.
In a fourth aspect, the present application further provides a computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of the page table derivation EXCEL method.
The application provides a method, a device, computer equipment and a computer-readable storage medium for exporting EXCEL from a page table. The method comprises the steps of responding to a form downloading instruction, obtaining a preset form mark corresponding to a preset form to be downloaded in a page, obtaining a preset DOM structure corresponding to the preset form according to the preset form mark, obtaining a preset HTML template corresponding to the preset form, embedding the preset DOM structure into the preset HTML template to obtain target HTML, generating a target Excel file according to a preset generation mode by the target HTML, downloading the target Excel file to derive the preset form, converting the form in a front-end page into the Excel to derive the form based on XML, and transmitting the form contained in the front-end page to a rear end in the prior art, processing the form by the rear end, and returning a downloading link to the front end to derive the form by the rear end, the pure front end utilizes XML to realize the table export in the front end page, the dependence on the rear end when the table in the front end page is exported can be avoided, the number of requests in the page is reduced, the butt joint time of the front end and the rear end can be realized, the export efficiency of form data is improved, and the page performance is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method for exporting EXCEL from a page form according to an embodiment of the present application;
FIG. 2 is a schematic view of a first sub-flow of a method for exporting EXCEL from a page form according to an embodiment of the present application;
FIG. 3 is a second sub-flowchart illustration of a method for exporting EXCEL from a page form according to an embodiment of the present application;
FIG. 4 is a third sub-flowchart of the method for exporting EXCEL from a page form according to the embodiment of the present application;
FIG. 5 is a fourth sub-flowchart illustration of a method for exporting EXCEL from a page form according to an embodiment of the present application;
FIG. 6 is a fifth sub-flowchart of the method for exporting EXCEL from a page form according to the embodiment of the present application;
FIG. 7 is a sixth sub-flowchart of the method for exporting EXCEL from a page form according to the embodiment of the present application;
FIG. 8 is a schematic block diagram of an EXCEL apparatus for exporting a page form provided by an embodiment of the present application; and
fig. 9 is a schematic block diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Referring to fig. 1, fig. 1 is a schematic flowchart of a method for exporting an EXCEL from a page form according to an embodiment of the present application. As shown in FIG. 1, the method includes the following steps S11-S14:
s11, responding to the table downloading instruction, and acquiring the preset table identification corresponding to the preset table to be downloaded in the page.
Specifically, a preset table is created in a front-end page, the preset table is a page table, and the front-end page is generally an HTML document. The method includes the steps that a preset Table carrying data is created in a front-end page, a Table (namely, Table) can be created by creating a < Table > tag carrying data in the front-end page, the < Table > tag comprises two parts, namely a Header and a Body, and meanwhile the id attribute of the < Table > tag can be designated as 'my-Table' (each Table has a unique id attribute), the id in HTML is used for providing a unique identifier or mark for a unit (element and tag), the id of the < Table > tag is the preset Table identifier corresponding to the preset Table, and meanwhile the name attribute of the < Table > tag is 'Table'.
When a user operates on a front-end page to download the preset form, the computer equipment responds to a form downloading instruction, obtains a preset form identifier corresponding to the preset form to be downloaded, which is subjected to downloading operation by the user, in the page, and finds the form to be exported in the page according to the preset form identifier.
S12, acquiring a preset DOM structure corresponding to the preset form according to the preset form identification.
The DOM is an abbreviation of Document object model and can be described as a DOM tree, and represents a Document as a family tree (i.e., a structure among parents, children and siblings), and defines interfaces of nodes (i.e., nodes) and various Node types to represent multiple aspects of XML nodes.
Specifically, because the Table in the front-end page generally adopts a DOM tree structure to describe a data structure corresponding to data contained in the Table, the Table has been loaded with data during creation, and contains two parts, namely, a Header and a Body, which are collectively referred to as a DOM structure, the DOM structure corresponding to the Table is available during creation of the Table, and the DOM structure of the Table can be obtained through the id attribute of the < Table > tag corresponding to the Table, i.e., the data structure of the Table to be exported, i.e., the preset DOM structure corresponding to the preset Table. The preset DOM structure corresponding to the preset form can be obtained by the following method:
const tableDom=document.getElementById('my-table').outerHTML;
the variable tableDom is a DOM structure corresponding to the preset table containing data content. In one example, the table Dom may be the following structure, with the operation effect shown in table 1:
Figure BDA0002851455810000051
table 1
Name(s) Sex Native place
Dew Woman (Jilin)
Tiger For male Liaoning medicine
Therefore, after the preset form identifier corresponding to the preset form to be downloaded is obtained, the preset DOM structure corresponding to the preset form can be obtained according to the preset form identifier.
S13, acquiring a preset HTML template corresponding to the preset form, wherein the preset HTML template comprises XML parameters, and embedding the preset DOM structure into the preset HTML template to obtain target HTML.
The XML, English is Extensible Markup Language, and is used for transmitting and storing data format.
Specifically, for a preset form, a preset HTML template corresponding to the preset form is preset, different preset forms are respectively provided with corresponding preset HTML templates, the preset HTML template includes an xmlns parameter value, and a style attribute in the HTML template is used for presetting a data display attribute for displaying when data in the form is exported, such as a font, a color, a line height, a background color and the like of the form. And acquiring a preset HTML template corresponding to the preset form, and embedding the preset DOM structure into a preset position in the HTML template to obtain a target HTML template. In one example, an HTML template is created and its XML parameters are set, embedding the DOM structure into a preset HTML template as follows:
<html>…</head><body>{tableDom}</body></html>;
in this example, the obtained preset DOM structure tableDom is embedded into the body tag, and the style of the export table is controlled by setting the attributes of table, such as font-size, font-family, line-height, background, and color.
Wherein, HTML is used for displaying data; XML is used to describe data, store data, and so can be used as a persistent medium! HTML combines data and display together, and displays the data in a page; XML separates the data from the display. XML is designed to describe data, the focus of which is the content of the data. HTML is designed to display data, the focus of which is the appearance of the data.
And S14, generating a target Excel file by the target HTML according to a preset generation mode, and downloading the target Excel file to export the preset table.
Specifically, different browsers may have different processing modes for the same function based on different characteristics of the browsers. Aiming at different browsers, the target HTML is required to be generated into a target Excel file according to the characteristics of the browsers, so that the target HTML is converted into a corresponding preset Excel file, the target Excel file is downloaded, the Excel file is exported, and export of preset forms in pages is achieved. For example, for browsers such as Chrome and Firefox, the target HTML may be converted into Base64 format, and then a target Excel file is generated based on the Base64 format, whereas for an IE browser, since the target HTML cannot be converted into Base64 format, data processing by blob.
Furthermore, when the method for exporting the page table provided by the embodiment of the application is applied to a page, the page table can be packaged into a component, a user only needs to introduce the component and only needs to input the DOM structure of the corresponding table and the exported file name, and development and docking time can be saved.
In the embodiment of the application, by responding to a form downloading instruction, acquiring a preset form identifier corresponding to a preset form to be downloaded in a page, acquiring a preset DOM structure corresponding to the preset form according to the preset form identifier, acquiring a preset HTML template corresponding to the preset form, embedding the preset DOM structure into the preset HTML template to obtain a target HTML, generating a target Excel file according to the target HTML in a preset generation mode, downloading the target Excel file to derive the preset form, so that the form in a front-end page is converted into Excel to derive the form based on XML, compared with the conventional technology, the form contained in the front-end page is transmitted to a rear end, the rear end processes the form, and then the rear end returns a downloading link to the front end to derive the form, the pure front end utilizes XML to realize the table export in the front end page, the dependence on the rear end when the table in the front end page is exported can be avoided, the number of requests in the page is reduced, the butt joint time of the front end and the rear end can be realized, the export efficiency of form data is improved, and the page performance is improved.
Referring to fig. 2, fig. 2 is a schematic sub-flow diagram of a method for exporting an EXCEL from a page form according to an embodiment of the present application. As shown in fig. 2, in this embodiment, the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier includes:
s21, acquiring an initial DOM structure corresponding to the preset form according to the preset form identifier;
s22, judging whether the initial DOM structure contains a preset row combination attribute or a preset column combination attribute;
s23, if the initial DOM structure includes a preset row merge attribute or a preset column merge attribute, merging a preset column associated with the preset row merge attribute or a preset row associated with the preset column merge attribute according to the preset row merge attribute or the preset column merge attribute, so as to obtain a preset DOM structure corresponding to the preset form;
s24, if the initial DOM structure does not contain the preset row combination attribute or the preset column combination attribute, executing the steps of obtaining the preset HTML template corresponding to the preset form and embedding the preset DOM structure into the preset HTML template to obtain the target HTML.
Specifically, for preset rows or preset columns in a preset table in a front-end page, when the table is exported, part of the preset rows or part of the preset columns in the table can be combined, so that the exported Excel file can meet the export display requirement, and the complete handling of the table content in the page is avoided. Merging part of preset rows or part of preset columns in the front-end page, merging the preset rows or the preset columns of the cells in the Table can be realized by setting the properties of Rowspan and Colspan to the Table tag, and the merged cells are reserved with null to avoid the coverage of the following content. After a preset form identifier is obtained, obtaining an initial DOM structure corresponding to the preset form according to the preset form identifier, judging whether the initial DOM structure contains a preset row merging attribute or a preset column merging attribute, namely judging whether the Table structure is provided with the Rowspan attribute and the Colspan attribute, if the initial DOM structure contains the preset row merging attribute or the preset column merging attribute, merging a preset column associated with the preset row merging attribute or a preset row associated with the preset column merging attribute according to the preset row merging attribute or the preset column merging attribute to obtain the preset DOM structure corresponding to the preset form, so that the derived Excel meets the merging requirement of the preset row and the preset column in the preset form, and if the initial DOM structure does not contain the preset row merging attribute or the preset column merging attribute, executing the obtaining of a preset template corresponding to the preset HTML form, and embedding the preset DOM structure into the preset HTML template to obtain a target HTML.
Referring to fig. 3, fig. 3 is a schematic view of a second sub-flow of the method for exporting an EXCEL from a page form according to the embodiment of the present application. As shown in fig. 3, in this embodiment, the step of generating the target Excel file according to the target HTML in a preset generation manner includes:
s31, converting the target HTML into a preset Base64 format to obtain a target conversion value;
and S32, setting the target conversion value into an Excel format to generate a target Excel file.
Specifically, an HTML < a > tag is created, the tag is a download button corresponding to a download form, a form name is defined, the target HTML is converted into a preset Base64 format, the target HTML can be converted into a Base64 format by a window. base64' is spliced into href value of HTML < a > label, so as to set the target conversion value into Excel format, and simultaneously set the download value of HTML < a > label as the name value of HTML < a > label, through the download attribute of HTML < a > label, the Excel form named as name can be successfully downloaded after receiving a click download button, so as to realize the download function of converting the form into Excel when a user clicks download, the derived data format is Excel, and messy codes can not appear, so that the target Excel file is generated, and the compatibility maximization is realized in the aspect of compatibility, the method can be compatible with mainstream browsers of Chrome, Firefox and the like, and better experience is provided for the user.
Referring to fig. 4, fig. 4 is a schematic view of a third sub-flow of the method for exporting an EXCEL from a page form according to the embodiment of the present application. As shown in fig. 4, in this embodiment, after the step of generating a target Excel file from the target HTML according to a preset generation manner and downloading the target Excel file, the method further includes:
s41, prompting whether the target Excel file is encrypted or not;
s42, if an instruction for encrypting the target Excel file is received, popping up a preset encryption setting display frame to enable a user to set a password for the target Excel file;
s43, if an instruction for not encrypting the target Excel file is received, not popping up a preset encryption setting display frame, and executing the step of exporting the preset table.
Specifically, when a form in a front-end page is converted into an Excel file to be exported, after the target Excel file is downloaded to a local computer, a prompt box can be popped up to prompt a user whether to encrypt the target Excel file, if the user selects to encrypt the target Excel file, a preset encryption setting display box is popped up to enable the user to set a password for the target Excel file, if the user selects not to encrypt the target Excel file, the preset encryption setting display box is not popped up, the target Excel file is directly downloaded to export the preset form, so that whether the exported Excel form is encrypted or not can be prompted when the user downloads, an Excel encryption method is called after the user inputs the password to realize encryption, and the security of the user downloaded form can be improved.
Referring to fig. 5, fig. 5 is a fourth sub-flow diagram of the method for exporting an EXCEL from a page form according to the embodiment of the present application. As shown in fig. 5, in this embodiment, the step of generating the target Excel file according to the target HTML in a preset generation manner includes:
s51, converting the target HTML into a preset BLOB file;
and S52, generating a target Excel file according to the preset BLOB file.
Wherein BLOB, BinaryLarge Object in English, binary large Object,
specifically, for a file which cannot be processed by converting the target HTML into a Base64 format, such as an IE browser, blob.js may be used to process data, Blob may be directly created and operated on a client using a Blob constructor, and then a mssaveoopenblob method allows a user to save a file on the client, so that the target HTML is converted into a binary system by means of Blob to obtain a preset Blob file, and then the preset Blob file is used as an href attribute of an HTML < a > tag and is matched with a download attribute of the HTML < a > tag to realize downloading of an Excel file, thereby realizing export of a target form and a downloading function of converting the form into Excel.
Referring to fig. 6, fig. 6 is a fifth sub-flow diagram of the method for exporting an EXCEL from a page form according to the embodiment of the present application. As shown in fig. 6, in this embodiment, after the step of generating a target Excel file from the target HTML according to a preset generation manner, and downloading the target Excel file to export the preset table, the method further includes:
s61, recording the downloading times of the preset table;
s62, counting the download times of all the preset tables;
s63, sorting all the preset tables according to the descending order of the downloading times to obtain a table sorting queue;
s64, acquiring the first n preset tables in the table sorting queue, wherein n is a natural number;
and S65, displaying the preset associated tables corresponding to the previous n preset tables.
Specifically, when a plurality of tables exist in a page, each time an Excel Table is derived by a user, the download times of the preset tables by the user can be recorded through local cache, the download times corresponding to the preset tables are utilized to perform data analysis on the download times so as to obtain user requirement information or user preference information such as user requirements and use habits, relevant data are preferentially displayed in subsequent page display according to the user requirement information or the user preference information, and preset associated tables associated with n preset tables with more user download times can be displayed, so that better visual and use experience is provided for the user, the user is attracted, and the use efficiency of an application program is improved, wherein n is a natural number.
Referring to fig. 7, fig. 7 is a sixth sub-flow diagram of the method for exporting an EXCEL from a page form according to the embodiment of the present application. As shown in fig. 7, in this embodiment, before the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier, the method further includes:
s71, judging whether a preset DOM structure corresponding to the preset form exists or not;
s72, if the preset DOM structure corresponding to the preset form does not exist, sending a prompt of download failure;
s73, if the preset DOM structure corresponding to the preset form exists, executing the step of acquiring the preset DOM structure corresponding to the preset form according to the preset form identification.
Specifically, when the EXCEL method for exporting a page form provided by the embodiment of the present application is applied to a front-end page, a developer generally needs to import a preset DOM structure corresponding to a form included in a page into the front-end page in advance to normally obtain the preset DOM structure corresponding to the preset form according to the preset form identifier, if the developer does not import the preset DOM structure corresponding to the form included in the page into the front-end page in advance, the developer cannot normally execute the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier, and therefore, before the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier, the developer can first determine whether the preset DOM structure corresponding to the preset form exists, and if the preset DOM structure corresponding to the preset form exists, execute the step according to the preset form identifier, the method comprises the steps of obtaining a preset DOM structure corresponding to a preset form, sending a prompt of failure in downloading if the preset DOM structure corresponding to the preset form does not exist, and further sending a warning that the preset DOM structure corresponding to the preset form does not exist, so that the EXCEL cannot be derived from the page form, and the method can solve the problem of timely and accurate feedback of a user, improve the efficiency of positioning problems, improve the maintenance efficiency of the application programs with problems, and particularly facilitate the rapid positioning of the testers when the testers test the application programs, thereby realizing the rapid maintenance of the problems and improving the maintenance efficiency of the problems.
It should be noted that, in the method for exporting EXCEL from the page form described in the foregoing embodiments, the technical features included in different embodiments may be recombined as needed to obtain a combined implementation, but all of them are within the scope of protection claimed in the present application.
Referring to fig. 8, fig. 8 is a schematic block diagram of a device for exporting a page form to EXCEL according to an embodiment of the present application. Corresponding to the method for exporting the EXCEL from the page form, the embodiment of the application also provides a device for exporting the EXCEL from the page form. As shown in fig. 8, the page form export EXCEL apparatus includes a unit for executing the page form export EXCEL method described above, and may be configured in a computer device. Specifically, referring to fig. 8, the apparatus 80 for exporting a page form to an EXCEL includes a first obtaining unit 81, a second obtaining unit 82, an embedding unit 83 and an exporting unit 84.
The first obtaining unit 81 is configured to, in response to a table downloading instruction, obtain a preset table identifier corresponding to a preset table to be downloaded in a page;
a second obtaining unit 82, configured to obtain, according to the preset form identifier, a preset DOM structure corresponding to the preset form;
the embedding unit 83 is configured to obtain a preset HTML template corresponding to the preset form, and embed the preset DOM structure into the preset HTML template to obtain a target HTML;
and the exporting unit 84 is configured to generate a target Excel file from the target HTML according to a preset generation manner, and download the target Excel file to export the preset table.
In an embodiment, the second obtaining unit 82 includes:
the first obtaining subunit is configured to obtain, according to the preset form identifier, an initial DOM structure corresponding to the preset form;
the first judgment subunit is used for judging whether the initial DOM structure contains a preset row merging attribute or a preset column merging attribute;
and a merging subunit, configured to merge, according to the preset row merging attribute or the preset column merging attribute, the preset column associated with the preset row merging attribute or the preset row associated with the preset column merging attribute if the initial DOM structure includes a preset row merging attribute or a preset column merging attribute, so as to obtain a preset DOM structure corresponding to the preset form.
In one embodiment, the deriving unit 84 includes:
a first conversion subunit, configured to convert the target HTML into a preset Base64 format to obtain a target conversion value;
and the first generating subunit is used for setting the target conversion value into an Excel format so as to generate a target Excel file.
In one embodiment, the deriving unit 84 includes:
the second conversion subunit is used for converting the target HTML into a preset BLOB file;
and the second generating subunit is used for generating a target Excel file according to the preset BLOB file.
In an embodiment, the page form export EXCEL apparatus 80 further comprises:
the first prompting unit is used for prompting whether the target Excel file is encrypted or not;
and the popping unit is used for popping up a preset encryption setting display frame to enable a user to set a password for the target Excel file if an instruction for encrypting the target Excel file is received.
In an embodiment, the page form export EXCEL apparatus 80 further comprises:
the recording unit is used for recording the downloading times of the preset table;
the statistical unit is used for counting the download times of all the preset tables;
the sorting unit is used for sorting all the preset tables according to the descending order of the downloading times to obtain a table sorting queue;
a third obtaining unit, configured to obtain first n preset tables in the table sorting queue, where n is a natural number;
and the display unit is used for displaying the preset associated tables corresponding to the first n preset tables.
In an embodiment, the page form export EXCEL apparatus 80 further comprises:
the judging unit is used for judging whether a preset DOM structure corresponding to the preset form exists or not;
and the second prompting unit is used for sending a prompt of download failure if the preset DOM structure corresponding to the preset form does not exist.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation process of the EXCEL apparatus and each unit derived from the page table may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
Meanwhile, the division and connection modes of the units in the page form export EXCEL apparatus are only used for illustration, in other embodiments, the page form export EXCEL apparatus may be divided into different units as required, and the units in the page form export EXCEL apparatus may also adopt different connection orders and modes to complete all or part of the functions of the page form export EXCEL apparatus.
The above-mentioned page form export EXCEL apparatus may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 9.
Referring to fig. 9, fig. 9 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a computer device such as a desktop computer or a server, or may be a component or part of another device.
Referring to fig. 9, the computer device 500 includes a processor 502, a memory, which may include a non-volatile storage medium 503 and an internal memory 504, which may also be a volatile storage medium, and a network interface 505 connected by a system bus 501.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform one of the above-described Page Table export EXCEL methods.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, which computer program 5032, when executed by the processor 502, causes the processor 502 to perform one of the above-described page table export EXCEL methods.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 9 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 9, and are not described herein again.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps: responding to a table downloading instruction, and acquiring a preset table identifier corresponding to a preset table to be downloaded in a page; acquiring a preset DOM structure corresponding to the preset form according to the preset form identification; acquiring a preset HTML template corresponding to the preset form, and embedding the preset DOM structure into the preset HTML template to obtain a target HTML; and generating a target Excel file by the target HTML according to a preset generation mode, and downloading the target Excel file to export the preset table.
In an embodiment, when the processor 502 implements the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier, the following steps are specifically implemented:
acquiring an initial DOM structure corresponding to the preset form according to the preset form identification;
judging whether the initial DOM structure contains a preset row merging attribute or a preset column merging attribute;
if the initial DOM structure contains a preset row combination attribute or a preset column combination attribute, combining preset columns associated with the preset row combination attribute or preset rows associated with the preset column combination attribute according to the preset row combination attribute or the preset column combination attribute so as to obtain a preset DOM structure corresponding to the preset table.
In an embodiment, when the processor 502 implements the step of generating the target Excel file by using the target HTML according to a preset generation manner, the following steps are specifically implemented:
converting the target HTML into a preset Base64 format to obtain a target conversion value;
and setting the target conversion value into an Excel format to generate a target Excel file.
In an embodiment, when the processor 502 implements the step of generating the target Excel file by using the target HTML according to a preset generation manner, the following steps are specifically implemented:
converting the target HTML into a preset BLOB file;
and generating a target Excel file according to the preset BLOB file.
In an embodiment, after implementing the steps of generating a target Excel file by the target HTML according to a preset generation manner and downloading the target Excel file, the processor 502 further implements the following steps:
prompting whether the target Excel file is encrypted;
and if an instruction for encrypting the target Excel file is received, popping up a preset encryption setting display frame to enable a user to set a password for the target Excel file.
In an embodiment, after the step of generating a target Excel file from the target HTML according to a preset generation manner, and downloading the target Excel file to export the preset table is implemented by the processor 502, the following steps are further implemented:
recording the downloading times of the preset table;
counting the download times of all the preset tables which are downloaded respectively;
sorting all the preset tables according to the sequence of the downloading times from large to small to obtain a table sorting queue;
acquiring the first n preset tables in the table sorting queue, wherein n is a natural number;
and displaying preset associated tables corresponding to the first n preset tables respectively.
In an embodiment, before the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form identifier is implemented by the processor 502, the following steps are further implemented:
judging whether a preset DOM structure corresponding to the preset form exists or not;
and if the preset DOM structure corresponding to the preset form does not exist, sending a prompt of download failure.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiments may be implemented by a computer program, and the computer program may be stored in a computer readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, the computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the steps of:
a computer program product which, when run on a computer, causes the computer to perform the steps of the page form export EXCEL method described in the embodiments above.
The computer readable storage medium may be an internal storage unit of the aforementioned device, such as a hard disk or a memory of the device. The computer readable storage medium may also be an external storage device of the device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the apparatus.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The storage medium is an entity and non-transitory storage medium, and may be various entity storage media capable of storing computer programs, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the application can be combined, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing an electronic device (which may be a personal computer, a terminal, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A page form export EXCEL method, comprising:
responding to a table downloading instruction, and acquiring a preset table identifier corresponding to a preset table to be downloaded in a page;
acquiring a preset DOM structure corresponding to the preset form according to the preset form identification;
acquiring a preset HTML template corresponding to the preset form, and embedding the preset DOM structure into the preset HTML template to obtain a target HTML;
and generating a target Excel file by the target HTML according to a preset generation mode, and downloading the target Excel file to export the preset table.
2. The method for exporting EXCEL from a page form according to claim 1, wherein the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form id comprises:
acquiring an initial DOM structure corresponding to the preset form according to the preset form identification;
judging whether the initial DOM structure contains a preset row merging attribute or a preset column merging attribute;
if the initial DOM structure contains a preset row combination attribute or a preset column combination attribute, combining preset columns associated with the preset row combination attribute or preset rows associated with the preset column combination attribute according to the preset row combination attribute or the preset column combination attribute so as to obtain a preset DOM structure corresponding to the preset table.
3. The method for exporting EXCEL from a page form according to claim 1, wherein the step of generating the target HTML into a target EXCEL file according to a preset generation manner comprises:
converting the target HTML into a preset Base64 format to obtain a target conversion value;
and setting the target conversion value into an Excel format to generate a target Excel file.
4. The method for exporting EXCEL from a page form according to claim 1, wherein the step of generating the target HTML into a target EXCEL file according to a preset generation manner comprises:
converting the target HTML into a preset BLOB file;
and generating a target Excel file according to the preset BLOB file.
5. The method for exporting EXCEL from a page form according to claim 1, wherein after the step of generating a target EXCEL file from the target HTML according to a preset generation manner and downloading the target EXCEL file, the method further comprises:
prompting whether the target Excel file is encrypted;
and if an instruction for encrypting the target Excel file is received, popping up a preset encryption setting display frame to enable a user to set a password for the target Excel file.
6. The method for exporting EXCEL from a page form according to claim 1, wherein after the step of generating a target EXCEL file from the target HTML according to a preset generation manner and downloading the target EXCEL file to export the preset form, the method further comprises:
recording the downloading times of the preset table;
counting the download times of all the preset tables which are downloaded respectively;
sorting all the preset tables according to the sequence of the downloading times from large to small to obtain a table sorting queue;
acquiring the first n preset tables in the table sorting queue, wherein n is a natural number;
and displaying preset associated tables corresponding to the first n preset tables respectively.
7. The method for exporting EXCEL from the page form according to any of claims 1 to 6, wherein before the step of obtaining the preset DOM structure corresponding to the preset form according to the preset form id, the method further comprises:
judging whether a preset DOM structure corresponding to the preset form exists or not;
and if the preset DOM structure corresponding to the preset form does not exist, sending a prompt of download failure.
8. An apparatus for exporting EXCEL from a page form, comprising:
the first obtaining unit is used for responding to the table downloading instruction and obtaining a preset table identifier corresponding to a preset table to be downloaded in the page;
the second obtaining unit is used for obtaining a preset DOM structure corresponding to the preset form according to the preset form identifier;
the embedding unit is used for acquiring a preset HTML template corresponding to the preset form and embedding the preset DOM structure into the preset HTML template to obtain target HTML;
and the export unit is used for generating a target Excel file by the target HTML according to a preset generation mode, downloading the target Excel file and exporting the preset table.
9. A computer device, comprising a memory and a processor coupled to the memory; the memory is used for storing a computer program; the processor is adapted to run the computer program to perform the steps of the method according to any of claims 1-7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when being executed by a processor, realizes the steps of the method according to any one of claims 1 to 7.
CN202011528250.4A 2020-12-22 2020-12-22 Page form export EXCEL method and device, computer equipment and storage medium Pending CN112632165A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011528250.4A CN112632165A (en) 2020-12-22 2020-12-22 Page form export EXCEL method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011528250.4A CN112632165A (en) 2020-12-22 2020-12-22 Page form export EXCEL method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112632165A true CN112632165A (en) 2021-04-09

Family

ID=75321097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011528250.4A Pending CN112632165A (en) 2020-12-22 2020-12-22 Page form export EXCEL method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112632165A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116656A (en) * 2022-01-25 2022-03-01 深圳希施玛数据科技有限公司 Data processing method and related device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156742A (en) * 2011-04-19 2011-08-17 北京神州数码思特奇信息技术股份有限公司 Method and middleware for supporting structured document display with own browser of mobile phone
CN103473234A (en) * 2012-06-07 2013-12-25 中兴通讯股份有限公司 Method, device and system for deriving report forms from web inquiring system
CN103605514A (en) * 2013-11-11 2014-02-26 北京奇虎科技有限公司 Front-end template processing method and device
CN107688456A (en) * 2017-05-05 2018-02-13 平安科技(深圳)有限公司 Document generating method, equipment and computer-readable recording medium
CN108874760A (en) * 2018-05-23 2018-11-23 中国平安人寿保险股份有限公司 Report file generation method, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156742A (en) * 2011-04-19 2011-08-17 北京神州数码思特奇信息技术股份有限公司 Method and middleware for supporting structured document display with own browser of mobile phone
CN103473234A (en) * 2012-06-07 2013-12-25 中兴通讯股份有限公司 Method, device and system for deriving report forms from web inquiring system
CN103605514A (en) * 2013-11-11 2014-02-26 北京奇虎科技有限公司 Front-end template processing method and device
CN107688456A (en) * 2017-05-05 2018-02-13 平安科技(深圳)有限公司 Document generating method, equipment and computer-readable recording medium
CN108874760A (en) * 2018-05-23 2018-11-23 中国平安人寿保险股份有限公司 Report file generation method, device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114116656A (en) * 2022-01-25 2022-03-01 深圳希施玛数据科技有限公司 Data processing method and related device

Similar Documents

Publication Publication Date Title
CN108874760B (en) Report file generation method, report file generation device, computer equipment and storage medium
CN109614568B (en) Page generation method and device
US9967370B2 (en) OData enabled mobile software applications
US20170192877A1 (en) Mobile application development and deployment
CN110941427B (en) Code generation method and code generator
CN111125598A (en) Intelligent data query method, device, equipment and storage medium
US11003835B2 (en) System and method to convert a webpage built on a legacy framework to a webpage compatible with a target framework
CN111061464B (en) Analysis code generation method, device, equipment and storage medium
CN112612452B (en) API platform realization method, device, equipment and storage medium
CN112559354A (en) Front-end code specification detection method and device, computer equipment and storage medium
WO2021249356A1 (en) Form data verification method, system, server, and user terminal
CN110162510A (en) Transcription comparison method, device, computer equipment and storage medium
US20130124969A1 (en) Xml editor within a wysiwyg application
CN112632165A (en) Page form export EXCEL method and device, computer equipment and storage medium
US10956659B1 (en) System for generating templates from webpages
US9990343B2 (en) System and method for in-browser editing
US10140278B2 (en) Computer-implemented methods and systems for associating files with cells of a collaborative spreadsheet
CN113721910A (en) Interface code generation method and device, electronic equipment and computer readable medium
CN113050921A (en) Webpage conversion method, device, storage medium and computer equipment
CN111078529A (en) Client write-in module testing method and device and electronic equipment
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
CN113626392A (en) Method and device for updating document data, electronic equipment and storage medium
US9304983B2 (en) Method and system for Xform generation and processing application integration framework
CN114254609A (en) Generation method and device of clinical care form, electronic equipment and readable medium
CN113064917A (en) Data query method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination