CN106844324B - Method for exporting variable column data into Excel format - Google Patents

Method for exporting variable column data into Excel format Download PDF

Info

Publication number
CN106844324B
CN106844324B CN201710096378.XA CN201710096378A CN106844324B CN 106844324 B CN106844324 B CN 106844324B CN 201710096378 A CN201710096378 A CN 201710096378A CN 106844324 B CN106844324 B CN 106844324B
Authority
CN
China
Prior art keywords
column
data
title
columns
row
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.)
Active
Application number
CN201710096378.XA
Other languages
Chinese (zh)
Other versions
CN106844324A (en
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.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software 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 Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN201710096378.XA priority Critical patent/CN106844324B/en
Publication of CN106844324A publication Critical patent/CN106844324A/en
Application granted granted Critical
Publication of CN106844324B publication Critical patent/CN106844324B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/174Form filling; Merging

Abstract

The invention discloses a method for deriving a variable column data into an Excel format, which comprises the following implementation processes: firstly, identifying the column attribute of the query data, namely the change rule, setting the corresponding rules of the columns and the database columns in a classified manner and the data conversion rule, and converting the query result into a title object and a data object according to the rules; arranging the query data into the data object according to the structure of the data object; and generating an Excel title format according to the title object, carrying out cell merging on the titles of the multilevel headers, and filling data lines according to the content of the data object. Compared with the prior art, the method for exporting the variable column data into the Excel format solves the problem of exporting the variable column data into the Excel format, realizes exporting the variable column data into the Excel format, facilitates the data to be transmitted, analyzed and used outside an information system, and has strong practicability.

Description

Method for exporting variable column data into Excel format
Technical Field
The invention relates to the technical field of computer application, in particular to a method for exporting variable column data into an Excel format.
Background
With the development and popularization of information-based systems, data presentation is more and more diversified, and a terminal user no longer meets the requirement on whether the system is available, so that the data in the information system needs to be exported into Excel, and the data is convenient to transfer, rearrange and use. At present, data export is realized by a plurality of software, but various problems occur when the data of a multi-level header change column is exported into an excel format, and some formats are added and combined in parallel, so that the exported content is very complex, and a client can hardly edit again; some situations occur such as missing information.
The invention provides a method for exporting changed column data into an Excel format, and aims to help solve the problem of exporting changed column data into the Excel format.
Disclosure of Invention
The technical task of the invention is to provide a method for exporting the variable column data into an Excel format aiming at the defects.
A method for deriving a variable column data into an Excel format is implemented by the following steps:
firstly, identifying the column attribute of the query data, namely the change rule, setting the corresponding rules of the columns and the database columns in a classified manner and the data conversion rule, and converting the query result into a title object and a data object according to the rules;
then, according to the structure of the data object, the query data is arranged in the data object;
and finally, generating an Excel title format according to the title object, carrying out cell merging on the titles of the multilevel headers, and filling data lines according to the content of the data object.
The identified column attributes of the query data include a changed data column, a fixed data column before the changed data column, a fixed column after the changed data column, i.e., a changed column, a fixed column before the changed column, and a fixed column after the changed column, wherein,
changing a fixed data column before the column, fixing the position of the column, and setting a column serial number or a column title to directly correspond to the Excel column; only setting the column attribute of the fixed column when the data of the non-changed column is imported;
a plurality of rows of the changed data are displayed according to the data content, and the title can be a multi-level header;
the fixed column after the modified column changes the column position according to the increase and decrease of the modified column, and the content of the title is set to correspond to the Excel column.
In the column attributes, the column serial number or column title of a fixed column before a changed column is kept unchanged when data is changed, and each row of data of the fixed column is one row of data stored in Excel; the variable columns are a combination of one or more columns, all columns of the combination appear when each time the variable is added, one row of data of one group of variable columns corresponds to one row of data of the fixed column, one row of data of the fixed column corresponds to multiple rows of data of the variable columns, the fixed column data and the variable column data are in a many-to-one relationship and are stored by a sub-table of the fixed column, wherein the fixed column refers to the fixed column before the variable column; when the data of the fixed column after the changed column changes, the column serial number changes, the column header remains unchanged, and each row of data of the fixed column before the changed column are in one-to-one correspondence.
The title of the export data is arranged into an export format according to the characteristics of the data structures of the variable column, the fixed column before the variable column and the fixed column after the variable column: the title export format is organized into a tree structure because the export title supports multi-level headers, and when the multi-level headers are not available, all headers are the first level of the tree; changing fixed columns in front of the columns, sorting according to a tree-level structure, and indicating columns exported by detailed fixed titles and columns occupied in the Excel file; changing columns, arranging according to a tree level structure, and indicating columns exported by detailed changing titles and columns occupied in the Excel file; the fixed columns after the columns are changed are arranged according to a tree-level structure, and the detailed titles indicate columns from which data are exported and columns occupied in the Excel file.
The data structure of the variable column, the fixed column before the variable column and the fixed column after the variable column are sorted into a export format according to the characteristics: first creating an exported data structure from the column indicated by the detailed title; the export data is arranged into data lines according to the created data structure.
The title object is a set of title attributes which are sorted after the query result is stored, and the attributes comprise: title name, corresponding storage field, hierarchical structure; the data object is row data for storing the query result organized according to the requirement of the change column, and each row of data is created according to the sequence of the detail titles.
The process of converting the query result into the title object and the data object specifically comprises the following steps:
firstly, taking out a query result, and acquiring a nonrepeated value corresponding to a header field of a variable column for later use according to the query result; taking out column attribute setting information, and taking out the next column attribute setting; judging whether the column is a fixed column before the variable column;
if the fixed column in front of the row is changed, a title object is set, the title name is the same as the row attribute title name, other attributes of the title object are also taken from the row attributes, then whether the title object is a detail row or not is judged, if the title object is judged to be the detail row, the detail row object is added to the data object, and the field name is a row attribute median field; if not, judging whether a next column exists;
if the fixed column before the column is changed is judged not to be changed, judging whether the fixed column after the column is changed or not, if so, setting a title object, wherein the title name is the same as the column attribute title name, and other attributes of the title object are also taken from the column attributes, and then continuing judging whether the detailed column is detailed or not;
if not, the current column object is a change column, and the non-repeated values obtained in the step are processed; firstly, sequentially taking a non-repeated value corresponding to a current title column, and setting a title object, wherein the title name is the taken non-repeated value; then, judging whether the current column object is a detail column object, if so, adding the column to the data object; if the judgment is no, judging whether a next non-repeated value exists, if so, acquiring the next non-repeated value of the current change column, and re-acquiring the non-repeated value of the title field of the change column;
if the next column exists, the next column attribute is set, and if the next column does not exist, the processing of all the column attributes is finished, and the work of arranging the title object and the data object is finished.
The process of sorting the query data into data objects is as follows:
firstly, acquiring a non-repeated value of a fixed column field; then, taking a piece of sorted data, wherein the piece of data is a new line of data of a data object, adding a new line of data to the data object, and assigning the value of the current line to the corresponding fixed column in the data object;
then, a detail title object of a variable column is taken, the value of the detail object is assigned according to the fact that the value corresponding to the detail title field is searched according to the values of all the fixed columns and the values of the detail titles; then, whether a next detail title object exists is judged, if yes, a value is taken down, the step of taking down the next detail title object of the change column and the subsequent operation steps are carried out again, and if not, whether the next column exists is judged; if yes, taking down one value, and repeating the steps of taking down one fixed row of unrepeated values and subsequent operations; if not, finishing the data sorting work.
The data export is that the process of generating an Excel title format file according to the title object comprises the steps of firstly sorting multilevel header information, exporting the title to an Excel title line and recording the number of lines occupied; and filling the data which is arranged into the export format according to the characteristics of the column exported by the multi-level header detail header data which is arranged into the export format according to the characteristics of the column and the column information occupied in the Excel file into the data row corresponding to the Excel.
The specific process of generating the Excel title format according to the title object comprises the following steps:
firstly, performing data preparation before exporting, acquiring the maximum stage number and the maximum detail column number of a title object, and setting a starting row 1 and a starting column 1; taking down a title object from the title objects, and judging whether the title is detailed or not;
if so, setting the number of occupied lines 1 of the current title in the number of occupied columns 1, searching title grids through the attributes of the starting lines and the starting columns, and assigning values to the title grids; after the assignment of the detail title grids is completed, assigning a value to a subsequent title grid, and adding 1 to the value of a starting line; then, whether a next title object exists is judged;
if the number of the detail titles is not the same as the number of the current title, acquiring the number of lower-level layers and upper-level layers of the current title, wherein the attributes are used for controlling the merging cells, and setting the number of columns occupied by the titles as the number of the detail titles; then, judging whether the current title is the first level; if yes, setting a starting column as 1, and setting the number of lines occupied by the title: maximum stage number-next stage number, and column number merging cells according to occupied row number; if not, setting the starting column as the maximum stage number-the upper-level layer number +1, and merging the cells according to the number of occupied rows and the number of occupied columns; after the cells are combined, assigning the title value of the current title object to the combined cells; then, whether a next title object exists is judged;
if yes, continuing to take down a title object and subsequent operations; if not, ending the data line filling operation for the title lattice assignment operation; taking the next row of data objects, and filling data by using the row with the maximum level and the row with the maximum level plus 1, wherein the filling sequence is consistent with the created sequence; after the data filling is finished, resetting the maximum grade value to be the maximum grade number + 1; judging whether a next line of data objects exists, if so, continuing to execute the steps of taking the next line of data objects and subsequent operations thereof, and continuing to fill the line data; if not, ending the data filling work.
Compared with the prior art, the method for deriving the variable column data into the Excel format has the following beneficial effects:
the method for exporting the changed column data into the Excel format solves the problem of exporting the changed column data into the Excel format, realizes the export of the changed column data into the Excel format, facilitates the transmission, analysis and use of the data outside an information system, has strong practicability and wide application range, can be applied to an information management system to export the changed column data into the Excel format, and has good popularization and application values.
Drawings
FIG. 1 is a schematic diagram of a process for arranging title objects and data objects according to the present invention.
FIG. 2 is a schematic diagram illustrating an execution process of query data sorting according to the present invention.
FIG. 3 is a schematic diagram of the Excel flow execution of data export according to the present invention.
Detailed Description
The present invention will be further described with reference to the following specific examples.
The invention provides a method for exporting data of a changed column into an Excel format, which aims to help the data of the changed column in an information system to be exported into the Excel format and facilitate the data to be transmitted, analyzed and used outside the information system.
The method mainly comprises the steps of identifying the column attributes of the query data, namely the change rules of the query data, and classifying and setting the corresponding rules and the data conversion rules of the columns and the database columns. The query results are converted into a title object and a data object according to the rules. The query data is then arranged into data objects according to their structure. And finally, generating an Excel title format according to the title object, and carrying out cell merging on the title of the multi-level header. The data lines are populated according to the data object content. By using the setting method, the output of the changed column data into an Excel format can be realized, and the data can be conveniently transmitted and used outside an information system.
The identified column attributes of the query data include a changed data column, a fixed data column before the changed data column, and a fixed column after the changed data column, that is, which columns are fixed data columns, which columns are changed data columns, and which columns are fixed columns after the changed data column:
the fixed data sequence before the modified sequence does not change the position of the sequence due to the increase or decrease of the modified sequence, and does not increase or decrease, so that a sequence directly corresponding to Excel, such as a sequence number or a sequence title, can be provided. The data import of the non-variable column sets only the column attribute of the fixed column.
The data columns are changed, such as a product sales data statistical table performed by month and the like, and are displayed in multiple columns according to data contents (statistical months), titles can be in a multi-level header (grouped by seasons), some non-detailed titles need to be provided with corresponding Excel columns according to the titles, title contents are stored in the columns, detailed titles are provided with corresponding Excel columns according to the contents, and the data contents are stored in the columns.
In the fixed column after the modified column, the position of the column changes due to the increase and decrease of the modified column, and therefore, the content of the header needs to be set to correspond to the column of Excel.
The above-mentioned fixed column precedes the modified column, and when data is modified, the column number or column header of the fixed column is kept unchanged.
Each row of data of the fixed column is stored in Excel to form a row of data.
The change column is a combination of one or more columns. All columns of this combination will appear with each incremental change.
The columns and data corresponding to the changed columns are changed according to groups and are increased or decreased according to the statistical display requirement.
One row of data of a group of changed columns corresponds to one row of data of a fixed column. Therefore, the data in the fixed column in one row is in a plurality of rows corresponding to the data in the variable column, and the fixed column data and the variable column data are in a many-to-one relationship, and need to be stored in a sub-table of the fixed column.
In the change column of the multi-level header, the content of some non-detail headers is changed, and the corresponding column of the sub-table needs to be stored, and the content of some non-detail headers is not changed and is not processed. The detail headers all correspond to data, and need to correspond to the data columns of the sub-tables.
The fixed column after the changed column has a changed column number and a unchanged column header when data is changed.
One row of data and one row of data of a fixed column before the variable column are in one-to-one correspondence, and can be stored in one row.
More specifically, the query data attribute is set in the present invention. The method comprises the following steps: : column number, title name, whether fixed column, change column, etc., as in the following table.
Figure BDA0001230400650000051
Figure BDA0001230400650000061
The column characteristics store display characteristics of Excel, and are as follows:
left | yyyy year MM month dd day: segmentation is done with | in alignment mode in front and formatting mode in back.
The title of the export data is arranged into an export format according to the characteristics of the data structures of the variable column, the fixed column before the variable column and the fixed column after the variable column: the title export format is organized into a tree structure because the export title supports multi-level headers, and when the multi-level headers are not available, all headers are the first level of the tree; changing fixed columns in front of the columns, sorting according to a tree-level structure, and indicating columns exported by detailed fixed titles and columns occupied in the Excel file; changing columns, arranging according to a tree level structure, and indicating columns exported by detailed changing titles and columns occupied in the Excel file; the fixed columns after the columns are changed are arranged according to a tree-level structure, and the detailed titles indicate columns from which data are exported and columns occupied in the Excel file.
The data structure of the variable column, the fixed column before the variable column and the fixed column after the variable column are sorted into a export format according to the characteristics: first creating an exported data structure from the column indicated by the detailed title; the export data is arranged into data lines according to the created data structure.
The title object is a set of title attributes which are sorted after the query result is stored, and the attributes comprise: title name, corresponding storage field, hierarchical structure; the data object is row data for storing the query result organized according to the requirement of the change column, and each row of data is created according to the sequence of the detail titles.
Further, the present invention is explained in detail:
first, the title object and the data object are arranged as shown in FIG. 1. The most important execution rules in the flow are described as follows:
the title object is a set of title (including change column) objects which are sorted after the query result is stored, and the attributes comprise: title name, corresponding storage field, hierarchy, etc.
The data object is row data for storing the query result organized according to the requirement of the change column, and each row of data is created according to the sequence of the detail titles.
First, the query results are fetched. And acquiring a non-repeated value A101 corresponding to the header field of the change column for standby according to the query result. The column attribute setting information is taken out, and the next column attribute setting a102 is taken out. It is determined whether or not the column is the pre-fluctuation fixed column a 103.
If the judgment of A103 is yes, a title object A104 is set, the title name is the same as the column attribute title name, other attributes of the title object are also taken from the column attributes, whether the column A105 is detailed or not is judged, if the judgment of A105 is yes, the data object is added with a detail column object A106, and the field name is the median field of the column attributes. If A105 judges no, it judges whether there is the next column A107.
Generally, a detail column refers to a specific column, for example, in a multi-level header grouped by quarters, a column corresponding to each month in each quarter is the detail column.
If A103 judges no, the judgment is made as to whether the column is changed or not and then the column A108 is fixed. If A108 judges yes, title object A104 is set, title name is the same as column attribute title name, other attributes of title object are also taken from column attribute, and then whether to detail column A105 judgment is continued.
If a108 judges no, the current column object is a modified column, and it is necessary to process the non-repeated values acquired by a 101. First, a non-duplicate value a109 corresponding to the current title column is sequentially selected, and a title object a110 is set, with the title name being the selected non-duplicate value. Then, judging whether the current column object is a detail column object A112, if the judgment of A112 is yes, adding the data object to the column A111; if A112 judges no, A113 judges whether there is a next non-repeated value, if A113 judges yes, A109 takes a value which is changed at present and is next non-repeated, and A110 is performed again. If A113 judges no, it judges whether or not there is the next column A107.
If the judgment of A107 is yes, the next column attribute is taken to be set A102, and if the judgment of A107 is no, the processing of all the column attributes is finished, and the work of arranging the title object and the data object is finished.
Secondly, query data sorting is carried out, and the query data sorting is shown in the attached figure 2. The most important execution rules in the flow are described as follows:
first, a value a201 is obtained in which the fixed column field does not overlap. Then, a piece of data a202 after being sorted by a201 is taken, the piece of data is a new line of data of a data object, a new line needs to be added to the data object, and a value a203 of the current line is assigned to a column corresponding to a fixed column in the data object.
Then, a detail header object A204 of one change column is taken, the detail header object is an object directly with a data column, and the detail header object is not used for processing without the data column. The value of this detail object is assigned a205 according to the fact that the value corresponding to the detail header field is found according to the values of all the fixed columns and the values of the detail header. Then, a judgment a206 is made as to whether there is a next caption object, if the judgment a206 is yes, a next value is taken, and a judgment a204 and its subsequent operations are re-performed, and if the judgment a206 is no, a judgment a207 is made as to whether there is a next column. If A207 is judged yes, then the next value is taken, and A202 and the following operations are carried out again. If A207 judges no, the data finishing work is finished.
And thirdly, deriving data as Excel, which is shown in the attached figure 3. The most important execution rules in the flow are described as follows:
first, a pre-export data preparation operation is performed, the maximum number of stages and the maximum number of detail columns of the title object are acquired, and the start row 1 and the start column 1a301 are set. The next title object a302 is taken out of the title objects, and whether or not the title is detailed a303 is determined.
If the judgment of A303 is yes, setting the current title occupation column number 1 occupation line number 1A304, finding the title lattice by the attribute of the start line and the start column, and assigning A305 to the title lattice. After the assignment of the detail header lattice is completed, the subsequent header lattice is assigned with a value of a starting row added with a 306. Then, a judgment is made as to whether or not there is a next title object a 307.
If A303 judges no, the number of the detail titles of the current title, the lower layer number and the upper layer number A308 are acquired, these attributes are used to control the merge cells, and the number of the occupied title columns is set to the number A309 of the detail titles. Then, it is judged whether or not the current title is the first level a 310. If the judgment of A310 is yes, the start column is set to be 1A312, the number of occupied title lines is set: the maximum number of levels-the number of next levels a313, the number of columns occupied according to the number of occupied rows merge cell a 314. If the judgment result of A310 is no, the starting column is set to be the maximum stage number-the upper stage number +1A311, and the cell A314 is merged according to the number of occupied rows and occupied columns. After the cells are merged, the merged cells are assigned the title value A315 of the current title object. Then, a judgment is made as to whether or not there is a next title object a 307.
If A307 is judged as yes, the operation of taking down the next title object A302 and the subsequent operation are continued. If the judgment of A307 is no, the data line filling operation for the title lattice assignment operation is finished. The next row of data object a316 is removed, and data a317 is filled starting with the row of the maximum number of stages +1, and the order of filling is the same as the order of creation. After the data filling is finished, the maximum stage value is reset to be the maximum stage number +1A 318. And judging whether a next line data object A319 exists or not, if the judgment of A319 is yes, continuing to execute A316 and subsequent operations, and continuing to fill line data. If the judgment of A319 is no, the data stuffing work is ended.
The present invention can be easily implemented by those skilled in the art from the above detailed description. It should be understood, however, that the intention is not to limit the invention to the particular embodiments described. On the basis of the disclosed embodiments, a person skilled in the art can combine different technical features at will, thereby implementing different technical solutions.
In addition to the technical features described in the specification, the technology is known to those skilled in the art.

Claims (9)

1. A method for deriving a variable column data into an Excel format is characterized by comprising the following implementation processes:
firstly, identifying the column attributes of query data, namely the change rules of the query data, setting corresponding rules and data conversion rules of Excel columns and database columns in a classified manner, and converting query results into title objects and data objects according to the rules;
the column attributes of the identified query data include a changed data column, a fixed column before the changed data column, and a fixed column after the changed data column, i.e., a changed column, a fixed column before the changed column, and a fixed column after the changed column, wherein,
changing a fixed column in front of the column, fixing the position of the column, and directly corresponding the column serial number or the column title to the Excel column; only setting the column attribute of the fixed column when the data of the non-changed column is imported;
a plurality of rows of changed data, which are displayed in a plurality of rows according to the data content and have a header of a plurality of levels;
a fixed column after the column is changed, wherein the position of the column is changed due to the increase and decrease of the changed column, and the content of the title is arranged to correspond to the Excel column;
then, according to the structure of the data object, the query data is arranged in the data object;
and finally, generating an Excel title format according to the title object, carrying out cell merging on the titles of the multilevel headers, and filling data lines according to the content of the data object.
2. The method for deriving the Excel format from the changed column data according to claim 1, wherein in the column attributes, the column serial number or column header of a fixed column before the changed column is kept unchanged when the data is changed, and each row of data of the fixed column is a row of data stored in Excel; the variable columns are a combination of one or more columns, all columns of the combination appear when each time the variable is added, one row of data of one group of variable columns corresponds to one row of data of the fixed column, one row of data of the fixed column corresponds to multiple rows of data of the variable columns, the fixed column data and the variable column data are in a many-to-one relationship and are stored by a sub-table of the fixed column, wherein the fixed column refers to the fixed column before the variable column; when the data of the fixed column after the changed column changes, the column serial number changes, the column header remains unchanged, and each row of data of the fixed column before the changed column are in one-to-one correspondence.
3. The method of claim 2, wherein the header of the exported data is arranged in an export format: the title export format is organized into a tree structure because the export title supports multi-level headers, and when the multi-level headers are not available, all headers are the first level of the tree; changing fixed columns in front of the columns, sorting according to a tree-level structure, and indicating columns exported by detailed fixed titles and columns occupied in the Excel file; changing columns, arranging according to a tree level structure, and indicating columns exported by detailed changing titles and columns occupied in the Excel file; the fixed columns after the columns are changed are arranged according to a tree-level structure, and the detailed titles indicate columns from which data are exported and columns occupied in the Excel file.
4. The method of claim 3, wherein the derived data is formatted in an export format as follows: first creating an exported data structure from the column indicated by the detailed title; the export data is arranged into data lines according to the created data structure.
5. The method of claim 4, wherein the title object is a set of title attributes sorted after storing the query result, and the attributes include: title name, corresponding storage field, hierarchical structure; the data object is row data for storing the query result organized according to the requirement of the change column, and each row of data is created according to the sequence of the detail titles.
6. The method for deriving the varying-column data into the Excel format according to any one of claims 2 to 5, wherein the process of converting the query result into the header object and the data object specifically comprises:
firstly, taking out a query result, and acquiring a nonrepeated value corresponding to a header field of a variable column for later use according to the query result; taking out column attribute setting information, and taking out the next column attribute setting; judging whether the column is a fixed column before the variable column;
if the fixed column in front of the row is changed, a title object is set, the title name is the same as the row attribute title name, other attributes of the title object are also taken from the row attributes, then whether the title object is a detail row or not is judged, if the title object is judged to be the detail row, the detail row object is added to the data object, and the field name is a value field in the row attributes; if not, judging whether a next column exists;
if the fixed column before the column is changed is judged not to be changed, judging whether the fixed column after the column is changed or not, if so, setting a title object, wherein the title name is the same as the column attribute title name, and other attributes of the title object are also taken from the column attributes, and then continuing judging whether the detailed column is detailed or not;
if not, the current column object is a change column, and the non-repeated values obtained in the step are processed; firstly, sequentially taking a non-repeated value corresponding to a current title column, and setting a title object, wherein the title name is the taken non-repeated value; then, judging whether the current column object is a detail column object, if so, adding the column to the data object; if the judgment is no, judging whether a next non-repeated value exists, if so, acquiring the next non-repeated value of the current change column, and re-acquiring the non-repeated value of the title field of the change column;
if the next column exists, the next column attribute is set, and if the next column does not exist, the processing of all the column attributes is finished, and the work of arranging the title object and the data object is finished.
7. The method of claim 6, wherein the sorting of query data into data objects comprises:
firstly, acquiring a non-repeated value of a fixed column field; then, taking a piece of sorted data, wherein the piece of data is a new line of data of a data object, adding a new line of data to the data object, and assigning the value of the current line to the corresponding fixed column in the data object;
then, a detail title object of a variable column is taken, the value of the detail title object is assigned according to the fact that the value corresponding to the detail title field is searched according to the values of all the fixed columns and the values of the detail titles; then, whether a next detail title object exists is judged, if yes, a value is taken down, the step of taking down the next detail title object of the change column and the subsequent operation steps are carried out again, and if not, whether the next column exists is judged; if yes, taking down one value, and repeating the steps of taking down one fixed row of unrepeated values and subsequent operations; if not, finishing the data sorting work.
8. The method according to claim 6, wherein the process of generating an Excel title format from a title object comprises the steps of firstly sorting multi-level header information, exporting a title to an Excel title line, and recording the number of lines occupied; and filling the data which is arranged into the export format into the data rows of the corresponding Excel according to the export column of the multi-level header detail header data of the export format and the column information occupied in the Excel file.
9. The method according to claim 8, wherein the specific process of generating an Excel title format from a title object comprises:
firstly, performing data preparation before exporting, acquiring the maximum stage number and the maximum detail column number of a title object, and setting a starting row 1 and a starting column 1; taking down a title object from the title objects, and judging whether the title is detailed or not;
if so, setting the number of occupied lines 1 of the current title in the number of occupied columns 1, searching title grids through the attributes of the starting lines and the starting columns, and assigning values to the title grids; after the assignment of the detail title grids is completed, assigning a value to a subsequent title grid, and adding 1 to the value of a starting line; then, whether a next title object exists is judged;
if the number of the detail titles is not the same as the number of the current title, acquiring the number of lower-level layers and upper-level layers of the current title, wherein the attributes are used for controlling the merging cells, and setting the number of columns occupied by the titles as the number of the detail titles; then, judging whether the current title is the first level; if yes, setting a starting column as 1, and setting the number of lines occupied by the title: maximum stage number-next stage number, and column number merging cells according to occupied row number; if not, setting the starting column as the maximum stage number-the upper-level layer number +1, and merging the cells according to the number of occupied rows and the number of occupied columns; after the cells are combined, assigning the title value of the current title object to the combined cells; then, whether a next title object exists is judged;
if yes, continuing to take down a title object and subsequent operations; if not, ending the data line filling operation for the title lattice assignment operation; taking the next row of data objects, and filling data by using the row with the maximum level and the row with the maximum level plus 1, wherein the filling sequence is consistent with the created sequence; after the data filling is finished, resetting the maximum grade value to be the maximum grade number + 1; judging whether a next line of data objects exists, if so, continuing to execute the steps of taking the next line of data objects and subsequent operations thereof, and continuing to fill the line data; if not, ending the data filling work.
CN201710096378.XA 2017-02-22 2017-02-22 Method for exporting variable column data into Excel format Active CN106844324B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710096378.XA CN106844324B (en) 2017-02-22 2017-02-22 Method for exporting variable column data into Excel format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710096378.XA CN106844324B (en) 2017-02-22 2017-02-22 Method for exporting variable column data into Excel format

Publications (2)

Publication Number Publication Date
CN106844324A CN106844324A (en) 2017-06-13
CN106844324B true CN106844324B (en) 2020-01-10

Family

ID=59134040

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710096378.XA Active CN106844324B (en) 2017-02-22 2017-02-22 Method for exporting variable column data into Excel format

Country Status (1)

Country Link
CN (1) CN106844324B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019437A (en) * 2017-07-18 2019-07-16 北京京东尚科信息技术有限公司 A kind of method and system exporting data
CN108399251A (en) * 2018-03-05 2018-08-14 贵州工程应用技术学院 A kind of Intelligence Generator and data exhibiting process that multi-layer data shows
CN109284254A (en) * 2018-10-16 2019-01-29 浪潮天元通信信息系统有限公司 A kind of general excel document handling method
CN111352983A (en) * 2018-12-24 2020-06-30 深圳市优必选科技有限公司 Service attribute dynamic expansion method and device, computer equipment and storage medium
CN109800264A (en) * 2018-12-27 2019-05-24 平安科技(深圳)有限公司 Diversified declaration form deriving method, device and storage medium
WO2021022553A1 (en) * 2019-08-08 2021-02-11 Microsoft Technology Licensing, Llc Spreadsheet table transformation
CN112580317A (en) * 2020-12-29 2021-03-30 江苏金财信息技术有限公司 Method for rapidly generating dynamic cross two-dimensional table with hierarchical summary
CN113901214B (en) * 2021-10-08 2023-11-17 北京百度网讯科技有限公司 Method and device for extracting form information, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103587A (en) * 2009-12-17 2011-06-22 北大方正集团有限公司 Method and device for converting form
CN103064689A (en) * 2013-01-04 2013-04-24 大唐软件技术股份有限公司 Implementation method and system for dynamically generating report pages

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2838165A1 (en) * 2012-12-31 2014-06-30 Smart Technologies Ulc Method for manipulating tables on an interactive input system and interactive input system executing the method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103587A (en) * 2009-12-17 2011-06-22 北大方正集团有限公司 Method and device for converting form
CN103064689A (en) * 2013-01-04 2013-04-24 大唐软件技术股份有限公司 Implementation method and system for dynamically generating report pages

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Excel中式报表自动化设计;林志鹏;《湖南医科大学学报(社会科学版)》;20080531;第10卷(第3期);第250-252页 *
Learning the characteristics of critical cells from web tables;George Nagy;《21st International Conference on Pattern Recognition》;20121111;第1554-1557页 *

Also Published As

Publication number Publication date
CN106844324A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
CN106844324B (en) Method for exporting variable column data into Excel format
CN102193786B (en) Device and method for constructing self-adaptive graphic user interface (GUI)
CN101382957B (en) System for establishing enquiry model and establishing method
CN110674154B (en) Spark-based method for inserting, updating and deleting data in Hive
CN104408159B (en) A kind of data correlation, loading, querying method and device
CN104915450A (en) HBase-based big data storage and retrieval method and system
CN104035754A (en) XML (Extensible Markup Language)-based custom code generation method and generator
CN101916382A (en) Method for recognizing image of plant leaf
CN105488231A (en) Self-adaption table dimension division based big data processing method
CN201867789U (en) Self-adaptive graphical user interface building device
CN104298700A (en) Method for generating control-code by a control-code-diagram
CN111159180A (en) Data processing method and system based on data resource directory construction
CN106293541A (en) A kind of blog management method storing system and system
CN111475511A (en) Data storage method, data access method, data storage device, data access device and data access equipment based on tree structure
CN111291543B (en) Data display method and device, storage medium and processor
CN103678513A (en) Interactive search generation method and system
CN111625596A (en) Multi-source data synchronous sharing method and system for real-time consumption scheduling of new energy
CN114207598A (en) Electronic form conversion
US20070255746A1 (en) Method for Processing Associated Software Data
CN115408543A (en) Multi-source geological data processing method and system based on three-dimensional geological model
CN105989276A (en) Role optimization method and apparatus in RBAC permission system
CN112528613A (en) Data table generation method and related equipment thereof
KR102028487B1 (en) Document topic modeling apparatus and method, storage media storing the same
CN105303341A (en) Intelligent extensible order allocation method based on priority and device
CN104408316A (en) Chinese and American geotechnical engineering soil classification criterion conversion device and method

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
GR01 Patent grant
GR01 Patent grant