Table conversion method and device and storage medium
By obtaining and converting the column object and data source information of the table and generating cross-tables, the problem that simple tables cannot be analyzed in multiple dimensions is solved, and the convenience of data viewing and analysis is improved.
Patent Information
- Application Number
- CN202510487652.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-08-15
AI Technical Summary
The prior art cannot convert simple tables into cross tables, resulting in inconvenient data viewing and analysis in multiple dimensions.
By obtaining the column object and data source information of the first table, the row object of the table is determined as a column object, the target data is generated and the cross table is generated based on the column object and data.
It realizes the conversion from simple table to cross table, which facilitates users' multi-dimensional viewing and analysis of data and improves user experience.
Smart Images

Figure CN120493885A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a table conversion method, device, and storage medium. Background Art
[0002] In the prior art, computer data is generally displayed using simple tables, with the table header in the first row and the data arranged by rows. However, in some scenarios, users need to view and analyze data in multiple dimensions, and the simple table display method is not convenient for viewing and analyzing data. Cross-tabulation tables are more convenient for viewing and analyzing data than simple tables. However, the prior art does not support converting simple tables into cross-tabulation tables. Summary of the Invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a table conversion method, device and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides a table conversion method, the method comprising:
[0005] Obtaining a column object of a first table and information about a first data source of the first table, where the first data source includes data corresponding to the column object and row objects of the first table;
[0006] Determine the row objects of the first table as column objects of the second table;
[0007] generating target data based on the data in the first data source, wherein the row objects contained in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table;
[0008] The second table is generated based on the column objects of the second table and the target data.
[0009] In some embodiments, the method further comprises:
[0010] Obtaining encapsulation information of a table component, where the table component is used to generate a table, the encapsulation information including a target identifier, where the target identifier is used to indicate whether to convert the display format of the table;
[0011] In response to the target identifier indicating generation of a cross table, executing the step of acquiring the column object of the first table and the information of the first data source of the first table;
[0012] The generating the second table based on the column objects of the second table and the target data includes:
[0013] The table component is called to adopt the column objects of the second table and the target data to generate the second table.
[0014] In some implementations, obtaining the column object of the first table and information about the first data source of the first table includes:
[0015] The column object of the first table and information of the first data source of the first table are obtained from the encapsulation information.
[0016] In some implementations, determining the row object of the first table as the column object of the second table includes:
[0017] Traversing and obtaining row objects of the first table from the first data source;
[0018] concatenating the row objects of the first table according to their corresponding row numbers in the first data source to obtain a first array;
[0019] The first array is transposed to obtain a second array, and elements in the second array are determined as column objects of the second table.
[0020] In some implementations, generating target data based on the data in the first data source includes:
[0021] determining the column objects of the first table as row objects of target data;
[0022] Transpose the data corresponding to the column objects of the first table in the first data source to obtain the data corresponding to the row objects of the target data;
[0023] The target data is generated based on the row object of the target data and data corresponding to the row object of the target data.
[0024] In some embodiments, the first row of the second table includes column numbers corresponding to column objects, and the column numbers are obtained by transposing the row numbers in the first table.
[0025] In some embodiments, the method further comprises:
[0026] The column numbers in the second table are hidden.
[0027] In a second aspect, an embodiment of the present disclosure provides a table conversion device, the device comprising:
[0028] A first acquisition module is configured to acquire column objects of a first table and information about a first data source of the first table, where the first data source includes data corresponding to the column objects and row objects of the first table;
[0029] a determination module, configured to determine the row objects of the first table as column objects of the second table;
[0030] a first generating module, configured to generate target data based on the data in the first data source, wherein the row objects contained in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table;
[0031] The second generating module is configured to generate the second table based on the column objects of the second table and the target data.
[0032] In some embodiments, the table conversion device may further include:
[0033] A second acquisition module is used to acquire packaging information of a table component, wherein the table component is used to generate a table, and the packaging information includes a target identifier, and the target identifier is used to indicate whether to convert the display form of the table;
[0034] A first acquisition module is configured to generate a cross table in response to the target identifier indicating generation of the cross table, and execute the step of acquiring the column objects of the first table and the information of the first data source of the first table;
[0035] The second generation module is used to:
[0036] The table component is called to adopt the column objects of the second table and the target data to generate the second table.
[0037] In some embodiments, the first acquisition module is configured to:
[0038] The column object of the first table and information of the first data source of the first table are obtained from the encapsulation information.
[0039] In some embodiments, the determining module is configured to:
[0040] Traversing and obtaining row objects of the first table from the first data source;
[0041] concatenating the row objects of the first table according to their corresponding row numbers in the first data source to obtain a first array;
[0042] The first array is transposed to obtain a second array, and elements in the second array are determined as column objects of the second table.
[0043] In some embodiments, the first generation module is configured to:
[0044] determining the column objects of the first table as row objects of target data;
[0045] Transpose the data corresponding to the column objects of the first table in the first data source to obtain the data corresponding to the row objects of the target data;
[0046] The target data is generated based on the row object of the target data and data corresponding to the row object of the target data.
[0047] In some embodiments, the first row of the second table includes column numbers corresponding to column objects, and the column numbers are obtained by transposing the row numbers in the first table.
[0048] In some embodiments, the table conversion device may further include:
[0049] A processing module is used to hide the column numbers in the second table.
[0050] In a third aspect, an embodiment of the present disclosure provides a computer device, the computer device comprising:
[0051] Memory;
[0052] processor; and
[0053] computer programs;
[0054] The computer program is stored in the memory and is configured to be executed by the processor to implement any one of the methods described in the first aspect.
[0055] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement any one of the methods described in the first aspect.
[0056] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, comprising computer program instructions, which, when executed by a processor, can implement any of the methods described in the first aspect.
[0057] The table conversion method, device and storage medium provided by the embodiments of the present disclosure obtain information of the column objects of a first table and a first data source, wherein the first data source includes data corresponding to the column objects of the first table and row objects of the first table, determines the row objects of the first table as the column objects of a second table, generates target data based on the data in the first data source, makes the row objects in the target data the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table, thereby generating a second table based on the column objects of the second table and the target data, and can realize conversion of table formats, especially can convert a simple table (i.e., a table with a header in the first row and data arranged in rows in the table) into a cross-table, thereby facilitating users to view and analyze data and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0059] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0060] Figure 1 is a flow chart of a table conversion method provided by an embodiment of the present disclosure;
[0061] Figure 2 It is a schematic diagram of a simple table;
[0062] Figure 3 is a schematic diagram of the data structure of the first table;
[0063] Figure 4 It is a schematic diagram of the data structure of target data;
[0064] Figure 5 is a flow chart of a method for generating target data provided by an embodiment of the present disclosure;
[0065] Figure 6 is a structural diagram of a table conversion device provided by an embodiment of the present disclosure;
[0066] Figure 7 A schematic diagram of the structure of a computer device embodiment provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0067] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0068] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0069] Figure 1 This is a flowchart of a table conversion method provided by an embodiment of the present disclosure. The method can be exemplarily executed by a computer device. The computer device can be understood as a device with computing and processing capabilities, such as a computer, mobile phone, tablet computer, etc., but is not limited to the devices listed here. Figure 1 As shown, in some implementations, the table conversion method provided by the embodiment of the present disclosure may include steps 101 to 104.
[0070] Step 101: Acquire column objects of a first table and information of a first data source of the first table, where the first data source includes data corresponding to the column objects and row objects of the first table.
[0071] In the embodiment of the present disclosure, the first table can be exemplarily understood as a simple table, that is, a table with the header in the first row and the data arranged in rows. For example, Figure 2 It is a schematic diagram of a simple table. Figure 2 In the table, the header is {Name, Age, Address}, where "Name", "Age", and "Address" are column objects of the first table. Column objects are used to describe the attributes, categories, or meanings of the data in the column where the column object is located. {John Brown, 32, New York No. 1 Lake Park} is a set of data. Figure 2 Similarly, {Jim Green, 42, London No.1 Lake Park}, and {Joe Black, 32, Sidney No.1 Lake Park} are arranged in the same row. Figure 2 The data is also arranged in rows.
[0072] The first data source of the first table can be understood as the storage location of the data in the first table. The information of the first data source may include at least the address of the first data source, or a mapping relationship between the first table and the data in the first table. In the embodiment of the present disclosure, the first data source includes the data corresponding to the column objects of the first table and the row objects of the first table. The row objects are used to describe the category or title to which the data in the row where the row object is located belongs.
[0073] In some embodiments, the column objects of the first table and the information about the first data source of the first table may be included in the encapsulation information of the table component. The column objects of the first table and the information about the first data source can be obtained from the encapsulation information of the table component. The table component can be understood as a tool for generating a table. The encapsulation information of the table component can be understood as a class that combines the column objects of the first table, the information about the first source data, and the table component.
[0074] In some embodiments, the encapsulation information of the table component may also include a target flag, which indicates whether to convert the table's display format. For example, if the target flag is "true," it indicates that the table's display format needs to be converted, and the steps of obtaining the column objects of the first table and the information of the first data source of the first table can be performed. If the target flag is "false," it indicates that the table's display format does not need to be converted, and the first table is generated.
[0075] Step 102: Determine the row objects of the first table as column objects of the second table.
[0076] In some implementations, the row objects of the first table can be placed in the second column of the first table by default, with the first column of the first table being the row number corresponding to the row object. In this implementation, the data in the second column of the first table can be obtained from the first data source to obtain the row objects of the first table, and then the row objects of the first table can be transposed to obtain the column objects of the second table.
[0077] In other embodiments, an empty title can be first created as the column object of the first column of the second table, and then the data of the first table can be traversed row by row in the first data source. When traversing to the row object in the first row of the first table, the row object is filled into the empty title as the column object of the first column of the second table. Then, an empty title is created again as the column object of the second column of the second table. When traversing to the row object in the second row of the first table, the row object is filled into the empty title as the column object of the second column of the second table, and so on, until the data of the last row of the first table is traversed and all the column objects of the second table are obtained.
[0078] In another embodiment, the data of the first table can be traversed row by row in the first data source to obtain the row objects and the row numbers corresponding to the row objects in the first table. Then, the traversed row objects are concatenated based on the row numbers corresponding to the row objects to obtain a first array. By transposing the first array, a second array can be obtained. The elements in the second array are the column objects of the second table. For example, if the row object corresponding to the first row is A, the row object corresponding to the second row is B, and the row object corresponding to the third row is C, the data obtained after concatenation is [A, B, C]. T ,in,[] T Indicates the transpose of an array. By [A, B, C] T The second array obtained by transposing is [A, B, C], where A is the column object of the first column of the second table, B is the column object of the second column of the second table, and C is the column object of the third column of the second table.
[0079] Step 103: Generate target data based on the data in the first data source. The row objects included in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table.
[0080] For example, in some implementations, each column object in the first table can be traversed, a new row object can be created for each column object, and the column object can be assigned to the corresponding row object, with the row number of the row object being the column number of the column object. Then, for each column object in the first table, the data corresponding to the column object in the first table can be traversed in sequence, and the traversed data can be filled in the row where the row object corresponding to the column object is located in sequence to obtain the row data corresponding to the row object. Then, according to the row number corresponding to the row object, the data corresponding to the row object can be spliced to obtain the target data. For example, Figure 3 This is a schematic diagram of the data structure of the first table. Figure 4 It is a schematic diagram of the data structure of the target data. Figure 3 In the example, A, B, C, and D are column objects, A1 and A2 are the data corresponding to column object A, B1 and B2 are the data corresponding to column object B, C1 and C2 are the data corresponding to column object C, and D1 and D2 are the data corresponding to column object D. By creating row objects for A, B, C, and D and assigning values to the row objects, we can get the row objects of the target data as A, B, C, and D. By traversing the data of A, we can get the row data corresponding to row object A as A1 and A2. Similarly, the row data corresponding to row object B is B1 and B2, the row data corresponding to row object C is C1 and C2, and the row data corresponding to row object D is D1 and D2. Then, by splicing the row data corresponding to A, B, C, and D, we can get the following: Figure 4 Target data shown.
[0081] Of course, the above is only an example and not the only limitation on the target data generation method.
[0082] Step 104: Generate a second table based on the column objects of the second table and the target data.
[0083] In the disclosed embodiments, a table component can be called to generate a second table using the column objects of the second table and the target data. The table component can generate the second table by, for example, concatenating the column objects of the second table with the target data to generate the second table. This is merely an example of how the table component generates a table, and is not intended to be the only limitation.
[0084] It should be noted that, in some embodiments, the column objects of the second table may be included in the second row of the second table. The first row of the second table may include column numbers, which can be obtained by transposing the row numbers in the first table. In this case, in some embodiments, the column numbers in the second table may be hidden to improve the aesthetics of the second table. The specific hiding method is not specifically limited in the embodiments of this disclosure.
[0085] In an embodiment of the present disclosure, by obtaining information about column objects of a first table and a first data source, the first data source includes data corresponding to the column objects of the first table and row objects of the first table, the row objects of the first table are determined to be column objects of a second table, and target data are generated based on the data in the first data source, so that the row objects in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table, thereby generating a second table based on the column objects of the second table and the target data, which can realize conversion of table formats, especially converting a simple table (i.e., a table with a header in the first row and data arranged in rows in the table) into a cross-table, thereby facilitating users' viewing and analysis of data and improving user experience.
[0086] Figure 5 is a flow chart of a method for generating target data provided by an embodiment of the present disclosure, such as Figure 5 As shown, in some implementations, the embodiment of the present disclosure can generate target data through the method of steps 501 to 503.
[0087] Step 501: Determine the column objects of the first table as the row objects of the target data.
[0088] For example, suppose A11 is the column object of the first column of the first table, B12 is the column object of the second column of the first table, and C13 is the column object of the third column of the first table. The column object of the first table can be represented as [A11, B12, C13]. By transposing [A11, B12, C13], the row object of the target data can be obtained as [A11, B12, C13]. T That is, in some ways, the column objects of the first table may be transposed to obtain the row objects of the target data.
[0089] Step 502: Transpose the data corresponding to the column objects of the first table in the first data source to obtain data corresponding to the row objects of the target data.
[0090] In some embodiments, the information of the first data source may include index information of data corresponding to the column object. The column data corresponding to the column object in the first table can be obtained based on the index information. The column data of the column object can be transposed to convert the column data into row data, and the column number corresponding to the column data is used as the row number corresponding to the row data.
[0091] Step 503: Generate target data based on the row object of the target data and the data corresponding to the row object of the target data.
[0092] In some implementations, the row data may be concatenated according to the row number to obtain the target data, and then the target data and the row object of the target row data may be concatenated to obtain the target data.
[0093] In an embodiment of the present disclosure, by determining the column objects of the first table as the row objects of the target data, transposing the data corresponding to the column objects of the first table in the first data source to obtain the data corresponding to the row objects of the target data, and generating the target data based on the row objects of the target data and the data corresponding to the row objects of the target data, the data of the first table can be quickly converted into the target data.
[0094] Figure 6 is a structural diagram of a table conversion device provided by an embodiment of the present disclosure, such as Figure 6 As shown, in some embodiments, the table conversion device 60 provided by the embodiment of the present disclosure includes:
[0095] A first acquisition module 61 is configured to acquire column objects of a first table and information about a first data source of the first table, where the first data source includes data corresponding to the column objects and row objects of the first table;
[0096] A determination module 62, configured to determine the row objects of the first table as column objects of the second table;
[0097] A first generating module 63 is configured to generate target data based on the data in the first data source, wherein the row objects contained in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table;
[0098] The second generating module 64 is configured to generate the second table based on the column objects of the second table and the target data.
[0099] In some embodiments, the table conversion device 60 may further include:
[0100] A second acquisition module is used to acquire packaging information of a table component, wherein the table component is used to generate a table, and the packaging information includes a target identifier, and the target identifier is used to indicate whether to convert the display form of the table;
[0101] A first acquisition module 61 is configured to generate a cross-table in response to the target identifier indicating generation of the cross-table, and execute the step of acquiring the column objects of the first table and the information of the first data source of the first table;
[0102] The second generating module 64 is configured to:
[0103] The table component is called to adopt the column objects of the second table and the target data to generate the second table.
[0104] In some implementations, the first acquisition module 61 is configured to:
[0105] The column object of the first table and information about the first data source of the first table are obtained from the encapsulation information.
[0106] In some embodiments, the determination module 62 is configured to:
[0107] Traversing and obtaining row objects of the first table from the first data source;
[0108] concatenating the row objects of the first table according to their corresponding row numbers in the first data source to obtain a first array;
[0109] The first array is transposed to obtain a second array, and elements in the second array are determined as column objects of the second table.
[0110] In some implementations, the first generating module 63 is configured to:
[0111] determining the column objects of the first table as row objects of target data;
[0112] Transpose the data corresponding to the column objects of the first table in the first data source to obtain the data corresponding to the row objects of the target data;
[0113] The target data is generated based on the row object of the target data and data corresponding to the row object of the target data.
[0114] In some embodiments, the first row of the second table includes column numbers corresponding to column objects, and the column numbers are obtained by transposing the row numbers in the first table.
[0115] In some embodiments, the table conversion device may further include:
[0116] A processing module is used to hide the column numbers in the second table.
[0117] The table conversion device provided in the embodiment of the present disclosure can execute the method of any of the above method embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0118] It should also be noted that the division of modules in the conversion device of the above table in the embodiment of the present disclosure is schematic and is only a logical functional division. In actual implementation, other division methods may be used. In addition, the functional modules in the various embodiments of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into a single module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
[0119] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a processor-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present disclosure.
[0120] Figure 7 This is a schematic diagram of the structure of a computer device embodiment provided by the present disclosure. Figure 7 As shown, the computer device includes a memory 121 and a processor 122 .
[0121] Memory 121 is used to store programs. In addition to the aforementioned programs, memory 121 may also be configured to store various other data to support operations on the computer device. Examples of such data include instructions for any application or method operating on the computer device, contact member data, phonebook member data, messages, images, videos, etc.
[0122] The memory 121 can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0123] In some implementations, the processor 122 is coupled to the memory 121 to execute a program stored in the memory 121 to perform any of the above method embodiments.
[0124] Further, if Figure 7 As shown, the computer device may further include: a communication component 123, a power component 124, an audio component 125, a display 126 and other components. Figure 7 Only some components are shown schematically, which does not mean that the computer equipment only includes Figure 7 Components shown.
[0125] The communication component 123 is configured to facilitate wired or wireless communication between the computer device and other devices. The computer device can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 123 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 123 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared member data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0126] The power supply component 124 provides power to various components of the computer device. The power supply component 124 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the computer device.
[0127] The audio component 125 is configured to output and / or input audio signals. For example, the audio component 125 includes a microphone (MIC), which is configured to receive external audio signals when the computer device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 121 or transmitted via the communication component 123. In some embodiments, the audio component 125 also includes a speaker for outputting audio signals.
[0128] The display 126 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0129] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method described in any of the above method embodiments.
[0130] In the embodiments of the present disclosure, the above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drives (SSDs)), etc.
[0131] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware. Furthermore, the embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage) containing computer-usable program code.
[0132] An embodiment of the present disclosure provides a computer program product, including computer program instructions, which can implement the method described in any of the above method embodiments when executed by a processor.
[0133] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0134] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A table conversion method, characterized in that: The method comprises: Obtaining a column object of a first table and information about a first data source of the first table, where the first data source includes data corresponding to the column object and row objects of the first table; Determine the row objects of the first table as column objects of the second table; generating target data based on the data in the first data source, wherein the row objects contained in the target data are the column objects of the first table, and the data corresponding to the row objects in the target data are the data corresponding to the column objects of the first table; The second table is generated based on the column objects of the second table and the target data.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining encapsulation information of a table component, wherein the table component is used to generate a table, the encapsulation information includes a target identifier, and the target identifier is used to indicate whether to convert the display form of the table; In response to the target identifier indicating generation of a cross table, executing the step of acquiring the column object of the first table and the information of the first data source of the first table; The generating the second table based on the column objects of the second table and the target data includes: The table component is called to adopt the column objects of the second table and the target data to generate the second table.
3. The method according to claim 2, characterized in that The acquiring the column object of the first table and the information of the first data source of the first table includes: The column object of the first table and information of the first data source of the first table are obtained from the encapsulation information.
4. The method according to claim 1, wherein The determining the row object of the first table as the column object of the second table includes: Traversing and obtaining row objects of the first table from the first data source; concatenating the row objects of the first table according to their corresponding row numbers in the first data source to obtain a first array; The first array is transposed to obtain a second array, and elements in the second array are determined as column objects of the second table.
5. The method according to claim 1, wherein Generating target data based on the data in the first data source includes: determining the column objects of the first table as row objects of target data; Transpose the data corresponding to the column objects of the first table in the first data source to obtain the data corresponding to the row objects of the target data; The target data is generated based on the row object of the target data and data corresponding to the row object of the target data.
6. The method according to any one of claims 1 to 5, characterized in that The first row of the second table includes column numbers corresponding to column objects, and the column numbers are obtained by transposing the row numbers in the first table.
7. The method according to claim 6, characterized in that The method further comprises: The column numbers in the second table are hidden.
8. A computer device, characterized in that: The computer device comprises: Memory; processor; and computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product comprising computer program instructions, wherein when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.