Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terms to which the present invention relates will be explained first:
a meter head: is the header of the table, which is used to indicate the content and meaning of the rows of each column of the table. This section generally includes basic information of the form, such as the name of the form, the time of creation, etc.
Surface body: refers to the data reporting area of the form dynamic, and this part generally includes the specific data information to be embodied by the form.
And (4) table tail: refers to the end of the table, and this part generally includes some supplementary information of the table, such as the remark of some information in the table. The head and the tail of the table belong to parts with fixed forms and contents in the table.
Framework of the table: is comprised of the row and column lines in the table. The meter head frame consists of meter head row lines and meter body row lines, the meter tail frame consists of meter tail row lines and meter tail column lines.
Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.
The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Example one
FIG. 1 is a flowchart of a table drawing method according to an embodiment of the present invention; fig. 2 is an effect diagram of the conventional header frame drawing according to the first embodiment of the present invention; fig. 3 is an effect diagram of the improved header frame drawing according to an embodiment of the present invention. The embodiment of the invention provides a table drawing method aiming at the problems that after typesetting by the conventional automatic typesetting system, the drawing of a table frame comprising a plurality of layers of merging cells is not beneficial to readers to quickly know the integral structure of data in a table, does not meet the typesetting requirements of scientific books and magazines on the table, needs to manually adjust the frames of corresponding rows or columns of the merging cells, and is low in typesetting efficiency and poor in typesetting effect. As shown in fig. 1, the method comprises the following specific steps:
step S101, obtaining merging cell information in a header and merging cell information in a body of a table, wherein a frame of the table comprises a header frame and a body frame.
Wherein the merging cell information at least includes: the position information of the merged cells, the number of cells included in the horizontal direction, and the number of cells included in the vertical direction.
And step S102, drawing the row lines of the header frame into a first color and drawing the column lines of the header frame into a second color according to the merged cell information in the header.
The first color can be set to any color by technicians according to actual needs, is the main color of the table, and the second color is the preset background color when the table is displayed. Since the background color of a document such as a scientific journal is white, the first color is preferably black, and the second color is preferably white. In addition, for some scientific magazines and the like, in order to enable the table contents to be highlighted, sometimes the background color is set to be red, yellow or the like, and at this time, the second color should coincide with the background color.
As shown in fig. 2, the prior art draws a table frame in which all row and column lines are drawn in black. In this embodiment, taking the background color of the document as white as an example, the first color may be black that can be highlighted with respect to the background color, and the second color may be white that is consistent with the background color.
And step S103, drawing a row line in the form frame according to the merging cell information in the form.
In this embodiment, according to the merging cell information in the form body, the form body can be divided into a plurality of data block regions according to the gathering lines in the form body, data in each data block region is relatively independent, when the form body frame is drawn, the row lines of each gathering line and the boundary of each data block region are drawn, the row lines in each data block region are drawn according to the merging cell information in each data block region, and the column lines of the form body are not drawn, so that the drawn form body frame can highlight the structure of form data, and the conventional typesetting requirements of a scientific book and a scientific magazine on the form are better met.
According to the embodiment of the invention, by acquiring the merging cell information in the header and the merging cell information in the body of the table, the row lines of the header frame are drawn into a first color according to the merging cell information in the header, and the column lines in the header frame are drawn into a second color, so that the row lines in the header are divided into the cells of the header; and according to the merging cell information in the form body, drawing the row lines in the form body frame, but not drawing the row lines in the form body frame, so as to reduce the influence of the row lines in the form on the display effect of the overall structure of data in the form, and better meet the typesetting requirements of scientific books and scientific magazines on the form, and the frames of the corresponding rows or columns of the merging cells do not need to be adjusted manually, so that the typesetting efficiency of the form can be improved, and the typesetting effect is improved.
Example two
FIG. 4 is a flowchart of a table drawing method according to a second embodiment of the present invention; FIG. 5 is a table structure diagram according to a second embodiment of the present invention; fig. 6 is a schematic diagram of another table structure according to the second embodiment of the present invention. On the basis of the first embodiment, in this embodiment, drawing a row line in the form frame according to the merged cell information in the form includes: acquiring content information of a header; determining at least one independent area of the watch body in the horizontal direction according to the content information of the watch head, wherein the content information of the watch head corresponding to the at least one independent area is consistent; and respectively taking each independent area as a target area, and drawing the row lines in the target area according to the merged cell information in the target area. As shown in fig. 4, the step S103 may be implemented by the following steps:
and step S1030, acquiring the content information of the header.
In practical applications, there is a table structure as shown in fig. 5, where the left 4 columns and the right 4 columns of the table have the same meaning, and when drawing a table frame, the table should be divided into two relatively independent areas, and the table frame in each independent area should be drawn separately.
In this embodiment, in the process of drawing the row line in the body frame according to the merged cell information in the body, the content information of the header is first obtained, so that the independent area included in the table can be obtained by analyzing the content information of the header.
And step S1031, determining at least one independent area of the watch body in the horizontal direction according to the content information of the watch head, wherein the content information of the watch head corresponding to the at least one independent area is consistent.
In this embodiment, at least one independent area of the watch body in the horizontal direction is determined according to the content information of the watch head, which may be specifically implemented as follows:
(1) after the content information of the header is acquired, analyzing the header information, and determining whether the header can be divided into at least two header areas with consistent content information in the horizontal direction; if the header can be divided into at least two header areas with consistent content information in the horizontal direction, determining that the header corresponding to the header comprises at least two independent areas in the horizontal direction, wherein the header area corresponding to the column where each header area of the header is located is an independent area of the header; if the header can not be divided into at least two header areas with consistent content information in the horizontal direction, the whole watch body is taken as an independent area.
For example, as shown in the table shown in fig. 4, the 1 st, 2 nd, 3 rd, and 4 th cells from the left of the header are used as a header region, the 5 th, 6 th, 7 th, and 8 th cells from the left are used as a header region, the header regions both include the content information of the four fields of "latent variable", "number", "observation variable", and "variable type", and the header regions both include the same content information. Therefore, the body area corresponding to the 1 st, 2 nd, 3 rd and 4 th columns from the left is an independent area, and the body area corresponding to the 5 th, 6 th, 7 th and 8 th columns from the left is another independent area.
(2) After the content information of the header is acquired, the header information is analyzed, and whether the part except the header cells corresponding to the specified column of the header can be divided into at least two sections of header areas with consistent content information in the horizontal direction or not is determined. If the part except the head cells corresponding to the designated column of the head can be divided into at least two sections of head regions with consistent content information in the horizontal direction, determining that the body corresponding to the head comprises at least two independent regions in the horizontal direction, and determining that the body region corresponding to the column where each section of head region of the head is located is an independent region of the body. If the part except the head table cells corresponding to the designated list of the head table cannot be divided into at least two sections of head table areas with consistent content information in the horizontal direction, the whole body area except the designated list of the body table is taken as an independent area.
The designated column is a column set by a technician according to actual needs, and the column may be a first column in a table, a last column in the table, and the like. The implementation manner (2) is applied to a column in a table, which has a fixed meaning and has no association relation with other data in the table body, such as a table number column.
The following steps S1032 to S1039 are a specific embodiment of rendering the row lines in the target region according to the merged cell information in the target region, with each of the independent regions being the target region.
And S1032, respectively taking each independent area as a target area, and acquiring a summary line in the target area according to the merging cell information in the target area.
The summary line is a line in which a first merged cell exists in the target area, and the first merged cell is a cell formed by merging at least two cells in the horizontal direction.
In this embodiment, according to the merged cell information in the target area, a row in the target area where the first merged cell exists is determined as a summary row by analyzing the merging situation of each cell in the target area in the horizontal direction.
For example, the body area of the table shown in fig. 6 is an independent area in which there are three first cells, and the cell contents are cells of "small sample size in the lake area of the rain", "small sample size in the pond county", and "small sample size in the pond city of Hung. The behaviors of the three first cells are gathered.
Step S1033, draw the row lines of the summary row to the first color.
The first color and the second color in this embodiment are the same as those in the first embodiment, and the description of this embodiment is omitted here.
Optionally, the width of the summary row coincides with the width of the target area.
Step S1034, the summary line divides the portion of the target area except the summary line into at least one data block area.
In this embodiment, after the aggregation line is determined, the aggregation line divides the target area into at least one data block area, and at least one aggregation line is spaced between two adjacent data block areas.
For example, as in the table shown in fig. 6, the summary line divides the target area into two data block areas based on the summary line determined in step S1032.
In step S1035, it is determined whether the number of cells included in all columns in the data block area is the same in each data block area.
Steps S1035 to S1039 are specific embodiments of a process of drawing, in each data block region, a row line of the data block region according to the merged cell information in the vertical direction in each column in the data block region. In this embodiment, the processing procedure may be performed on each data block region one by one, or may be performed on a plurality of data block regions in parallel, and the processing procedures performed on each data block region are independent from each other, and do not affect the processing of other data block regions.
In this embodiment, it is first determined whether the number of cells included in all the columns in the data block area is the same, that is, whether a second merged cell formed by merging at least two cells in the vertical direction exists in the data block area is determined. If the number of the cells included in all the columns in the data block area is the same, that is, there is no second merged cell merged by at least two cells in the vertical direction in the data block area, step S1039 is executed to finish the drawing of the row line in the data block area. If the number of cells included in all columns in the data block region is not the same, that is, there is a second merged cell formed by merging at least two cells in the vertical direction in the data block region, steps S1036 to S1038 are performed.
Step 1036, if the number of the cells included in all the columns in the data block area is not the same, acquiring a top-level column in the data block area and an auxiliary column of the top-level column.
In this embodiment, if the number of cells included in all columns in the data block area is not the same, the top-level column and the subordinate columns of the top-level column in the data block area are obtained, which may specifically be implemented by the following steps:
step one, acquiring a row with the minimum unit cell number in a data block area as a top layer row.
And step two, sequentially taking the remaining columns in the data block area as target columns according to the sequence from near to far away from the top-level column, and determining whether the target columns are auxiliary columns of the top-level column.
And the row covered by any first cell in the subsidiary columns of the top-level column is a subset of the row covered by the second cell corresponding to the first cell in the top-level column.
And step three, if the target column is the auxiliary column of the top-level column, continuously determining whether the next column of the target column is the auxiliary column of the top-level column.
The next column of the target column refers to a column which is adjacent to the target column and is farther away from the top column than the target column according to the sequence from near to far away from the top column.
Step four, if the target column is not the affiliated column of the top layer column, determining that the target column is the next top layer column; and according to the sequence from near to far away from the next top-layer column, sequentially taking the remaining columns in the data block area as target columns, and circularly executing the steps from the first step to the fourth step to determine whether the target columns are auxiliary columns of the next top-layer column or not until no remaining columns exist in the data block area.
The remaining columns in the data block area are columns in the data block area except for the determined top-level column and/or the determined auxiliary column, that is, columns that have not been processed as target columns.
In this embodiment, the columns on the right side or the left side of the top column may be processed separately. For example, for the column on the right side of the top column, each column on the right side of the top column is taken as a target column in turn from left to right; specifically, according to the sequence from left to right, a first column on the right side of the top-level column is taken as a target column, whether the target column is an auxiliary column of the top-level column is determined, if the first column is the auxiliary column of the top-level column, a second column on the right side of the top-level column is taken as the target column, and if the second column is determined to be the auxiliary column of the top-level column, the next column is taken as the target column continuously, and whether the target column is the auxiliary column of the top-level column is determined; until it is determined that the target column is not a subordinate column of the top column, at which point the search for the subordinate column of the top column ends for the column to the right of the top column, and the target column is considered to be the next top column.
Regarding the columns on the left side of the top-layer column, taking each column on the left side of the top-layer column as a target column from right to left; specifically, according to the sequence from right to left, a first column on the left side of the top-level column is taken as a target column, whether the target column is an auxiliary column of the top-level column is determined, if the first column is the auxiliary column of the top-level column, a second column on the left side of the top-level column is taken as the target column, and if the second column is determined to be the auxiliary column of the top-level column, the next column is taken as the target column continuously, and whether the target column is the auxiliary column of the top-level column is determined; until it is determined that the target column is not a subordinate column of the top column, at which point the search for the subordinate column of the top column ends for the column to the left of the top column, and the target column is considered to be the next top column.
In this embodiment, the columns on the right side or the left side of the top-layer column may also be processed in parallel, and the specific processing method is similar to the process of processing the top-layer columns in sequence, and is not described here again.
Step S1037, a row line where the upper boundary and the lower boundary of each cell in the top layer column are located is drawn as a first color.
Optionally, the width of the row line where the upper and lower boundaries of each cell in the top layer column are located is the same as the width of the data block region.
Step S1038, using the area formed by each top-level column and its subordinate columns as a new data block area, and drawing the row lines of the new data block area according to the merging cell information in the vertical direction in each column in the new data block area.
In this step, the area formed by each top-level column and its subordinate columns is used as a new data block area, and steps S1035-S1039 are executed in a loop, and the row line of the new data block area is drawn according to the merging cell information in the vertical direction in each column in the new data block area.
Step S1039, if the number of cells included in all the columns in the data block area is the same, ending the drawing of the row line in the data block area.
The embodiment of the invention provides a specific process for drawing the row lines in the form frame according to the merging cell information in the form, and the specific process comprises the steps of determining at least one independent area of the form in the horizontal direction by analyzing the content information of the form head, intelligently identifying the condition that the form contains the same content which is arranged in parallel left and right, and drawing the row lines in each independent area respectively; and for each independent area, determining a top-level column and an auxiliary column of each top-level column in the independent area through merging cell information in the vertical direction in the independent area, only drawing row lines where the upper boundary and the lower boundary of the top-level column containing the auxiliary column are located, and not drawing row lines, so that a drawn table frame is consistent with the structure of data in the table, the table typesetting requirements of scientific books and scientific magazines on the table are better met, frames of rows or columns corresponding to merging cells do not need to be adjusted manually, the typesetting efficiency of the table can be improved, and the typesetting effect is improved.
EXAMPLE III
Fig. 7 is a schematic structural diagram of a table drawing apparatus according to a third embodiment of the present invention. The table drawing device provided by the embodiment of the invention can execute the processing flow provided by the table drawing method embodiment. As shown in fig. 7, the apparatus 70 includes: an obtaining module 701, a first rendering module 702 and a second rendering module 703.
Specifically, the obtaining module 701 is configured to obtain merge cell information in a header and merge cell information in a body of a table, where frames of the table include a header frame and a body frame.
The first drawing module 702 is configured to draw, according to the merged cell information in the header, a column line in the header frame as a second color and a row line of the header frame as a first color.
The second drawing module 703 is configured to draw a row line in the body frame according to the merged cell information in the body.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the first embodiment, and specific functions are not described herein again.
According to the embodiment of the invention, by acquiring the merging cell information in the header and the merging cell information in the body of the table, the row lines of the header frame are drawn into a first color according to the merging cell information in the header, and the column lines in the header frame are drawn into a second color, so that the row lines in the header are divided into the cells of the header; and according to the merging cell information in the form body, drawing the row lines in the form body frame, but not drawing the row lines in the form body frame, so as to reduce the influence of the row lines in the form on the display effect of the overall structure of data in the form, and better meet the typesetting requirements of scientific books and scientific magazines on the form, and the frames of the corresponding rows or columns of the merging cells do not need to be adjusted manually, so that the typesetting efficiency of the form can be improved, and the typesetting effect is improved.
Example four
On the basis of the third embodiment, in this embodiment, the second drawing module includes: and the obtaining submodule, the determining submodule and the drawing submodule.
The obtaining submodule is used for obtaining the content information of the header.
The determining submodule is used for determining at least one independent area of the watch body in the horizontal direction according to the content information of the watch head, and the content information of the watch head corresponding to the at least one independent area is consistent.
And the drawing submodule is used for respectively taking each independent area as a target area and drawing the row lines in the target area according to the information of the merging cells in the target area.
Specifically, the rendering sub-module is further configured to:
acquiring a summary line in the target area, wherein the summary line is a line in the target area with a first merging cell, and the first merging cell is a cell formed by merging at least two cells in the horizontal direction; drawing row lines of the summary row into a first color; the summary line divides the part of the target area except the summary line into at least one data block area; and in each data block area, drawing the row lines of the data block area according to the merging cell information in the vertical direction in each column in the data block area.
Optionally, the width of the summary row coincides with the width of the target area.
Specifically, the rendering sub-module is further configured to:
judging whether the number of the unit grids contained in all the columns in the data block area is the same or not; if the number of the cells contained in all the columns in the data block area is not the same, acquiring a top-layer column and an auxiliary column of the top-layer column in the data block area; drawing a row line where the upper boundary and the lower boundary of each cell in the top layer row are located into a first color; and taking the area formed by each top-layer column and the auxiliary columns thereof as a new data block area, and drawing the row lines of the new data block area according to the information of the merging cells in each column in the vertical direction in the new data block area.
The rendering sub-module is further to:
acquiring a column with the minimum unit cell number in a data block area as a top layer column; according to the sequence from near to far away from the top-level column, sequentially taking the remaining columns in the data block area as target columns, and determining whether the target columns are auxiliary columns of the top-level column; the row covered by any first cell in the auxiliary columns of the top-level column is a subset of the row covered by a second cell corresponding to the first cell in the top-level column; if the target column is an affiliate column of the top-level column, continuing to determine whether a next column of the target column is an affiliate column of the top-level column; and if the target column is not the auxiliary column of the top layer column, determining that the target column is the next top layer column, sequentially taking the remaining columns in the data block area as the target columns according to the sequence from near to far away from the next top layer column, and determining whether the target column is the auxiliary column of the next top layer column until no remaining columns exist in the data block area.
Optionally, the width of the row line where the upper and lower boundaries of each cell in the top layer column are located is the same as the width of the data block region.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the second embodiment, and specific functions are not described herein again.
The embodiment of the invention provides a specific process for drawing the row lines in the form frame according to the merging cell information in the form, and the specific process comprises the steps of determining at least one independent area of the form in the horizontal direction by analyzing the content information of the form head, intelligently identifying the condition that the form contains the same content which is arranged in parallel left and right, and drawing the row lines in each independent area respectively; and for each independent area, determining a top-level column and an auxiliary column of each top-level column in the independent area through merging cell information in the vertical direction in the independent area, only drawing row lines where the upper boundary and the lower boundary of the top-level column containing the auxiliary column are located, and not drawing row lines, so that a drawn table frame is consistent with the structure of data in the table, the table typesetting requirements of scientific books and scientific magazines on the table are better met, frames of rows or columns corresponding to merging cells do not need to be adjusted manually, the typesetting efficiency of the table can be improved, and the typesetting effect is improved.
In the embodiments provided in the present invention, 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, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention 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 can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.