Table processing method and device, electronic equipment and storage medium
By extracting shared text and format sets from table files and generating format identifiers, the problem of repeatedly storing the same data in table files is solved, thus saving storage space.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI KINGSOFT OFFICE SOFTWARE
- Filing Date
- 2022-07-29
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, the same text and formatted data are repeatedly stored in table files, resulting in excessive storage space consumption.
By extracting shared text sets and shared format sets from the table file, format identifiers are generated, format data is stored only once, and the identifiers are used to reference the format data.
This reduces the amount of tabular data stored, saving storage space.
Smart Images

Figure CN115293117B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer information processing, and in particular to a method, apparatus, electronic device and storage medium for processing tables. Background Technology
[0002] Tables are a visual communication mode and an effective means of organizing and processing data. People use tables extensively in their work and life.
[0003] In existing technologies, when storing a spreadsheet file, the text within each cell and its formatting data are completely stored. This results in multiple copies of the same text (where the text content and formatting data are identical) being stored even if the spreadsheet file contains multiple copies of the same formatting data, leading to a large final size of the stored spreadsheet data and consuming a significant amount of storage space. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for processing tables.
[0005] In a first aspect, embodiments of the present invention provide a table processing method, comprising:
[0006] Retrieve the shared text set from the spreadsheet file;
[0007] Obtain the format data associated with each shared text in the shared text set, set each piece of format data to a shared format, and classify it into a shared format set;
[0008] Determine the format identifier for each of the shared formats;
[0009] Table data is generated based on the shared format set and the format identifier.
[0010] In one possible implementation, obtaining the shared text set from the table file includes:
[0011] When the table file is in content editing mode, determine the format data corresponding to each character in each cell of the table file;
[0012] At least one character in the cell that meets the set conditions is identified as shared text, wherein the set conditions include: the format data corresponding to at least one character is different from the format data corresponding to its preceding character and the format data corresponding to its following character;
[0013] If it is determined that the shared text is not included in the shared text set, the shared text will be included in the shared text set.
[0014] In one possible implementation, identifying at least one character in the cell that meets a set condition as shared text includes:
[0015] Read each character in the cell sequentially, and when the first character is read, record a first marker for the first character;
[0016] Starting from the second character read, when the format data corresponding to the currently read character is different from the format data of the previously read character, the first mark is recorded for the currently read character, and the second mark is recorded for the previously read character;
[0017] Characters between adjacent first and second tags are identified as shared text.
[0018] In one possible implementation, determining a format identifier for each of the shared formats includes:
[0019] Determine the sequential number of each shared format in the shared format set;
[0020] The sequence number and the preset string are associated to obtain the format identifier for each of the shared formats.
[0021] In one possible implementation, generating tabular data based on the shared format set and the format identifier includes:
[0022] Each shared text and the format identifier in the shared text set are associated according to a preset rule to generate shared text data;
[0023] Based on the shared text data and the shared format set, tabular data is generated.
[0024] Secondly, embodiments of the present invention provide a table processing method, including:
[0025] When reading the target table file, the table data corresponding to the target table file is obtained from the specified storage space, and the table data is generated according to the format identifier;
[0026] The target table file is displayed using the table data.
[0027] In one possible implementation, displaying the target table using the tabular data includes:
[0028] Read the shared format set and shared text data from the table data. The shared text data is formed by associating each shared text in the shared text set with the format identifier corresponding to the shared text according to a preset rule.
[0029] When a cell references the shared text via an index, the target format identifier corresponding to the shared text referenced by the cell is determined from the shared text data;
[0030] The shared format corresponding to the target format identifier is determined from the shared format set, so as to display the read cell using the shared format corresponding to the target format identifier.
[0031] Thirdly, embodiments of the present invention provide a table processing method, including:
[0032] When the table file is in content editing mode, retrieve at least one formatted data associated with the currently edited text;
[0033] Determine the target format data from the at least one format data;
[0034] Determine the target format identifier for the target format data;
[0035] Generate tabular data based on the currently edited text and the target format identifier.
[0036] In one possible implementation, obtaining at least one formatted data associated with the currently edited text includes:
[0037] Retrieve at least one target shared text from the shared text set that contains the currently edited text;
[0038] Obtain the format data associated with each of the target shared texts from the shared format set.
[0039] In one possible implementation, determining the target format data from the at least one format data includes:
[0040] Display at least one of the aforementioned formatted data;
[0041] Based on user actions, target format data is determined from the at least one format data displayed.
[0042] Fourthly, embodiments of the present invention provide a form processing apparatus, comprising:
[0043] The first acquisition module is used to acquire a shared text set from a table file;
[0044] The second acquisition module is used to acquire the format data associated with each shared text in the shared text set, set each piece of format data as a shared format and classify it into a shared format set;
[0045] A determination module is used to determine the format identifier for each of the shared formats;
[0046] The first generation module is used to generate tabular data based on the shared format set and the format identifier.
[0047] In one possible implementation, the first acquisition module includes:
[0048] The first determining unit is used to determine the format data corresponding to each character in each cell of the table file when the table file is in a content editing state;
[0049] The second determining unit is used to determine at least one character in the cell that meets the set conditions as shared text, wherein the set conditions include: the format data corresponding to at least one character is different from the format data corresponding to its preceding character and the format data corresponding to its following character;
[0050] The inclusion unit includes, when it is determined that the shared text is not included in the shared text set, including including the shared text in the shared text set.
[0051] In one possible implementation, the second determining unit includes:
[0052] The reading sub-unit is used to sequentially read each character in the cell, and when the first character is read, a first mark is recorded for the first character;
[0053] The tagging subunit is used to record the first tag for the currently read character and the second tag for the previously read character when the format data corresponding to the currently read character is different from the format data of the previously read character, starting from the second character read.
[0054] A subunit is defined to identify characters between adjacent first and second tags as shared text.
[0055] In one possible implementation, the determining module includes:
[0056] The third determining unit is used to determine the sequential number of each shared format in the shared format set;
[0057] The association unit is used to associate the sequence number with the preset string to obtain the format identifier of each shared format.
[0058] In one possible implementation, the first generation module includes:
[0059] The first generation unit is used to associate each shared text and the format identifier in the shared text set according to a preset rule to generate shared text data;
[0060] The second generation unit is used to generate tabular data based on the shared text data and the shared format set.
[0061] Fifthly, embodiments of the present invention provide a form processing apparatus, comprising:
[0062] The reading module is used to retrieve the table data corresponding to the target table file from the specified storage space when reading the target table file. The table data is generated according to the format identifier.
[0063] The display module is used to display the target table file using the table data.
[0064] In one possible implementation, the display module includes:
[0065] The reading unit is used to read the shared format set and shared text data in the table data. The shared text data is formed by associating each shared text in the shared text set with the format identifier corresponding to the shared text according to a preset rule.
[0066] The fourth determining unit is used to determine, from the shared text data, the target format identifier corresponding to the shared text referenced by the read cell when the read cell references the shared text through an index;
[0067] The fifth determining unit is used to determine the shared format corresponding to the target format identifier from the shared format set, so as to display the read cell using the shared format corresponding to the target format identifier.
[0068] Sixthly, embodiments of the present invention provide a form processing apparatus, comprising:
[0069] The third acquisition module is used to acquire at least one format data associated with the currently edited text when the table file is in content editing state;
[0070] A format determination module is used to determine target format data from the at least one format data;
[0071] An identifier determination module is used to determine the target format identifier of the target format data.
[0072] The second generation module is used to generate tabular data based on the currently edited text and the target format identifier.
[0073] In one possible implementation, the third acquisition module includes:
[0074] The first acquisition unit is used to acquire at least one target shared text containing the currently edited text from the shared text set;
[0075] The second acquisition unit is used to acquire format data associated with each of the target shared texts from the shared format set.
[0076] In one possible implementation, the format determination module includes:
[0077] A display unit is used to display the at least one formatted data;
[0078] A format determination unit is used to determine target format data from the at least one format data displayed based on user operations.
[0079] In a seventh aspect, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0080] Memory, used to store computer programs;
[0081] A processor, when executing a processing program for a table stored in memory, implements the table processing method described in any of the first, second, and third aspects.
[0082] Eighthly, embodiments of the present invention provide a storage medium storing one or more programs, which can be executed by one or more processors to implement the table processing method described in any one of the first, second, and third aspects.
[0083] The technical solution provided by this invention obtains a shared text set from a table file, acquires the format data associated with each shared text in the shared text set, sets each format data as a shared format and categorizes it into a shared format set, determines the format identifier for each shared format, and generates table data based on the shared format set and the format identifier. This technical solution, by storing the format data in a separate shared format set and directly referencing the format identifier of a specific format data in the text that uses that format data, rather than storing the complete format data as an association, enables the storage of only one copy of format data that appears multiple times within a table file, eliminating the need to store multiple copies. This reduces the size of the final stored table data and saves storage space. Attached Figure Description
[0084] Figure 1A flowchart illustrating an embodiment of a table processing method provided by the present invention;
[0085] Figure 2 This is an example of a table file;
[0086] Figure 3 A flowchart illustrating an embodiment of another table processing method provided by the present invention;
[0087] Figure 4 A flowchart illustrating another embodiment of a table processing method provided by the present invention;
[0088] Figure 5 A flowchart illustrating an embodiment of displaying a target table file provided by an embodiment of the present invention;
[0089] Figure 6 A flowchart illustrating another embodiment of a table processing method provided by the present invention;
[0090] Figure 7 This is a schematic diagram illustrating a data list in an associated format, provided as an embodiment of the present invention.
[0091] Figure 8 A block diagram illustrating an embodiment of a table processing apparatus provided in this invention;
[0092] Figure 9 A block diagram illustrating an embodiment of another form processing apparatus provided in this invention;
[0093] Figure 10 A block diagram illustrating another embodiment of a table processing apparatus provided in this invention;
[0094] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0095] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0096] The table processing method provided in the embodiments of the present invention will be explained and described below with reference to the accompanying drawings and specific examples. The embodiments do not constitute a limitation of the present invention.
[0097] See Figure 1This is a flowchart illustrating an embodiment of a table processing method provided by an embodiment of the present invention. Figure 1 As shown, the method may include the following steps:
[0098] Step 101: Obtain the shared text set from the table file.
[0099] The aforementioned shared text set includes multiple shared texts. Shared text here refers to text that appears in two or more cells within a table file; that is, identical text appearing in two or more cells is defined as shared text. It should be noted that identical text here means that the text content and the formatting used are identical.
[0100] Furthermore, the aforementioned text may include one or more characters, which may be letters, numbers, symbols, etc. It should be noted that when the aforementioned text includes multiple characters, these multiple characters may be of the same type or a combination of different types of characters; this embodiment of the invention does not impose any limitations on this.
[0101] For example, see Figure 2 This is an example of a table file. Figure 2 In the example spreadsheet file, the texts "123", "abc", and "jqk" appear multiple times in different cells, and the three texts use different formatting data. Based on the description of shared text above, from... Figure 1 The shared text set obtained from the table file shown includes these three texts.
[0102] As for the specifics of how the shared text set is obtained from the table file, that will be explained below. Figure 3 The process shown will be explained in detail here.
[0103] Step 102: Obtain the format data associated with each shared text in the shared text set, set each format data to a shared format, and include it in the shared format set.
[0104] The above format data may include multiple format parameters, including but not limited to: font, font size, color, whether italic, whether bold, strikethrough, and underline.
[0105] As described in step 101 regarding the shared text, different shared texts are associated with different format data; that is, each shared text can be associated with corresponding format data. Based on this, in step 102, the format data associated with each shared text in the shared text set is obtained. Meanwhile, as described in step 101 regarding the shared text, the format data associated with the shared text is also used multiple times in the table file. Therefore, each of the above format data can be set as a shared format and categorized into a shared format set.
[0106] Continue with Figure 2 For example, from Figure 2 The shared text set obtained from the table file shown includes three shared texts: "123", "abc", and "jqk". Assume the format data associated with the shared text "123" is {font size 11, gray, SimSun}, the format data associated with the shared text "abc" is {font size 9, green, SimSun}, and the format data associated with the shared text "jqk" is {font size 26, black, Simplified Chinese}. Following the above description, the three format data in the example can be set as shared formats and categorized into a shared format set.
[0107] Step 103: Determine the format identifier for each shared format.
[0108] The aforementioned format identifier can uniquely identify a type of formatted data. This format identifier may include one or more characters, which can be text, numbers, letters, symbols, etc. It should be noted that when the format identifier includes multiple characters, these multiple characters can be of the same type or a combination of different types of characters; this embodiment of the invention does not impose such limitations.
[0109] In one embodiment, when determining the format identifier of each shared format, the sequential number of each shared format in the shared format set can be determined first, and then the sequential number can be associated with a preset string to obtain the format identifier of each shared format.
[0110] For example, assuming the preset string is "ssStrFat", then in the shared format set, the shared format with the sequence number 1 can be identified as "ssStrFat1"; the shared format with the sequence number 2 can be identified as "ssStrFat2", and so on, so that the format identifier of each shared format can be obtained.
[0111] In another embodiment, the storage address of each shared format in the shared format set can be used as the format identifier of that shared format.
[0112] Step 104: Generate tabular data based on the shared format set and format identifiers mentioned above.
[0113] The table data mentioned above refers to the underlying storage data of the table file in the computer's storage medium.
[0114] In one embodiment, each shared text in the shared text set and its corresponding format identifier can first be associated according to preset rules to generate shared text data. Then, the aforementioned table data is generated based on the shared text data, the shared text set, and the shared format set.
[0115] The aforementioned preset rules can refer to the encoding rules of computer languages, such as the encoding rules of XML, etc., and this embodiment of the invention does not specifically limit them. For ease of understanding, the association between the shared text and format identifiers contained in the shared text data is illustrated below: Assume the format identifier corresponding to the shared text "123" is "ssStrFat1", the format identifier corresponding to the shared text "abc" is "ssStrFat2", and the format identifier corresponding to the shared text "jqk" is "ssStrFat3". Then, the shared text data can include {"123": "ssStrFat1"}, {"abc": "ssStrFat2"}, and {"jqk": "ssStrFat3"}.
[0116] The technical solution provided by this invention obtains a shared text set from a table file, acquires the format data associated with each shared text in the shared text set, sets each format data as a shared format and categorizes it into a shared format set, determines the format identifier for each shared format, and generates table data based on the shared format set and the format identifier. This technical solution, by storing the format data in a separate shared format set and directly referencing the format identifier of a specific format data in the text that uses that format data, rather than storing the complete format data as an association, enables the storage of only one copy of format data that appears multiple times within a table file, eliminating the need to store multiple copies. This reduces the size of the final stored table data and saves storage space.
[0117] See Figure 3 This is a flowchart illustrating another embodiment of a table processing method provided by the present invention. Figure 3 The process shown is in Figure 1 Based on the illustrated process, this section focuses on describing specifically how the shared text set is retrieved from the table file. For example... Figure 3 As shown, the process may include the following steps:
[0118] Step 301: With the table file in content editing mode, determine the format data corresponding to each character in each cell of the table file.
[0119] Step 302: Identify at least one character in the cell that meets the set conditions as shared text. The set conditions include: the format data corresponding to at least one character is different from the format data corresponding to the preceding character and the format data corresponding to the following character.
[0120] The following provides a unified explanation of steps 301 and 302:
[0121] From the above Figure 1As described in the illustrated embodiments, multiple characters in the shared text use the same format data. Based on this, in this embodiment of the invention, the shared text can be determined from the cell based on the format data corresponding to the characters in the cell.
[0122] In one embodiment, the above-mentioned setting condition may be: the format data corresponding to at least one character is different from the format data corresponding to both the preceding and following characters. At least one character satisfying this condition is identified as shared text.
[0123] by Figure 2 In the example spreadsheet file, the format data corresponding to the text "123" is different from the format data corresponding to the next character "a". In this case, the text "123" can be identified as shared text. Similarly, the format data corresponding to the text "abc" is different from the format data corresponding to the previous character "3" and the next character "j". In this case, the text "abc" can be identified as shared text. Likewise, the format data corresponding to the text "jqk" is different from the format data corresponding to the previous character "c". In this case, the text "jqk" can be identified as shared text.
[0124] As an optional implementation, the following process can be used to identify at least one character in a cell that meets certain conditions as shared text: Each character in the cell is read sequentially. Upon reading the first character, a first marker is recorded for that first character. Starting from the second character, if the format data corresponding to the currently read character differs from the format data of the previously read character, a first marker is recorded for the currently read character, and a second marker is recorded for the previously read character. Then, the characters between adjacent first and second markers can be identified as shared text.
[0125] The first and second marks mentioned above may include one or more characters, which may be letters, numbers, symbols, etc. It should be noted that when the first and second marks include multiple characters, the multiple characters may be characters of the same type or a combination of characters of different types, and the embodiments of the present invention do not impose any restrictions on this.
[0126] Continue with Figure 2 For example, in the example table file, each character in the cell is read sequentially. When the first character "1" is read, a first mark is recorded for the character "1". When the second character "2" is read, since the format data corresponding to the character "2" is the same as the format data corresponding to the previously read character "1", no mark is recorded for the character "2".
[0127] Similarly, when the character "a" is read, since the format data corresponding to the character "a" is different from the format data corresponding to the previously read character "3", a first marker can be recorded for the character "a" and a second marker can be recorded for the character "3". When the character "j" is read, a first marker is recorded for the character "j" and a second marker is recorded for the character "c".
[0128] When the last character "k" is read, record the second mark for the character "k".
[0129] Finally, the characters between the adjacent first and second tags are identified as shared text, that is, the characters "123", "abc", and "jqk" are identified as shared text respectively.
[0130] Step 303: If it is determined that the shared text is not included in the shared text set, then include the shared text in the shared text set.
[0131] As described in step 101, the shared text set includes multiple shared texts. In this embodiment of the invention, after determining the shared text from the cells of the table file, to avoid the same shared text appearing repeatedly in the shared text set, it can be first determined whether the shared text is included in the shared text set. If it is determined that the shared text is not included in the shared text set, then the shared text is included in the shared text set.
[0132] The technical solution provided by this invention determines the format data corresponding to each character in each cell of a table file while the table file is in content editing mode. At least one character in a cell that meets set conditions is identified as shared text. These set conditions include: the format data corresponding to at least one character is different from the format data corresponding to both the preceding and following characters. If the shared text set does not include shared text, the shared text is included in the shared text set. This technical solution, by determining the shared text in a table file based on the format data corresponding to each character in each cell, achieves accurate determination of the shared text set corresponding to the table file based on the format data of each character.
[0133] See Figure 4 This is a flowchart illustrating another embodiment of a table processing method provided by the present invention. Figure 4 As shown, the process may include the following steps:
[0134] Step 401: When reading the target table file, retrieve the table data corresponding to the target table file from the specified storage space. The table data is generated according to the format identifier.
[0135] The aforementioned designated storage space is used to store the table data of the target table file. This designated storage space can be a storage medium on the execution body of this invention, such as memory or hard disk, or it can be a separate storage medium, such as optical disc or USB flash drive. This embodiment of the invention does not limit this.
[0136] In one embodiment, a user can click on an icon representing a table file to request to view that table file. Upon receiving the user's click, the entity executing the invention can use the table file corresponding to the icon as the target table file and then retrieve the table data corresponding to that target table file from a designated storage space.
[0137] The table data above is generated based on a format identifier, which can be the format identifier corresponding to a shared format in the target table file. For details on how the table data is generated based on the format identifier, please refer to [link to documentation]. Figure 1 The relevant descriptions in the process shown will not be repeated here.
[0138] Step 402: Display the target table file using tabular data.
[0139] The entity executing this invention can use the obtained tabular data to display the target tabular file. See also... Figure 5 This is a flowchart illustrating an embodiment of displaying a target table file according to an embodiment of the present invention, as shown below. Figure 5 As shown, the process may include the following steps:
[0140] Step 501: Read the shared format set and shared text data in the table data. The shared text data is formed by associating each shared text in the shared text set with the format identifier corresponding to the shared text according to preset rules.
[0141] The aforementioned shared text set includes multiple shared texts. Shared text here refers to text appearing in two or more cells within a table file; in other words, identical text appearing in two or more cells is defined as shared text. It should be noted that identical text here means that the text content and the formatting used are identical.
[0142] The above format identifier is the format identifier corresponding to the shared format in the above shared format set, and the format identifier can uniquely identify a format data.
[0143] In this embodiment of the invention, the aforementioned shared text data is generated by associating each shared text in the shared text set with its corresponding format identifier according to a preset rule. For details on how the shared text data is specifically generated by associating each shared text in the shared text set with its corresponding format identifier according to the preset rule, please refer to [link to relevant documentation]. Figure 1 The description of step 104 in the flowchart shown will not be repeated here.
[0144] Based on this, in step 501, the shared format set and shared text data can be read from the table data corresponding to the target table file.
[0145] Step 502: If the read cell references shared text via an index, determine the target format identifier corresponding to the shared text referenced by the read cell from the shared text data.
[0146] Step 503: Determine the shared format corresponding to the target format identifier from the shared format set, so as to display the read cells using the shared format corresponding to the target format identifier.
[0147] The following provides a unified explanation of steps 502 and 503:
[0148] In one embodiment, when a cell in the target table file references shared text via an index, it means that the cell is only associated with the format identifier of the format data used by the shared text, and not with the format data used by the shared text. Therefore, the target format identifier corresponding to the shared text referenced by the cell can be determined from the shared text data.
[0149] Next, the shared format corresponding to the target format identifier is determined from the shared format set, so as to display the read cells using the shared format corresponding to the target format identifier.
[0150] For example, assuming the cell read references the shared text "123" by index, the target format identifier "ssStrFat1" corresponding to the shared text "123" can be determined from the shared text data shown in step 104 above. Then, the shared format corresponding to the target format identifier "ssStrFat1" is determined from the shared format set as {font size 11, gray, SimSun}, and the shared text "123" is displayed using this shared format.
[0151] The technical solution provided by this invention involves retrieving the corresponding table data from a designated storage space when reading a target table file. This table data is generated based on format identifiers, and the target table file is then displayed using this table data. Because the table data is generated based on format identifiers, this solution enables rapid reading and display of a table file even when only one copy of the format data that appears multiple times is stored.
[0152] See Figure 6The flowchart illustrates another embodiment of a table processing method provided by the present invention. Figure 6 As shown, the process may include the following steps:
[0153] Step 601: When the table file is in content editing mode, obtain at least one format data associated with the currently edited text.
[0154] The currently edited text mentioned above refers to the text that is currently being entered into a cell of the spreadsheet file and has not yet been formatted. It can be a single character or a string, and there are no specific restrictions here.
[0155] The format data associated with the currently edited text refers to the format data used when the currently edited text appears in other cells of the table file.
[0156] For example, suppose the currently edited text is "12", and another cell in the spreadsheet contains the text "123" with the format data {font size 11, gray, SimSun}. Another cell in the spreadsheet contains the text "12" with the format data {font size 16, black, KaiTi}. Then, the format data associated with the currently edited text "12" includes both {font size 11, gray, SimSun} and {font size 16, black, KaiTi}.
[0157] Based on the above Figure 3 In one embodiment, the execution subject of this invention can obtain at least one format data associated with the currently edited text by means of the following method: first, obtaining at least one target shared text containing the currently edited text from the shared text set, and then obtaining the format data associated with each target shared text from the shared format set. The format data obtained at this time is the format data associated with the currently edited text.
[0158] For example, in the example above, the shared texts "12" and "123" in the shared text set both contain the currently edited text "12". Therefore, the shared texts "12" and "123" in the shared text set can be identified as the target shared texts. Then, the format data of the target shared texts "12" and "123" are obtained from the shared format set, and these two format data are identified as the format data associated with the currently edited text.
[0159] Step 602: Determine the target format data from at least one format data.
[0160] In one embodiment, at least one format data associated with the currently edited text may be displayed, and then, based on user actions, target format data may be determined from the displayed at least one format data.
[0161] In one optional implementation, when displaying at least one format data associated with the currently edited text, only at least one format data associated with the currently edited text can be displayed. For example, the format data {font size 11, gray, Song typeface} and {font size 16, black, Kai typeface} can be displayed.
[0162] As an alternative implementation, one could display both at least one formatted data associated with the currently edited text and the currently edited text itself using that formatted data. This allows users to more intuitively understand the display effect after applying at least one of the aforementioned formatted data to the currently edited text.
[0163] See Figure 7 This is a schematic diagram illustrating a data list in an associated format, provided by an embodiment of the present invention. Figure 7 The example demonstrates two related formatted data sets. Later, if the user selects the formatted data set {font size 11, gray, SimSun}, then the formatted data set {font size 11, gray, SimSun} will be selected as the target formatted data set.
[0164] Step 603: Determine the target format identifier for the target format data.
[0165] As described in step 103, each shared format in the shared format set can have a corresponding format identifier, which can uniquely identify a type of format data. Based on this, the target format identifier of the target format data can be determined in step 603.
[0166] Step 604: Generate tabular data based on the currently edited text and the target format identifier.
[0167] The table data mentioned above refers to the underlying storage data of the table file in the computer's storage medium.
[0168] In one embodiment, the currently edited text and the aforementioned target format identifier can first be associated according to preset rules to generate shared text data. Then, the aforementioned table data is generated based on the shared text data. For a detailed description of this step, please refer to the above... Figure 1 The relevant descriptions in the illustrated embodiments will not be repeated here.
[0169] Furthermore, it should be noted that in practical applications, users may not need to reuse previously used formatting data when editing text; instead, they can reset the formatting data. This is not specifically limited here. Moreover, when resetting formatting data, after the user has formatted the currently edited text, the reset formatting data can be added to the aforementioned shared formatting set. This way, when the user enters the same text again, they will have more formatting data to choose from.
[0170] The technical solution provided by this invention, when a table file is in content editing mode, obtains at least one format data associated with the currently edited text, determines target format data from the at least one format data, and determines the target format identifier of the target format data. Table data is then generated based on the currently edited text and the target format identifier. This technical solution, by determining the target format data of the currently edited text from at least one format data associated with it, eliminates the need to repeatedly set the format for the same text during text editing in a table file. Instead, it allows users to select the desired format from previously used format data, thus saving user operations. Furthermore, by only generating and storing the table data corresponding to the target format identifier of the currently edited text and the target format data, it eliminates the need to store the format data corresponding to the currently edited text when associated format data exists, thereby reducing the size of the final stored table data and saving storage space.
[0171] See Figure 8 This is a block diagram illustrating an embodiment of a table processing apparatus provided by an embodiment of the present invention. Figure 8 As shown, the device may include:
[0172] The first acquisition module 81 is used to acquire a shared text set from a table file;
[0173] The second acquisition module 82 is used to acquire the format data associated with each shared text in the shared text set, set each of the format data to a shared format and classify it into a shared format set;
[0174] The determining module 83 is used to determine the format identifier for each of the shared formats;
[0175] The first generation module 84 is used to generate tabular data based on the shared format set and the format identifier.
[0176] In one possible implementation, the first acquisition module 81 includes (not shown in the figure):
[0177] The first determining unit is used to determine the format data corresponding to each character in each cell of the table file when the table file is in a content editing state;
[0178] The second determining unit is used to determine at least one character in the cell that meets the set conditions as shared text, wherein the set conditions include: the format data corresponding to at least one character is different from the format data corresponding to its preceding character and the format data corresponding to its following character;
[0179] The inclusion unit includes, when it is determined that the shared text is not included in the shared text set, including including the shared text in the shared text set.
[0180] In one possible implementation, the second determining unit includes (not shown in the figure):
[0181] The reading sub-unit is used to sequentially read each character in the cell, and when the first character is read, a first mark is recorded for the first character;
[0182] The tagging subunit is used to record the first tag for the currently read character and the second tag for the previously read character when the format data corresponding to the currently read character is different from the format data of the previously read character, starting from the second character read.
[0183] A subunit is defined to identify characters between adjacent first and second tags as shared text.
[0184] In one possible implementation, the determining module 83 includes (not shown in the figure):
[0185] The third determining unit is used to determine the sequential number of each shared format in the shared format set;
[0186] The association unit is used to associate the sequence number with the preset string to obtain the format identifier of each shared format.
[0187] In one possible implementation, the first generation module 84 includes (not shown in the figure):
[0188] The first generation unit is used to associate each shared text and the format identifier in the shared text set according to a preset rule to generate shared text data;
[0189] The second generation unit is used to generate tabular data based on the shared text data and the shared format set.
[0190] See Figure 9 This is a block diagram illustrating another embodiment of a table processing apparatus provided by an embodiment of the present invention. Figure 9 As shown, the device may include:
[0191] The reading module 91 is used to obtain the table data corresponding to the target table file from the specified storage space when reading the target table file, and the table data is generated according to the format identifier;
[0192] The display module 92 is used to display the target table file using the table data.
[0193] In one possible implementation, the display module 92 includes (not shown in the figure):
[0194] The reading unit is used to read the shared format set and shared text data in the table data. The shared text data is formed by associating each shared text in the shared text set with the format identifier corresponding to the shared text according to a preset rule.
[0195] The fourth determining unit is used to determine, from the shared text data, the target format identifier corresponding to the shared text referenced by the read cell when the read cell references the shared text through an index;
[0196] The fifth determining unit is used to determine the shared format corresponding to the target format identifier from the shared format set, so as to display the read cell using the shared format corresponding to the target format identifier.
[0197] See Figure 10 This is a block diagram illustrating another embodiment of a table processing apparatus provided by an embodiment of the present invention. Figure 10 As shown, the device may include:
[0198] The third acquisition module 1001 is used to acquire at least one format data associated with the currently edited text when the table file is in content editing state;
[0199] The format determination module 1002 is used to determine target format data from the at least one format data;
[0200] The identifier determination module 1003 is used to determine the target format identifier of the target format data;
[0201] The second generation module 1004 is used to generate tabular data based on the currently edited text and the target format identifier.
[0202] In one possible implementation, the third acquisition module 1001 includes (not shown in the figure):
[0203] The first acquisition unit is used to acquire at least one target shared text containing the currently edited text from the shared text set;
[0204] The second acquisition unit is used to acquire format data associated with each of the target shared texts from the shared format set.
[0205] In one possible implementation, the format determination module 1002 includes (not shown in the figure):
[0206] A display unit is used to display the at least one formatted data;
[0207] A format determination unit is used to determine target format data from the at least one format data displayed based on user operations.
[0208] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 11 The illustrated electronic device 1100 includes at least one processor 1101, a memory 1102, at least one network interface 1104, and a user interface 1103. The various components in the electronic device 1100 are coupled together via a bus system 1105. It is understood that the bus system 1105 is used to implement communication between these components. In addition to a data bus, the bus system 1105 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 11 The general designated all buses as Bus System 1105.
[0209] The user interface 1103 may include a display, keyboard or clicking device (e.g., mouse, trackball), touchpad or touch screen, etc.
[0210] It is understood that the memory 1102 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchlink Dynamic Random Access Memory (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1102 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0211] In some implementations, memory 1102 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 11021 and application program 11022.
[0212] The operating system 11021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 11022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of this embodiment can be included in the application program 11022.
[0213] In this embodiment of the invention, by calling the program or instructions stored in memory 1102, specifically the program or instructions stored in application program 11022, processor 1101 executes the method steps provided in each method embodiment, including, for example:
[0214] Retrieve the shared text set from the spreadsheet file;
[0215] Obtain the format data associated with each shared text in the shared text set, set each piece of format data to a shared format, and classify it into a shared format set;
[0216] Determine the format identifier for each of the shared formats;
[0217] Table data is generated based on the shared format set and the format identifier.
[0218] or,
[0219] When reading the target table file, the table data corresponding to the target table file is obtained from the specified storage space, and the table data is generated according to the format identifier;
[0220] The target table file is displayed using the table data.
[0221] or,
[0222] When the table file is in content editing mode, retrieve at least one formatted data associated with the currently edited text;
[0223] Determine the target format data from the at least one format data;
[0224] Determine the target format identifier for the target format data;
[0225] Generate tabular data based on the currently edited text and the target format identifier.
[0226] The methods disclosed in the above embodiments of the present invention can be applied to processor 1101, or implemented by processor 1101. Processor 1101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 1101 or by instructions in the form of software. The processor 1101 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software unit can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 1102. Processor 1101 reads the information in memory 1102 and, in conjunction with its hardware, completes the steps of the above method.
[0227] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0228] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0229] The electronic device provided in this embodiment may be as follows: Figure 11 The electronic device shown can perform the following: Figure 1 and Figure 3-6 All steps of the table processing method are then implemented. Figure 1 and Figure 3-6 For details on the technical effects of the table processing method, please refer to [link / reference]. Figure 1 and Figure 3-6 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0230] This invention also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory may also include combinations of the above types of memory.
[0231] When one or more programs in the storage medium can be executed by one or more processors to implement the table processing method described above that is executed on the electronic device side.
[0232] The processor is used to execute a processing program for a table stored in memory to implement the following steps of a table processing method executed on the electronic device side:
[0233] Retrieve the shared text set from the spreadsheet file;
[0234] Obtain the format data associated with each shared text in the shared text set, set each piece of format data to a shared format, and classify it into a shared format set;
[0235] Determine the format identifier for each of the shared formats;
[0236] Table data is generated based on the shared format set and the format identifier.
[0237] or,
[0238] When reading the target table file, the table data corresponding to the target table file is obtained from the specified storage space, and the table data is generated according to the format identifier;
[0239] The target table file is displayed using the table data.
[0240] or,
[0241] When the table file is in content editing mode, retrieve at least one formatted data associated with the currently edited text;
[0242] Determine the target format data from the at least one format data;
[0243] Determine the target format identifier for the target format data;
[0244] Generate tabular data based on the currently edited text and the target format identifier.
[0245] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0246] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0247] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for processing tables, characterized in that, include: Retrieve the shared text set from the spreadsheet file; Obtain the format data associated with each shared text in the shared text set, set each piece of format data to a shared format, and classify it into a shared format set; Determine the format identifier for each of the shared formats; Generate tabular data based on the shared format set and the format identifier; The shared text in the shared text set is obtained in the following way: For each cell of the table file, each character in the cell is read sequentially. When the first character is read, a first marker is recorded for the first character. Starting from the second character, if the format data corresponding to the currently read character is different from the format data of the previously read character, the first marker is recorded for the currently read character, and a second marker is recorded for the previously read character. The characters between adjacent first markers and second markers are determined as shared text. If it is determined that the shared text is not included in the shared text set, the shared text will be included in the shared text set.
2. The method according to claim 1, characterized in that, Determine the format identifier for each of the shared formats, including: Determine the sequential number of each shared format in the shared format set; The sequence number and the preset string are associated to obtain the format identifier for each of the shared formats.
3. The method according to claim 1, characterized in that, The step of generating tabular data based on the shared format set and the format identifier includes: Each shared text and the format identifier in the shared text set are associated according to a preset rule to generate shared text data; Based on the shared text data and the shared format set, tabular data is generated.
4. A method for processing tables, characterized in that, include: When reading the target table file, the table data corresponding to the target table file is obtained from the specified storage space, and the table data is generated by the method according to any one of claims 1-3; The target table file is displayed using the table data.
5. The method according to claim 4, characterized in that, The step of displaying the target table using the table data includes: Read the shared format set and shared text data from the table data. The shared text data is formed by associating each shared text in the shared text set with the format identifier corresponding to the shared text according to a preset rule. When a cell references the shared text via an index, the target format identifier corresponding to the shared text referenced by the cell is determined from the shared text data; The shared format corresponding to the target format identifier is determined from the shared format set, so as to display the read cell using the shared format corresponding to the target format identifier.
6. A method for processing tables, characterized in that, include: When the table file is in content editing mode, at least one format data associated with the currently edited text is obtained from a shared format set, which is generated by the method according to any one of claims 1-3; Determine the target format data from the at least one format data; Determine the target format identifier for the target format data; Generate tabular data based on the currently edited text and the target format identifier.
7. The method according to claim 6, characterized in that, The step of obtaining at least one formatted data associated with the currently edited text includes: Retrieve at least one target shared text from the shared text set that contains the currently edited text; Obtain the format data associated with each of the target shared texts from the shared format set.
8. The method according to claim 6, characterized in that, Determining the target format data from the at least one format data includes: Display at least one of the aforementioned formatted data; Based on user actions, target format data is determined from the at least one format data displayed.
9. A form processing apparatus, characterized in that, include: The first acquisition module is used to acquire a shared text set from a table file; The second acquisition module is used to acquire the format data associated with each shared text in the shared text set, set each piece of format data as a shared format and classify it into a shared format set; A determination module is used to determine the format identifier for each of the shared formats; The first generation module is used to generate tabular data based on the shared format set and the format identifier; The shared text in the shared text set is obtained in the following way: For each cell of the table file, each character in the cell is read sequentially. When the first character is read, a first marker is recorded for the first character. Starting from the second character, if the format data corresponding to the currently read character is different from the format data of the previously read character, the first marker is recorded for the currently read character, and a second marker is recorded for the previously read character. The characters between adjacent first markers and second markers are determined as shared text. If it is determined that the shared text is not included in the shared text set, the shared text will be included in the shared text set.
10. A form processing apparatus, characterized in that, include: A reading module is used to retrieve table data corresponding to the target table file from a specified storage space when reading the target table file, wherein the table data is generated by the method according to any one of claims 1-3; The display module is used to display the target table file using the table data.
11. A form processing apparatus, characterized in that, include: The third acquisition module is used to acquire at least one format data associated with the currently edited text from a shared format set when the table file is in a content editing state, wherein the shared format set is generated by the method according to any one of claims 1-3; A format determination module is used to determine target format data from the at least one format data; An identifier determination module is used to determine the target format identifier of the target format data. The second generation module is used to generate tabular data based on the currently edited text and the target format identifier.
12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a processing program for a table stored in memory, implements the table processing method according to any one of claims 1 to 8.
13. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the table processing method according to any one of claims 1 to 8.