Table component drawing method, device, electronic device and storage medium
By obtaining the table information configured by the user, drawing the target table component and allowing the user to merge and split cells, bind and release data associations, the problem of insufficient flexibility of table components in the existing technology is solved, and the flexibility and versatility of table components are improved.
Patent Information
- Application Number
- CN202210217437.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-03-07
AI Technical Summary
The table component display page in the prior art needs to be customized according to the display scenario, which has low flexibility and cannot meet different needs.
By obtaining the table information configured by the user, it draws the rectangular and line primitives required by the target table component, and allows the user to merge and split cells, bind and release data associations, and dynamically adjust the structure and content of the table component.
The flexibility and versatility of the table component have been improved, and the table structure and content can be dynamically adjusted according to actual needs to meet the requirements of different display scenarios.
Smart Images

Figure CN114580365B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computers, and in particular to a table component drawing method, device, electronic device and storage medium. Background Art
[0002] After pre-processing, aerospace business data is directly displayed on the display software. The display page elements are mainly tables and curves. With the development of aerospace business, launch missions are becoming increasingly heavy, and the demand for displaying aerospace business data is gradually increasing. The tables in the display pages of existing technologies need to be customized according to the display scenarios, and have low flexibility. Summary of the Invention
[0003] The present application provides a table component drawing method, device, electronic device and storage medium to solve the problem that tables in display pages in the prior art need to be customized and developed according to display scenarios and have low flexibility.
[0004] In the first aspect, the present application provides a table component drawing method, including: obtaining table information of a target table component configured by a user, the table information including the number of rows and columns; obtaining the number of rectangular primitives and the number of line primitives required to draw the target table component based on the number of rows and columns included in the table information; drawing a corresponding number of the rectangular primitives and the line primitives according to the obtained number of the rectangular primitives and the number of the line primitives to obtain the target table component, as well as the rectangular primitive attribute data of each of the rectangular primitives and the line primitive attribute data of each of the line primitives in the target table component.
[0005] In an embodiment of the present application, based on the table information of the target table component configured by the user, the number of rectangular graphics elements and the number of line graphics elements required to draw the target table component are obtained, and then based on the obtained number of rectangular graphics elements and the number of line graphics elements, a corresponding number of rectangular graphics elements and line graphics elements are drawn to obtain the target table component. That is, the user can draw a table component of any form according to actual needs, and can use the table component in different display scenarios without the need for customized development based on the display scenario, which greatly improves flexibility.
[0006] In combination with the technical solution provided in the first aspect above, in some possible implementations, after obtaining the target table component, the method also includes: responding to the user's operation of merging N cells in the target table component, judging whether the N cells can be merged, where N is a positive integer greater than or equal to 2; when the N cells can be merged, taking any one of the N cells as the target cell, and deleting the rectangular primitives corresponding to other cells in the N cells except the target cell; modifying the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell, and for each rectangular primitive in all the rectangular primitives corresponding to the N cells, modifying the line primitive attribute data of the line primitive adjacent to the rectangular primitive, to obtain the merged target table component; wherein the length and width of the modified rectangular primitive corresponding to the target cell are the same as the length and width of the rectangle formed by all the rectangular primitives corresponding to the N cells.
[0007] In an embodiment of the present application, in response to the user's operation of merging N cells in a target table component, it is determined whether these N cells can be merged. When the N cells can be merged, any one of the N cells is used as the target cell, and the rectangular primitives corresponding to the other cells in the N cells except the target cell are deleted. Then, the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell is modified, and for each of the rectangular primitives in all the rectangular primitives corresponding to the N cells, the line primitive attribute data of the line primitive adjacent to the rectangular primitive is modified to obtain the merged target table component, so that the user can merge the cells in the table component according to his or her own needs, so that the target table component can meet the actual needs of the user, and further improve the versatility and flexibility of the target table component.
[0008] In combination with the technical solution provided in the first aspect above, in some possible implementations, determining whether the N cells can be merged includes: determining whether the N cells are all located in the same row or column, and whether the N cells are continuous cells; wherein, if the N cells are all located in the same row or column, and the N cells are continuous cells, it is determined that the N cells can be merged.
[0009] In an embodiment of the present application, when the N cells are all located in the same row or the same column and are continuous cells, it is determined that the N cells can be merged, thereby preventing the need to merge cells that cannot be merged, which may cause errors in the target table component.
[0010] In combination with the technical solution provided in the first aspect above, in some possible implementations, the method also includes: when receiving an operation instruction to split the specified cell in the target table component into M sub-cells, determining the splitting direction corresponding to the operation instruction, and drawing M-1 split line primitives according to the splitting direction, and obtaining line primitive attribute data of each split line primitive, where M is a positive integer greater than or equal to 2; determining the size of each sub-cell according to the size, splitting direction and number of splits of the specified grid unit, and drawing M-1 split rectangular primitives in the specified cell according to the size of the sub-cell, and obtaining rectangle primitive attribute data of each split rectangle primitive; modifying the rectangle primitive attribute data of the rectangle primitive corresponding to the specified cell, wherein the length and width of the rectangle formed by the modified rectangle primitive corresponding to the specified cell and the M-1 split rectangular primitives are the same as the length and width of the rectangle primitive corresponding to the specified cell before modification.
[0011] In an embodiment of the present application, when an operation instruction is received to split a specified cell in a target table component into M sub-cells, the splitting direction corresponding to the operation instruction is determined, and M-1 splitting line primitives are drawn according to the splitting direction to obtain the line primitive attribute data of each splitting line primitive. Then, according to the size, splitting direction and number of splits of the specified grid unit, the size of each sub-cell is determined, and according to the size of the sub-cell, M-1 splitting rectangle primitives are drawn in the specified cell to obtain the rectangle primitive attribute data of each splitting rectangle primitive. Finally, the rectangle primitive attribute data of the rectangle primitive corresponding to the specified cell is modified to obtain the split target table component, so that the user can split the cells in the table component according to his own needs, and then the target table component can meet the actual needs of the user, thereby improving the flexibility of the target table component and expanding the versatility of the target table component.
[0012] In combination with the technical solution provided in the first aspect above, in some possible implementations, after obtaining the target table component, the method further includes: responding to the user's operation of binding target data to a specified cell in the target table component, associating the rectangular graphic element corresponding to the specified cell with the target data, so that after obtaining the data frame corresponding to the target data, the data contained in the data frame is displayed in the specified cell.
[0013] In an embodiment of the present application, by binding the specified cells in the target table component with the target data, that is, associating the rectangular graphics corresponding to the specified cells with the target data, after obtaining the data frame corresponding to the target data, the data contained in the data frame is displayed in the specified cells, thereby realizing automatic update of the data in the target table component. At the same time, the user can bind different data to the cells in the target table component according to their own needs, thereby making the target table component more flexible.
[0014] In combination with the technical solution provided in the first aspect above, in some possible implementations, after associating the rectangular graphic element corresponding to the specified cell with the target data, the method further includes: responding to the user's operation of unbinding the specified cell from the target data, unbinding the rectangular graphic element corresponding to the specified cell from the target data, so that after receiving the data frame corresponding to the target data, the data contained in the data frame will not be displayed in the specified cell.
[0015] In an embodiment of the present application, by releasing the association between the rectangular graphic element corresponding to the specified cell and the target data, after receiving the data frame corresponding to the target data, the data contained in the data frame will not be displayed in the specified cell, thereby allowing the user to modify the data bound to the cell in the target table component according to their own needs, so that the target table component can meet their own usage needs and improve the flexibility of using the target table component.
[0016] In combination with the technical solution provided in the first aspect above, in some possible implementations, the rectangular primitive attribute data includes at least one of the following data: number, width, height, data display content, static text information, data source, data type, data coefficient, number of floating-point decimal places of data, left line primitive number, top line primitive number, right line primitive number, bottom line primitive number, text horizontal position, and text vertical position; the line primitive attribute data includes at least one of the following data: number, direction, position, front line primitive number, back line primitive number, and the associated rectangular primitive number set.
[0017] In an embodiment of the present application, since the rectangular primitive attribute data includes at least one of the following data: number, width, height, data display content, static text information, data source, data type, data coefficient, number of floating-point decimal places of data, left line primitive number, top line primitive number, right line primitive number, bottom line primitive number, text horizontal position, and text vertical position, and the line primitive attribute data includes at least one of the following data: number, direction, position, front line primitive number, back line primitive number, and the associated rectangular primitive number set, the rectangular primitive attribute data and the line primitive attribute data can fully reflect all aspects of information of the rectangular primitive and the line primitive.
[0018] In the second aspect, the present application provides a table component drawing device, including an acquisition module, a processing module and a drawing module, the acquisition module is used to obtain table information of a target table component configured by a user, the table information including the number of rows and columns; the processing module is used to obtain the number of rectangular primitives and the number of line primitives required to draw the target table component based on the number of rows and columns included in the table information; the drawing module is used to draw a corresponding number of the rectangular primitives and the line primitives according to the obtained number of the rectangular primitives and the number of the line primitives, so as to obtain the target table component, as well as the rectangular primitive attribute data of each of the rectangular primitives and the line primitive attribute data of each of the line primitives in the target table component.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, the memory and the processor being connected; the memory being used to store programs; and the processor being used to call the programs stored in the memory to execute a method provided in the embodiment of the first aspect above and / or in combination with any possible implementation method of the embodiment of the first aspect above.
[0020] In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. When the computer program is run by a computer, it executes the method provided in the embodiment of the first aspect above and / or any possible implementation method in combination with the embodiment of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 This is a flow chart of a table component drawing method according to an embodiment of the present application;
[0023] Figure 2 A schematic diagram of the structure of a target table component shown in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of the structure of a merged target table component shown in an embodiment of the present application;
[0025] Figure 4 This is a schematic diagram of the structure of a split target table component shown in an embodiment of the present application;
[0026] Figure 5This is a schematic structural diagram of another split target table component shown in an embodiment of the present application;
[0027] Figure 6 This is a structural block diagram of a table component drawing device shown in an embodiment of the present application;
[0028] Figure 7 This is a structural block diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0030] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined and explained in the subsequent figures. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0031] Furthermore, the term "and / or" in this application is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0032] The technical solution of this application will be clearly and completely described below with reference to the accompanying drawings.
[0033] See also Figure 1 , Figure 1 A table component drawing method provided in the embodiment of the present application will be combined with Figure 1 Describe the steps it involves.
[0034] S100: Acquire table information of a target table component configured by the user, where the table information includes the number of rows and columns.
[0035] The table information of the target table component configured by the user can be pre-stored in a database or disk and can be directly obtained when needed, or can be obtained in real time when needed.
[0036] S200: Based on the number of rows and columns included in the table information, obtain the number of rectangle primitives and the number of line primitives required to draw the target table component.
[0037] After obtaining the table information including the number of rows and columns of the target table component configured by the user, the number of rectangle primitives and the number of line primitives required for drawing the target table component can be obtained according to the table information.
[0038] For ease of understanding, X is used to represent the number of rows of the target table component, and Y is used to represent the number of columns of the target table component. The number of rectangle primitives required to draw the target table component is X*Y, and the number of line primitives required is X+Y+2, where the number of horizontal line primitives is X+1 and the number of vertical line primitives is Y+1. For example, when the number of rows and columns in the table information of the target table component is 3, the corresponding table component is as follows: Figure 2 As shown, accordingly, the target table component includes 9 rectangular graphics elements No. 1, No. 2, No. 3, No. 4, No. 5, No. 6, No. 7, No. 8, and No. 9, and 8 line graphics elements Vline1, Vline2, Vline3, Vline4, Hline1, Hline2, Hline3, and Hline4.
[0039] S300: According to the obtained number of rectangular primitives and the number of line primitives, draw a corresponding number of rectangular primitives and line primitives to obtain the target table component, as well as the rectangular primitive attribute data of each rectangular primitive and the line primitive attribute data of each line primitive in the target table component.
[0040] After drawing a corresponding number of rectangles and line elements based on the number of rectangles and line elements, a target table component is obtained, along with rectangle element attribute data for each rectangle element and line element attribute data for each line element in the target table component. The length and width of the rectangle elements can be pre-set, and when drawing the rectangle elements, they can be drawn according to the pre-set length and width.
[0041] Among them, the rectangular primitive attribute data includes at least one of the following data: number, width, height, data display content, static text information, data source, data type, data coefficient, number of floating point decimal places of data, left line primitive number, top line primitive number, right line primitive number, bottom line primitive number, text horizontal position, and text vertical position. For each rectangular primitive, the number in the rectangular primitive data corresponding to the rectangular primitive is used to uniquely identify the rectangular primitive, the width represents the width of the rectangular primitive, the length represents the length of the rectangular primitive, the data display content represents the data content that the rectangular primitive needs to display, the static text information represents the static information such as the header and title of the table component to which the rectangular primitive belongs, the data source is the source of the data displayed in the rectangular primitive, the data type represents the type of data displayed in the rectangular primitive (such as speed, distance, etc.), the data coefficient represents the ratio between the real-time data displayed in the rectangular primitive and the received real-time data, the data floating point decimal places represents the number of decimal places of the data displayed in the rectangular primitive, the left line primitive number, the top line primitive number, the right line primitive number, and the bottom line primitive number represent the line primitives on the left, top, right, and bottom sides of the rectangular primitive respectively, the text horizontal position represents the horizontal position of the data displayed in the rectangular primitive (such as left alignment, right alignment, center, etc.), and the text vertical position represents the vertical position of the data displayed in the rectangular primitive (such as top alignment, center, bottom alignment, etc.).
[0042] The line primitive attribute data includes at least one of the following data: number, direction, position, front line primitive number, back line primitive number, and associated rectangular primitive number set. For each linear primitive, the number in the line primitive data corresponding to the line primitive uniquely represents the line primitive, the direction represents the direction of the line primitive (for example, horizontal, vertical, or represented by an angle, such as 0°, 45°, 90°, etc., 0° represents the horizontal line primitive, 90° represents the vertical line primitive), the position represents the coordinates of the line primitive relative to the origin of the preset coordinate system, the front line primitive number and the back line primitive number respectively represent the line primitives adjacent to the line primitive, and the associated rectangular primitive number set represents all rectangular primitives adjacent to the line primitive.
[0043] The length of the line primitive can be obtained according to the size of the rectangular primitive, for example, Figure 2 The length of Hline1 is the sum of the lengths of the three rectangular primitives numbered 1, 2, and 3.
[0044] In one embodiment, after obtaining the target table component, the user can merge N cells in the target table component, where N is a positive integer greater than or equal to 2. Accordingly, the table component drawing method also includes responding to the user's operation of merging N cells in the target table component, determining whether the N cells can be merged, and when the N cells can be merged, taking any one of the N cells as the target cell, and deleting the rectangular primitives corresponding to other cells in the N cells except the target cell, and then modifying the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell, and for each of all the rectangular primitives corresponding to the N cells, modifying the line primitive attribute data of the line primitive adjacent to the rectangular primitive, to obtain the merged target table component, wherein the length and width of the rectangular primitive corresponding to the modified target cell are the same as the length and width of the rectangle formed by all the rectangular primitives corresponding to the N cells.
[0045] Among them, the process of determining whether the N cells can be merged can be: first determine whether the N cells are all located in the same row or the same column, and whether the N cells are continuous cells. When the N cells are all located in the same row or the same column, and the N cells are continuous cells, determine that the N cells can be merged.
[0046] Optionally, when the rectangular primitive attribute data includes the left line primitive number, the top line primitive number, the right line primitive number, and the bottom line primitive number, the rectangular primitive attribute data of the rectangular primitives corresponding to the N cells can be used to determine whether the N cells are all located in the same row or column, that is, when the left line primitive numbers of the rectangular primitives corresponding to the N cells are the same, and the right line primitive numbers of the rectangular primitives corresponding to the N cells are also the same, then the rectangular primitives corresponding to the N cells are in the same column; when the bottom line primitive numbers of the rectangular primitives corresponding to the N cells are the same, and the top line primitive numbers of the rectangular primitives corresponding to the N cells are also the same, then the rectangular primitives corresponding to the N cells are in the same row.
[0047] Optionally, when the rectangular primitive attribute data includes the left rectangular primitive number, the top rectangular primitive number, the right rectangular primitive number, and the bottom rectangular primitive number, the rectangular primitive attribute data of the rectangular primitives corresponding to the N cells can be used to determine whether the N cells are continuous cells.
[0048] In order to understand the above-mentioned method of merging cells, the following Figure 2 The table component shown is used as an example. When the user Figure 2When the cells corresponding to the two rectangular primitives No. 1 and No. 4 in the table component shown are merged, since the two cells No. 1 and No. 4 are located in the same column and are adjacent, the two cells No. 1 and No. 4 can be merged, and the cell No. 1 is used as the target cell, and the rectangular primitive corresponding to the cell No. 4 is deleted. Then, the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell is modified, including modifying the length and width in the rectangular primitive attribute data to the length and width of the rectangle composed of the two cells No. 1 and No. 4, and modifying the bottom line primitive number to Hline3. At the same time, modify the line primitive attribute data of Hline1, Hline2, Hline3, Vline1, and Vline2. For example, the number of the rectangular primitive No. 4 is deleted from the associated rectangular primitive number set to obtain the merged target table component. The merged target table component is shown as follows. Figure 3 shown.
[0049] In one embodiment, after obtaining the target table component, the user can split the specified cell in the target table component into M sub-cells, where M is a positive integer greater than or equal to 2. Accordingly, when receiving the user's operation instruction to split the specified cell in the target table component into M sub-cells, the splitting direction corresponding to the operation instruction is determined, and M-1 splitting line elements are drawn according to the splitting direction to obtain the line element attribute data of each splitting line element. Then, according to the size, splitting direction and number of splits of the specified grid unit, the size of each sub-cell is determined, and M-1 splitting rectangle elements are drawn in the specified cell according to the size of the sub-cell to obtain the rectangle element attribute data of each splitting rectangle element. At the same time, the rectangle element attribute data of the rectangle element corresponding to the specified cell is modified to obtain the target table component after splitting, wherein the length and width of the rectangle formed by the modified rectangle element corresponding to the specified cell and the M-1 splitting rectangle elements are the same as the length and width of the rectangle element corresponding to the specified cell before modification.
[0050] In order to understand the above operation of splitting the specified cell, the following Figure 2Take the example of splitting the cell No. 1 into 3 sub-cells and the splitting direction corresponding to the operation instruction of splitting the specified cell is vertical splitting. After receiving the operation instruction, draw 2 split line primitives, namely Hline5 and Hline6, and obtain the line primitive attribute data of the two split line primitives Hline5 and Hline6. At the same time, draw the two split rectangle primitives No. 10 and No. 11, obtain the rectangle primitive attribute data of the two split rectangle primitives No. 10 and No. 11, and modify the rectangle primitive attribute data of the rectangle primitive corresponding to the specified cell (that is, modify the width, length, and bottom line primitive number) to obtain the target table component after splitting. The target table component after splitting is as follows: Figure 4 shown.
[0051] Similarly, when Figure 2 When the cell No. 1 in the figure is split into 3 sub-cells and the split direction corresponding to the operation instruction for splitting the specified cell is horizontal split, after receiving the operation instruction, two split line primitives, namely Vline5 and Vline6, are drawn, and the line primitive attribute data of the two split line primitives of Vline5 and Vline6 are obtained. At the same time, the two split rectangular primitives No. 12 and No. 13 are drawn, and the rectangular primitive attribute data of the two split rectangular primitives No. 12 and No. 13 are obtained. The rectangular primitive attribute data of the rectangular primitive corresponding to the specified cell is modified (that is, the width, length, and bottom line primitive number are modified) to obtain the target table component after splitting. The target table component after splitting is as follows: Figure 5 shown.
[0052] Among them, it can be pre-set to split the specified cell into M sub-cells evenly, that is, the sizes of the M sub-cells after splitting are the same, or the user can set the split ratio when performing the split operation, and then split according to the split ratio. For example, the specified cell is split into 3 cells horizontally, and the set split ratio is 1:1:2 from left to right, then the width of the left sub-cell is equal to the width of the middle sub-cell, and the width of the right sub-cell is twice the width of the left sub-cell.
[0053] In one implementation, after obtaining the target table component, the user can change the size of the cell by dragging the cell border. Accordingly, after receiving the user's operation of dragging the cell border, the operation is responded to so that the border of the cell moves with the user's dragging, that is, the line element corresponding to the border moves with the user's dragging, and at the same time, the line element attribute data (such as position data) of the line element is modified, and the rectangular element attribute information (such as length, width, etc. data) of the rectangular element adjacent to the line element is modified accordingly.
[0054] by Figure 2 Taking the table component shown as an example, when the user drags Vline2 to the left, the lengths of the three rectangular elements No. 1, No. 4, and No. 7 will be reduced, and the lengths of the three rectangular elements No. 2, No. 5, and No. 8 will be increased. Therefore, it is necessary to modify the line element attribute data of the line element Vline2, as well as the rectangular element attribute data of the six rectangular elements No. 1, No. 2, No. 4, No. 5, No. 7, and No. 8.
[0055] It is understandable that the user can also modify the target table component by modifying the rectangular cell attribute data of the rectangular cell or the line cell attribute data of the line cell, such as modifying the length and width of the rectangular cell to set the cell size. Accordingly, after receiving the user's operation to modify the rectangular cell attribute data of the rectangular cell or the line cell attribute data of the line cell, the operation is responded to by modifying the rectangular cell attribute data of the rectangular cell or the line cell attribute data of the line cell to obtain the modified target table component. For example, in the main form class, the personalized properties of the line cells and rectangular cells included in the table component can be managed through the macro Q_PROPERTY; the properties can also be set by right-clicking the line cell or the rectangular cell to display the dialog box, and the set information is saved to the line cell attribute data or the rectangular cell attribute data through the setProperty function.
[0056] In one embodiment, after obtaining the target table component, the user can bind target data to a specified cell in the target table component so that the specified cell displays the target data. Accordingly, when receiving the user's operation of binding target data to a specified cell, in response to the user's operation of binding target data to a specified cell in the target table component, the rectangular graphic element corresponding to the specified cell is associated with the target data, so that after obtaining the data frame corresponding to the target data, the data contained in the data frame is displayed in the specified cell.
[0057] Optionally, the process of associating the rectangular element corresponding to the specified cell with the target data may be to obtain the target data source corresponding to the target data, modify the data source included in the rectangular element attribute data of the rectangular element corresponding to the specified cell to the target data source, and complete the binding of the specified cell and the target data.
[0058] After obtaining target data of multiple data frames through a data source, the data included in each data frame can be displayed in the rectangular graphic element corresponding to the designated cell in sequence according to the order in which the data frames are obtained.
[0059] Optionally, after associating the rectangular graphic element corresponding to the specified cell with the target data, the user can also unbind the specified cell from the target data. Accordingly, after receiving the user's operation to unbind the specified cell from the target data, the operation is responded to by unbinding the rectangular graphic element corresponding to the specified cell from the target data, so that after receiving the data frame corresponding to the target data, the data contained in the data frame will not be displayed in the specified cell.
[0060] The data source included in the rectangular primitive attribute data of the rectangular primitive corresponding to the specified cell may be modified so that the data source is no longer the data source corresponding to the target data.
[0061] In addition to being able to bind to target data and implement data subscription, the cells of the target table component can also directly display text data, such as task information, page information, custom strings, time information, etc.
[0062] The target table component can cache its own displayed data, thereby preventing the loss of displayed data after the target table component is closed due to unexpected circumstances, thereby improving data security.
[0063] Users can also import table data from other files into the target table component, such as table data in a Word file. Accordingly, when receiving the user's operation to import table data from other files into the target table component, the table data from other files is imported into the target table component in response to the user's operation, so that the table data in the file is displayed in the target table component.
[0064] After obtaining the target table component, a display interface may be generated based on the target table component. The display page may be generated based on a single target table component, or the target table component may be combined with other display components to generate a display page.
[0065] In one embodiment, the table component drawing method can be applied to a design layer in a display framework, which also includes an application layer, a platform layer, and a data layer, wherein the design layer is also used to respond to the user's operation of editing the page based on a preset display component library, edit the page to be displayed, and configure the subscription information of the page to be displayed in response to the user's configuration operation, and the subscription information represents all data that needs to be obtained for updating the page to be displayed; the platform layer is used to obtain and send the subscription information of the page to be displayed to the data layer after receiving a control instruction representing the display of the page to be displayed; the data layer is used to obtain the target data corresponding to the subscription information and send the target data to the platform layer; the platform layer is also used to send the target data to the application layer; the application layer is used to update the page to be displayed based on preset rules and the target data, and then display the updated page to be displayed.
[0066] Among them, the design layer, application layer, platform layer, and data layer can be software modules, and the display framework is constructed by the design layer, application layer, platform layer, and data layer. Optionally, the design layer can be a page editing tool module, the application layer can be a page file, the platform layer can be a comprehensive display software module, and the data layer can be a data preprocessing and forwarding software module.
[0067] See also Figure 6 , Figure 6 A table component drawing device 100 provided in an embodiment of the present application includes an acquisition module 110 , a processing module 120 and a drawing module 130 .
[0068] The acquisition module 110 is configured to acquire table information of a target table component configured by the user, where the table information includes the number of rows and columns.
[0069] The processing module 120 is configured to obtain the number of rectangle primitives and the number of line primitives required to draw the target table component based on the number of rows and columns included in the table information.
[0070] The drawing module 130 is used to draw a corresponding number of the rectangular primitives and the line primitives according to the obtained number of the rectangular primitives and the number of the line primitives, so as to obtain the target table component, as well as the rectangular primitive attribute data of each of the rectangular primitives and the line primitive attribute data of each of the line primitives in the target table component.
[0071] The processing module 120 is also used to, after obtaining the target table component, respond to the user's operation of merging N cells in the target table component, and determine whether the N cells can be merged, where N is a positive integer greater than or equal to 2; when the N cells can be merged, use any one of the N cells as the target cell, and delete the rectangular primitives corresponding to other cells in the N cells except the target cell; modify the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell, and for each rectangular primitive in all the rectangular primitives corresponding to the N cells, modify the line primitive attribute data of the line primitive adjacent to the rectangular primitive, to obtain the merged target table component; wherein the length and width of the modified rectangular primitive corresponding to the target cell are the same as the length and width of the rectangle formed by all the rectangular primitives corresponding to the N cells.
[0072] The processing module 120 is specifically used to determine whether the N cells are all located in the same row or the same column, and whether the N cells are continuous cells; wherein, if the N cells are all located in the same row or the same column, and the N cells are continuous cells, it is determined that the N cells can be merged.
[0073] The processing module 120 is also used to, when receiving an operation instruction to split a specified cell in the target table component into M sub-cells, determine the splitting direction corresponding to the operation instruction, and draw M-1 split line primitives according to the splitting direction to obtain line primitive attribute data of each split line primitive, where M is a positive integer greater than or equal to 2; determine the size of each sub-cell according to the size, splitting direction and number of splits of the specified grid unit, and draw M-1 split rectangular primitives in the specified cell according to the size of the sub-cell to obtain rectangular primitive attribute data of each split rectangular primitive; modify the rectangular primitive attribute data of the rectangular primitive corresponding to the specified cell to obtain the target table component after splitting, wherein the length and width of the rectangle formed by the modified rectangular primitive corresponding to the specified cell and the M-1 split rectangular primitives are the same as the length and width of the rectangular primitive corresponding to the specified cell before modification.
[0074] The processing module 120 is also used to, after obtaining the target table component, respond to the user's operation of binding target data to a specified cell in the target table component, and associate the rectangular graphic element corresponding to the specified cell with the target data, so that after obtaining the data frame corresponding to the target data, the data contained in the data frame is displayed in the specified cell.
[0075] The processing module 120 is also used to, after associating the rectangular graphic element corresponding to the designated cell with the target data, respond to the user's operation of unbinding the designated cell from the target data, and unbind the association relationship between the rectangular graphic element corresponding to the designated cell and the target data, so that after receiving the data frame corresponding to the target data, the data contained in the data frame will not be displayed in the designated cell.
[0076] The acquisition module 110 is also used to acquire a file in .xml format, and the processing module 120 is also used to extract the attribute information of all line primitives and all rectangular primitives contained in the .xml format file after receiving the file in .xml format, and convert the extracted attribute information of all line primitives and all rectangular primitives into a preset format, to obtain the line primitive attribute data of the line primitive corresponding to each line primitive and the rectangular primitive attribute data of the rectangular primitive corresponding to each rectangular primitive, and then obtain the target table component based on the line primitive attribute data of the line primitive corresponding to each line primitive and the rectangular primitive attribute data of the rectangular primitive corresponding to each rectangular primitive.
[0077] The table component drawing device 100 provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned table component drawing method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned table component drawing method embodiment.
[0078] See also Figure 7 , which is an electronic device 200 provided in an embodiment of the present application. The electronic device 200 includes: a transceiver 210, a memory 220, a communication bus 230, and a processor 240.
[0079] The transceiver 210, the memory 220, and the processor 240 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses 230 or signal lines. The transceiver 210 is used to send and receive data. The memory 220 is used to store computer programs, such as Figure 6The software function module shown in the table component drawing device 100 is a table component drawing device 100. The table component drawing device 100 includes at least one software function module that can be stored in the memory 220 in the form of software or firmware or fixed in the operating system (OS) of the electronic device 200. The processor 240 is used to execute the executable module stored in the memory 220, such as the software function module or computer program included in the table component drawing device 100. At this time, the processor 240 is used to obtain table information of the target table component configured by the user, the table information including the number of rows and columns; based on the number of rows and columns included in the table information, obtain the number of rectangular primitives and the number of line primitives required to draw the target table component; based on the obtained number of rectangular primitives and the number of line primitives, draw a corresponding number of the rectangular primitives and the line primitives to obtain the target table component, as well as the rectangular primitive attribute data of each of the rectangular primitives and the line primitive attribute data of each of the line primitives in the target table component.
[0080] Among them, the memory 220 can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0081] The processor 240 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor 240 may also be any conventional processor, etc.
[0082] The electronic device 200 mentioned above includes but is not limited to a personal computer, a server, etc.
[0083] The present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), which stores a computer program. When the computer program is executed by a computer, such as the electronic device 200 described above, the computer-readable storage medium executes the table component drawing method described above. The computer-readable storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0084] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A table component drawing method, characterized in that: include: Obtain table information of the target table component configured by the user, the table information including the number of rows and columns; Based on the number of rows and columns included in the table information, obtaining the number of rectangular primitives and the number of line primitives required to draw the target table component; According to the obtained number of the rectangular primitives and the number of the line primitives, a corresponding number of the rectangular primitives and the line primitives are drawn to obtain the target table component, as well as the rectangular primitive attribute data of each of the rectangular primitives and the line primitive attribute data of each of the line primitives in the target table component; the target table component is used to display aerospace business data; wherein the rectangular primitive attribute data includes at least one of the following data: number, width, height, data display content, static text information, data source, data type, data coefficient, number of floating point decimal places of data, left line primitive number, top line primitive number, right line primitive number, bottom line primitive number, text horizontal position, and text vertical position; the line primitive attribute data includes at least one of the following data: number, direction, position, front line primitive number, back line primitive number, and an associated rectangular primitive number set; In response to the user's operation of binding target data to the specified cell in the target table component, the target data source corresponding to the target data is obtained, the data source included in the rectangular element attribute data of the rectangular element corresponding to the specified cell is modified to the target data source, and the binding of the specified cell and the target data is completed, so that after the data frame corresponding to the target data is obtained, the data contained in the data frame is displayed in the specified cell; wherein, after the target data of multiple data frames are obtained through the data source, the data included in each data frame is displayed in the rectangular element corresponding to the specified cell in sequence according to the time sequence of obtaining the data frames.
2. The method according to claim 1, characterized in that After obtaining the target table component, the method further includes: In response to a user operation of merging N cells in the target table component, determining whether the N cells can be merged, where N is a positive integer greater than or equal to 2; When the N cells can be merged, any one of the N cells is used as a target cell, and rectangular primitives corresponding to other cells in the N cells except the target cell are deleted; Modifying the rectangular primitive attribute data of the rectangular primitive corresponding to the target cell, and for each rectangular primitive among all the rectangular primitives corresponding to the N cells, modifying the line primitive attribute data of the line primitive adjacent to the rectangular primitive, to obtain a merged target table component; The length and width of the modified rectangular graphic element corresponding to the target cell are the same as the length and width of the rectangle formed by all the rectangular graphic elements corresponding to the N cells.
3. The method according to claim 2, characterized in that The determining whether the N cells can be merged includes: Determine whether the N cells are all located in the same row or the same column, and whether the N cells are continuous cells; Wherein, if the N cells are all located in the same row or the same column and the N cells are continuous cells, it is determined that the N cells can be merged.
4. The method according to claim 1, wherein The method further comprises: Upon receiving an operation instruction to split a specified cell in the target table component into M sub-cells, determining a splitting direction corresponding to the operation instruction, and drawing M-1 splitting line primitives according to the splitting direction, obtaining line primitive attribute data of each splitting line primitive, where M is a positive integer greater than or equal to 2; Determine the size of each sub-cell according to the size, split direction, and split quantity of the specified cell, draw M-1 split rectangular primitives in the specified cell according to the size of the sub-cell, and obtain rectangular primitive attribute data of each split rectangular primitive; Modify the rectangular primitive attribute data of the rectangular primitive corresponding to the specified cell to obtain the target table component after splitting, wherein the length and width of the rectangle formed by the modified rectangular primitive corresponding to the specified cell and M-1 split rectangular primitives are the same as the length and width of the rectangular primitive corresponding to the specified cell before modification.
5. The method according to claim 1, wherein After associating the rectangular graphic element corresponding to the designated cell with the target data, the method further includes: In response to the user's operation of unbinding the designated cell from the target data, the association relationship between the rectangular graphic element corresponding to the designated cell and the target data is released, so that after receiving the data frame corresponding to the target data, the data contained in the data frame will not be displayed in the designated cell.
6. A table component drawing device, characterized in that: include: An acquisition module, configured to acquire table information of a target table component configured by a user, wherein the table information includes the number of rows and columns; A processing module, configured to obtain the number of rectangular primitives and the number of line primitives required to draw the target table component based on the number of rows and columns included in the table information; A drawing module is configured to draw a corresponding number of the rectangular primitives and the line primitives according to the obtained number of the rectangular primitives and the number of the line primitives, so as to obtain the target table component, as well as rectangular primitive attribute data of each rectangular primitive and line primitive attribute data of each line primitive in the target table component; wherein the rectangular primitive attribute data includes at least one of number, width, height, data display content, static text information, data source, data type, data coefficient, number of floating-point decimal places of data, left line primitive number, top line primitive number, right line primitive number, bottom line primitive number, text horizontal position, and text vertical position; and the line primitive attribute data includes at least one of number, direction, position, front line primitive number, back line primitive number, and a set of associated rectangular primitive numbers; The processing module is also used to respond to the user's operation of binding target data to the specified cell in the target table component, obtain the target data source corresponding to the target data, modify the data source included in the rectangular primitive attribute data of the rectangular primitive corresponding to the specified cell to the target data source, and complete the binding of the specified cell and the target data, so that after the data frame corresponding to the target data is obtained, the data contained in the data frame is displayed in the specified cell; wherein, after the target data of multiple data frames are obtained through the data source, the data included in each data frame is displayed in the rectangular primitive corresponding to the specified cell in sequence according to the time sequence of obtaining the data frames.
7. An electronic device, characterized in that: include: a memory and a processor, the memory and the processor being connected; The memory is used to store programs; The processor is configured to call a program stored in the memory to execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is run by a computer, the method according to any one of claims 1 to 5 is executed.
Citation Information
Patent Citations
Electronic form generation method and device
CN106776508A
Table system in WPF and realizing method
CN106873986A
Table recognition method and device
JP1996320914A