Document processing methods, document processing devices and electronic equipment

By obtaining the attribute information of content elements in the document and adjusting the display size parameters of row height and column width, the problem of incomplete table content display in the existing technology is solved, and the display effect and aesthetics of the document are improved.

CN119578368BActive Publication Date: 2026-04-03VIVO MOBILE COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing row height adjustment algorithms cannot effectively adjust table row height to accommodate large images or complex charts inserted during document editing, resulting in incomplete table content display or disordered text layout, affecting document display quality.

Method used

By obtaining the attribute information of content elements in the document, the display size parameters of row height and column width are determined, and the display of content elements is adjusted based on these parameters to meet the display needs of various complex content.

Benefits of technology

It improves the display of documents, ensuring the complete display of various content elements in tables and the consistency of text layout.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119578368B_ABST
    Figure CN119578368B_ABST
Patent Text Reader

Abstract

This application discloses a document processing method, a document processing apparatus, and an electronic device, belonging to the field of computer technology. The document processing method includes: obtaining attribute information of a first content element in a document; determining a first display size parameter of the first content element based on the attribute information, the first display size parameter including at least one of row height and column width; and displaying the first content element based on the first display size parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer technology, and specifically relates to a document processing method, a document processing device, and an electronic device. Background Technology

[0002] As the functions of electronic devices, such as mobile phones, continue to improve, using electronic devices for work is becoming increasingly common. For example, users can use their mobile phones to edit documents.

[0003] Currently, during document editing, electronic devices can use row height adjustment algorithms to adjust the row height of tables within a document, thus avoiding incomplete display of table content due to inconsistent row heights. However, existing row height adjustment algorithms are mostly based on text content, neglecting the display requirements of complex content such as inserted images and charts within tables, resulting in poor table display quality. For example, when a user inserts a large image or complex chart into a table using a mobile phone, existing row height adjustment algorithms cannot adjust the table's row height accordingly, leading to incomplete image display or disordered text layout, ultimately resulting in poor document display quality. Summary of the Invention

[0004] The purpose of this application is to provide a document processing method, document processing device, and electronic device that can improve the display effect of documents.

[0005] In a first aspect, embodiments of this application provide a document processing method, the method comprising:

[0006] Retrieve the attribute information of the first content element in the document;

[0007] Based on attribute information, determine the first display size parameter of the first content element, wherein the first display size parameter includes at least one of row height and column width;

[0008] Display the first content element based on the first display size parameter.

[0009] Secondly, embodiments of this application provide a document processing apparatus, the apparatus comprising:

[0010] The retrieval module is used to retrieve the attribute information of the first content element in the document;

[0011] The determination module is used to determine the first display size parameter of the first content element based on attribute information, wherein the first display size parameter includes at least one of row height and column width;

[0012] The display module is used to display the first content element based on the first display size parameter.

[0013] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the document processing method as described in the first aspect.

[0014] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the document processing method as described in the first aspect.

[0015] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the document processing method as described in the first aspect.

[0016] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the document processing method as described in the first aspect.

[0017] In this embodiment, attribute information of a first content element in a document is obtained; based on the attribute information, a first display size parameter of the first content element is determined, the first display size parameter including at least one of row height and column width; and the first content element is displayed based on the first display size parameter. Thus, by determining at least one of row height and column width based on the attribute information of the first content element in the document, the electronic device can adjust the row height and column width of the first content element based on its attribute information, regardless of the type of content element. This allows the electronic device to meet the display requirements of various complex content in the document when displaying the first content element based on at least one of the row height and column width, thereby improving the document's display effect. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0019] Figure 2 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0020] Figure 3 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0021] Figure 4 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0022] Figure 5This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0023] Figure 6 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0024] Figure 7 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0025] Figure 8 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0026] Figure 9 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0027] Figure 10 This is a flowchart illustrating a document processing method provided in an embodiment of this application;

[0028] Figure 11 This is a schematic diagram of the structure of a document processing device provided in an embodiment of this application;

[0029] Figure 12 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;

[0030] Figure 13 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0031] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0032] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0033] The terms "at least one," "at least one of," etc., used in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included items. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more items, and its meaning is similar to that of "at least one."

[0034] The document processing method, document processing device, electronic device, and medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0035] The document processing method, document processing device, and electronic device provided in this application can be applied to document editing scenarios.

[0036] One application scenario is that the document processing method provided in this application embodiment can be applied to the scenario of editing tables in documents on a mobile phone.

[0037] Currently, during document editing, mobile phones can use row height adjustment algorithms to adjust the row height of tables within the document, thus avoiding incomplete display of table content due to inconsistent row heights. However, the core parameter of existing row height adjustment algorithms is the font height of the text within the table. When adjusting row height using these algorithms, the row height increases linearly with the font height of the text. Therefore, existing row height adjustment algorithms are suitable for displaying single text content within tables. However, when large images or complex charts are inserted into the table, existing row height adjustment algorithms cannot adjust the table's row height accordingly, resulting in incomplete display of images or disordered text layout, leading to poor table display quality.

[0038] To address this, embodiments of this application provide a document processing method, a document processing apparatus, and an electronic device. The method involves obtaining attribute information of a first content element in a document; determining a first display size parameter for the first content element based on the attribute information, the first display size parameter including at least one of row height and column width; and displaying the first content element based on the first display size parameter. Thus, by determining at least one of the row height and column width based on the attribute information of the first content element in the document, the electronic device can adjust the row height and column width of the first content element based on its attribute information, regardless of the type of content element. This allows the electronic device to meet the display requirements of various complex content within the document when displaying the first content element based on at least one of the row height and column width, thereby improving the document's display effect.

[0039] The document processing method provided in this application can be executed by a document processing device. For example, the document processing device can be an electronic device, or a functional component or entity within that electronic device. The following will use an electronic device as an example to illustrate the document processing method provided in this application.

[0040] Figure 1 This is a flowchart illustrating the document processing method provided in an embodiment of this application, such as... Figure 1 As shown, the document processing method provided in this application embodiment may include the following steps 101 to 103.

[0041] Step 101: The electronic device obtains the attribute information of the first content element in the document.

[0042] In some embodiments of this application, the aforementioned documents may include, but are not limited to, any of the following: Word documents, Excel documents, PDF documents, TXT documents, WPS documents, e-book documents, and PPT documents. The specific format can be determined according to actual needs, and in some embodiments, this is not limited.

[0043] In some embodiments of this application, the first content element mentioned above includes, but is not limited to, at least one of the following: a line of content elements or a column of content elements in the document. The specific element can be determined according to actual needs, and in some embodiments, this is not limited.

[0044] It should be noted that when a table exists in the document, the first content element can be a row of cells or a column of cells in the table.

[0045] In some embodiments of this application, the aforementioned attribute information includes, but is not limited to, at least one of the following: the type of the first content element and the display parameters of the first content element. The specific type can be determined according to actual needs, and in some embodiments, this is not limited.

[0046] Step 102: The electronic device determines the first display size parameter of the first content element based on the attribute information.

[0047] In some embodiments of this application, the first display size parameter mentioned above includes at least one of row height and column width.

[0048] In some embodiments of this application, the first content element described above includes multiple sub-elements; combined with Figure 1 ,like Figure 2 As shown, step 102 above can be achieved through the following steps 102a and 102b:

[0049] Step 102a: The electronic device determines the display size parameters of the corresponding sub-element based on the attribute information of each sub-element.

[0050] In some embodiments of this application, when the first content element is a row cell in the table, the plurality of sub-elements can be multiple cells within that row, and the display size parameter of the corresponding sub-elements can be the row height of the corresponding cell. The document processing method provided in this application will be described below using the example of the first content element being a row cell in the table, the plurality of sub-elements being multiple cells within that row, and the display size parameter being the row height.

[0051] In some embodiments of this application, the attribute information of each cell can be the type of the content element in the corresponding cell and the row height of the content element in the cell.

[0052] For example, when the content element in the first cell is text, the type of the content element in the first cell can be text, the display parameters of the content element in the first cell can be the font size of the text, the font width of the text, and the number of lines of text in the corresponding cell, and the first cell can be any cell in the first row of cells.

[0053] For example, when the content element in the first cell is an image, the type of the content element in the first cell can be an image, and the display parameters of the content element in the first cell can be the width, height, and resolution of the image.

[0054] In some embodiments of this application, the electronic device can determine the row height adjustment factor of the first cell based on the type of content elements in the first cell, and then determine the row height of the first cell based on the row height adjustment factor and the display parameters. Each type corresponds to one row height adjustment factor.

[0055] For example, when the content element in the first cell is text, the row height adjustment factor for the first cell is the same as that for text. Similarly, when the content element in the first cell is an image, the row height adjustment factor for the first cell is the same as that for an image.

[0056] In some embodiments of this application, when the content element in the first cell is text, the electronic device can determine the row height of the first cell using the following formula:

[0057]

[0058] Among them, H(E) i,j () indicates the row height of the first cell, Ei,j H(T) represents the first cell mentioned above. i,j ) represents the row height of the first cell above, F s (T i,j ) indicates the font size of the text, F w (T i,j L(T) represents the font width of the text. i,j ) represents the number of lines of text, k1 is the line height adjustment coefficient of text, α1, β1 and γ1 represent the first adjustment parameter, the second adjustment parameter and the third adjustment parameter respectively, i indicates that the first cell above is located in the i-th row of the table above, and j indicates that the first cell above is located in the j-th column of the table above.

[0059] In some embodiments of this application, when the content element in the first cell is an image, the electronic device can determine the row height of the first cell using the following formula:

[0060]

[0061] Among them, S w (P i,j ) and S h (P i,j ) represent the width and height of the image, respectively. r (P i,j ) represents the image resolution, k2 is the image row height adjustment coefficient, and δ and λ are the third and fourth smoothing parameters, respectively.

[0062] In some embodiments of this application, when the content element in the first cell is a content element other than text and image, the electronic device can determine the row height of the first cell using the following formula:

[0063]

[0064] Among them, C w (O i,j ,t) represents the width of other content elements at time t, C h (O i,j ,t) represents the height variation of other content elements, with the integration interval being [a,b], and k3 is the row height adjustment coefficient for other content elements.

[0065] Step 102b: The electronic device determines the first display size parameter based on the largest display size parameter among the display size parameters of multiple sub-elements.

[0066] In some embodiments of this application, when the above display parameter is row height, the above maximum display size parameter is the maximum row height among the row heights of the plurality of cells.

[0067] In this way, the electronic device determines the display size parameters of the corresponding child element based on the attribute information of each child element; and determines the first display size parameter based on the maximum display size parameter among the display size parameters of multiple child elements. It can adjust the first display size parameter of the first content element according to the maximum display size parameter, so that the first display size parameter can match the display requirements of the first content element, thereby improving the display effect of the document.

[0068] In some embodiments of this application, combined with Figure 2 ,like Figure 3 As shown, step 102b above can be achieved through the following step 102b1:

[0069] Step 102b1: The electronic device determines the first display size parameter based on the maximum display size parameter and the first smoothing parameter.

[0070] In some embodiments of this application, the first smoothing parameter is determined based on the difference between the display size parameters of any two of the plurality of sub-elements.

[0071] In some embodiments of this application, when the first content element is a row of the table, the first display parameter can be the row height of the table:

[0072] In some embodiments of this application, the electronic device may determine the first display parameter using the following formula:

[0073]

[0074] Among them, H(R) i ) represents the first display parameter mentioned above. This represents the maximum row height, ΔH. i,j H(E) represents the first smoothing parameter mentioned above. i,1 ),H(E i,2 ),…,H(E i,m R represents the row height of the first cell in the i-th row of the table above, the row height of the second cell, ..., the row height of the m-th cell. i This indicates that the first content element is the i-th cell in the table above.

[0075] In this way, the electronic device determines the first display size parameter based on the maximum display size parameter and the first smoothing parameter. The first display size parameter ensures that the row height and / or column width meet the display requirements of different content elements in the first content element, while maintaining the smoothness of the transition between row and / or column changes, thereby improving the display effect of the document.

[0076] In some embodiments of this application, combined with Figure 3 ,like Figure 4 As shown, step 102b1 above can also be achieved through the following steps A1 and A2:

[0077] Step A1: The electronic device determines the second display size parameter based on the maximum display size parameter and the first smoothing parameter.

[0078] It should be noted that the electronic device can use formula (4) to determine the above-mentioned second display size parameter, which will not be elaborated here.

[0079] Step A2: The electronic device determines the first display size parameter based on the second display size parameter and the maximum display size parameter of the second content element.

[0080] In some embodiments of this application, the second content element is a content element in the document that is adjacent to the first content element.

[0081] In some embodiments of this application, when the first content element is a cell in a row of the table, the second content element is a cell in the adjacent row of the table that is adjacent to the first content element.

[0082] In this way, the electronic device determines the second display size parameter by using the maximum display size parameter and the first smoothing parameter; based on the second display size parameter and the maximum display size parameter of the second content element, it determines the first display size parameter, so that the overall row height and / or column width of the document not only meet the display requirements of different content elements, but also maintain the smoothness and consistency of the transition between rows and / or columns visually, thereby improving the display effect of the document.

[0083] In some embodiments of this application, combined with Figure 4 ,like Figure 5 As shown, step A2 of the above electronic device can be achieved through the following steps B1 and B2:

[0084] Step B1: The electronic device determines the third display size parameter based on the second display size parameter and the first layout information.

[0085] In some embodiments of this application, the first layout information described above characterizes the layout structure of the content elements in the document.

[0086] In some embodiments of this application, when the content element is a table in the aforementioned document, the aforementioned first layout information may be the structural information of the aforementioned table, including the arrangement order of each row of cells in the aforementioned table, the content density, and the row spacing between adjacent rows in the aforementioned table.

[0087] In some embodiments of this application, the electronic device may calculate the aforementioned third display size parameter using the following formula:

[0088]

[0089] Among them, A1(R) i ) represents the third display size parameter mentioned above, ρ and ν are the first row height smoothing adjustment parameters and the second row height smoothing adjustment parameters, respectively, D(R i ) represents the difference in row spacing between the i-th row and its adjacent row in the table; κ is the overall layout adjustment coefficient, w j H represents the weight of the cell in the j-th row of the table above. max (R i ) represents the second display size parameter mentioned above, H max (R j ) represents the second display size parameter corresponding to the j-th row cell in the table above, and ∈ represents the attenuation factor, which makes the influence of adjacent rows in the table gradually weaken as the distance increases.

[0090] Step B2: The electronic device determines the first display size parameter based on the third display size parameter and the maximum display size parameter of the second content element.

[0091] In some embodiments of this application, the electronic device can calculate the aforementioned first display size parameter using the following formula:

[0092]

[0093] Among them, H max (R i-1 ) and H max (R i+1 ) are the maximum display size parameters corresponding to the two rows of cells adjacent to the first content element, respectively; f(x) is the adaptive smoothing function; and η1 is the smoothing adjustment coefficient.

[0094] In this way, the electronic device determines the third display size parameter based on the second display size parameter and the first layout information; the third display size parameter and the maximum display size parameter of the second content element determine the first display size parameter, so that the electronic device can adjust the first display size parameter of the first content element based on the second display size parameter and the first layout information, so that the display size parameter of the first content element can better meet the overall layout requirements of the document, thereby improving the display effect of the document.

[0095] In some embodiments of this application, combined with Figure 4 ,like Figure 6 As shown, step A2 above can also be achieved through the following steps C1 to C4:

[0096] Step C1: The electronic device determines the third display size parameter based on the second display size parameter and the first layout information.

[0097] In some embodiments of this application, the first layout information described above characterizes the layout structure of the content elements in the document.

[0098] Step C2: The electronic device determines the fourth display size parameter based on the third display size parameter and the maximum display size parameter of the second content element.

[0099] It should be noted that the implementation process of the above steps C1 and C2 can refer to the above steps B1 and B2. That is, the electronic device can calculate the above fourth display size parameter by the above formula (6). To avoid repetition, this implementation will not be described again here.

[0100] Step C3: The electronic device determines the fifth display size parameter based on the fourth display size parameter and the first value.

[0101] In some embodiments of this application, the first value is determined based on the fourth display size parameter corresponding to the second content element.

[0102] In some embodiments of this application, the determination of the fourth display size parameter corresponding to the second content element can be performed as follows: a second display size parameter corresponding to the second content element is determined based on the maximum display size parameter of the second content element and the first smoothing parameter; a third display size parameter corresponding to the second content element is determined based on the second display size parameter and the first layout information; and a fourth display size parameter corresponding to the second content element is determined based on the third display size parameter and the maximum display size parameter of the fourth content element, where the fourth content element is the content element adjacent to the second content element in the document. For details, refer to the process for determining the fourth display parameter corresponding to the first content parameter; to avoid repetition, this embodiment will not elaborate further.

[0103] In some embodiments of this application, the electronic device can calculate the aforementioned fifth display size parameter using the following formula:

[0104] A2(R i )=S(R i )+λ1·ΔH i ;

[0105]

[0106] Among them, A2(R) i ) represents the fifth display size parameter mentioned above, λ1 is the smoothing adjustment coefficient, and ΔH i H is the first value mentioned above. ′ (R i ) represents the fourth display parameter mentioned above, H ′ (Ri-1 ) and H ′ (R i+1 S(R) represents the fourth display parameter corresponding to the two rows of cells above the first content element mentioned above. i ) indicates smooth row height.

[0107] Step C4: The electronic device determines the first display size parameter based on the fifth display size parameter and the maximum display size parameter of the second content element.

[0108] In some embodiments of this application, the electronic device can display the third display parameter A1(R) in the above formula (6). i Replace with the fifth display parameter A2(R) mentioned above. i Then, the first display parameter is calculated using the above formula (6).

[0109] In this way, the electronic device determines the fifth display size parameter based on the fourth display size parameter and the first value; and determines the first display size parameter based on the fifth display size parameter and the maximum display size parameter of the second content element. This allows for further adjustment and balance of the changes in the display size parameter of the first content element. At the same time, when the first display size parameter is determined in conjunction with the maximum display size parameter of the second content element, a more natural transition in the display size parameter of the first content element can be achieved, enhancing the overall aesthetics of the document.

[0110] In some embodiments of this application, combined with Figure 4 ,like Figure 7 As shown, step A2 above can also be achieved through steps D1 to D4 as follows:

[0111] Step D1: The electronic device determines the third display size parameter based on the second display size parameter and the first layout information.

[0112] In some embodiments of this application, the first layout information described above represents the layout structure of content elements in the document.

[0113] Step D2: The electronic device determines the fourth display size parameter based on the third display size parameter and the maximum display size parameter of the second content element.

[0114] It should be noted that the implementation process of the above steps D1 and D2 can refer to the above steps B1 and B2. That is, the electronic device can calculate the above fourth display size parameter by the above formula (6). To avoid repetition, this implementation will not be repeated here.

[0115] Step D3: The electronic device determines the sixth display size parameter based on the fourth display size parameter and the display size parameter of the third content element.

[0116] In some embodiments of this application, the aforementioned third content element is a specific type of content element in the above document. For example, the third content element can be at least one of the following: a cross-row image in the above table or an embedded chart.

[0117] In some embodiments of this application, when the third content element is an embedded chart, the electronic device can calculate the display size parameter of the embedded chart using the following formula:

[0118]

[0119] Among them, H(G) embed ) represents the display size parameter of the embedded chart, S w (G embed ) and S h (G embed ) represent the width and height of the embedded chart, respectively, R s (G embed ) represents the resolution of the embedded chart, k5 is the row height adjustment factor, and θ1 and ψ represent the smoothing adjustment parameters.

[0120] In some embodiments of this application, when the third content element is a multi-line image, the electronic device can calculate the display size parameters of the multi-line image using the following formula:

[0121]

[0122] Among them, H(P) cross ) represents the display size parameter for multi-line images, S W (P cross ) and S H (P cross ) represent the width and height of the image spanning multiple rows, respectively. S (P cross () indicates the resolution of the multi-line image.

[0123] In some embodiments of this application, the electronic device can calculate the aforementioned sixth display size parameter using the following formula:

[0124] A3(R i ) = max(H ′ (R i ),H(P cross ),H(G embed (10)

[0125] Among them, A3(R) i ) indicates the sixth display parameter mentioned above.

[0126] Step D4: The electronic device determines the first display size parameter based on the sixth display size parameter and the maximum display size parameter of the second content element.

[0127] In some embodiments of this application, the electronic device can display the third display parameter A1(R) in the above formula (6). i Replace with the sixth display parameter A3(R) mentioned above. i Then, the first display parameter is calculated using the above formula (6).

[0128] It should be noted that the method for determining the column width of a cell in the table above is similar to the method for determining the row height of a cell in the table above. To avoid repetition, this embodiment will not repeat the method here.

[0129] In this way, the electronic device determines the sixth display size parameter based on the fourth display size parameter and the display size parameter of the third content element; and determines the first display size parameter based on the sixth display size parameter and the maximum display size parameter of the second content element. This allows the electronic device to maintain consistency in the layout and display parameter size of specific types of content elements with other content elements in the overall structure of the document, thereby meeting the needs of different types of content elements, ensuring that specific types of content elements are displayed completely and clearly in the document without being cropped or reduced, while maintaining a smooth transition of the display parameters between the first content element and adjacent content elements and the consistency of the overall layout of the document, thus improving the display effect and readability of the document.

[0130] Step 103: The electronic device displays the first content element based on the first display size parameter.

[0131] In some embodiments of this application, when the first content element is a row cell of the table and the first display size parameter is the row height, the electronic device displays the row cell based on the first display size parameter.

[0132] In some embodiments of this application, when the first content element is a column cell of the table and the first display size parameter is the column width, the electronic device displays the row of cells based on the first display size parameter.

[0133] In the document processing method provided in this application embodiment, attribute information of a first content element in the document is obtained; based on the attribute information, a first display size parameter of the first content element is determined, the first display size parameter including at least one of row height and column width; and the first content element is displayed based on the first display size parameter. Thus, by determining at least one of row height and column width according to the attribute information of the first content element in the document, the electronic device can adjust the row height and column width of the first content element based on its attribute information, regardless of the type of content element. This allows the electronic device to meet the display requirements of various complex content in the document when displaying the first content element based on at least one of row height and column width, thereby improving the document's display effect.

[0134] In some embodiments of this application, after step 103 described above, the document processing method provided by this application may further include steps 104 to 107 as follows:

[0135] Step 104: When the first content element is updated, the electronic device obtains the attribute information of the updated first content element.

[0136] In some embodiments of this application, the electronic device can obtain the attribute information of each sub-element in the updated first content element when the first content element is updated.

[0137] In some embodiments of this application, when the first content element is a row cell of the table, the electronic device can obtain the attribute information of each cell in the updated first content element, including the type of the content element in the corresponding cell and the display parameters.

[0138] For example, when the first content element is updated, the content element in the first cell is "this", the type of the content element in the first cell is "text", and the display parameter of the content element in the first cell is the size of the text font.

[0139] For example, in the case of updating the first content element, the content element in the first cell is an image, the type of the content element in the first cell is an image, and the display parameter of the content element in the first cell is the area of ​​the image.

[0140] Step 105: The electronic device determines the seventh display size parameter of the updated first content element based on the attribute information of the updated first content element.

[0141] In some embodiments of this application, when the first content element is a row cell in the table, the updated display size parameters of the first cell in the updated first content element of the electronic device are determined by the attribute information of the first cell.

[0142] In some embodiments of this application, the electronic device may use the following formula to calculate the updated display size parameter of the first cell:

[0143]

[0144] Where H new (E i,j The parameter ) represents the updated display size parameter of the first cell, k6 represents the line height adjustment factor for the text, k7 represents the line height adjustment factor for the image, and k8 represents the line height adjustment factor S(P) for other content elements besides text and images. i,j ) represents the area of ​​the image, f(O) i,j ) are characteristic functions of other content elements.

[0145] In some embodiments of this application, the electronic device determines the updated display size parameter of each sub-element in the updated first content element by formula (11), then determines the updated maximum display size parameter from it, and then determines the seventh display parameter in a manner similar to step A1 above. To avoid repetition, this embodiment will not be described again here.

[0146] Step 106: The electronic device determines the ninth display size parameter based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter.

[0147] In some embodiments of this application, the eighth display size parameter is the display size parameter of the content element adjacent to the updated first content element in the document.

[0148] It should be noted that the calculation process of the eighth display size parameter is similar to that of the seventh display size parameter. To avoid repetition, this embodiment will not repeat the process here.

[0149] In some embodiments of this application, step 106 above can be implemented by the following steps 106a and 106b:

[0150] Step 106a: The electronic device calculates the difference between the seventh display size parameter and the eighth display size parameter to obtain the second value.

[0151] In some embodiments of this application, the eighth display size parameter can be the updated row height of the next row cell adjacent to the first content element.

[0152] In some embodiments of this application, the electronic device may calculate the second value using the following formula:

[0153] ΔH new =H new (R i)-H new (R i+1 (12)

[0154] Where, ΔH new H represents the second value mentioned above. new (R i ) represents the seventh display size parameter mentioned above, H new (R i+1 ) indicates the eighth display size parameter mentioned above.

[0155] Step 106b: The electronic device determines the ninth display size parameter based on the seventh display size parameter, the eighth display size parameter, the second value, and the second smoothing parameter.

[0156] In some embodiments of this application, the electronic device can calculate the aforementioned ninth display size parameter using the following formula:

[0157]

[0158] Among them, A4(R) i ) represents the ninth display parameter mentioned above, and λ2 is the smoothing adjustment coefficient.

[0159] In this way, the electronic device obtains the second value by the difference between the seventh display size parameter and the eighth display size parameter; based on the seventh display size parameter, the eighth display size parameter, the second value, and the second smoothing parameter, the ninth display size parameter is determined, so that when the content of the document changes, the display size parameter of the first content element can be adjusted in real time to ensure that the updated display size parameter can smoothly transition to the adjacent content element and maintain the overall aesthetics and coordination of the document, thereby improving the display effect of the document.

[0160] Step 107: The electronic device displays the updated first content element based on the ninth display size parameter.

[0161] In some embodiments of this application, step 107 above can be implemented by steps 107a to 107c as follows:

[0162] Step 107a: The electronic device determines the tenth display size parameter based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element.

[0163] In some embodiments of this application, the electronic device can determine the tenth display size parameter based on the seventh display parameter determined by the updated display size parameter of the sub-element in the first content element and the aforementioned ninth display size parameter.

[0164] In some embodiments of this application, the electronic device may calculate the aforementioned tenth display parameter using the following formula:

[0165]

[0166] In some embodiments of this application, H final (R i ) represents the tenth display size parameter mentioned above, H ′ max (R i ) represents the seventh parameter mentioned above.

[0167] Step 107b: The electronic device determines the eleventh display size parameter based on the tenth display size parameter and the attribute information of the display screen.

[0168] In some embodiments of this application, the attribute information of the display screen may include at least one of the following: the resolution of the display screen, the screen size of the display screen, and the display ratio of the display screen. The specific attributes can be determined according to actual needs, and are not limited in some embodiments.

[0169] In some embodiments of this application, the electronic device can calculate the aforementioned eleventh display size parameter using the following formula:

[0170]

[0171] Among them, H display (R i ,R s D s ,S r ) indicates the eleventh display dimension parameter mentioned above, R s D represents the resolution of the aforementioned display screen. s S represents the screen size of the aforementioned display. r This indicates the display ratio of the aforementioned display screen.

[0172] Step 107c: The electronic device displays the updated first content element based on the tenth and eleventh display size parameters.

[0173] In some embodiments of this application, step 107c can be implemented by either step 107c1 or step 107c2:

[0174] Step 107c1: When the difference between the tenth display size parameter and the eleventh display size parameter is less than the first threshold, the electronic device displays the updated first content element based on the tenth display size parameter.

[0175] In some embodiments of this application, the electronic device may use the following formula to calculate the difference between the tenth display size parameter and the eleventh display size parameter:

[0176] ΔHfinal =H final (R i )-H display (R i ,R s D s ,S r (16)

[0177] Where, ΔH final This represents the difference between the tenth display size parameter and the eleventh display size parameter.

[0178] In some embodiments of this application, if the difference between the tenth display size parameter and the eleventh display size parameter satisfies the following formula, then the updated first content element is displayed based on the tenth display size parameter.

[0179] |ΔH final |<ε; (17)

[0180] Where ε represents the first threshold mentioned above.

[0181] In some embodiments of this application, when the first content element is a row cell of the table and the tenth display size parameter is the row height, the electronic device can display the updated row cell based on the tenth display size parameter.

[0182] In some embodiments of this application, when the first content element is a column of cells in the table and the tenth display size parameter is the column width, the electronic device can display the updated column of cells based on the tenth display size parameter.

[0183] Step 107c2: When the difference between the tenth display size parameter and the eleventh display size parameter is greater than or equal to the first threshold, the electronic device adjusts the tenth display size parameter and displays the updated first content element based on the adjusted tenth display size parameter.

[0184] Among them, the difference between the adjusted tenth display size parameter and the eleventh display size parameter is less than the first threshold.

[0185] In some embodiments of this application, if the difference between the tenth display size parameter and the eleventh display size parameter does not satisfy the above formula (17), the electronic device can adjust the tenth display size parameter so that the difference between the tenth display size parameter and the eleventh display size parameter is less than the first threshold. Then, the updated first content element is displayed based on the adjusted tenth display size parameter.

[0186] In this way, when the difference between the tenth and eleventh display size parameters is less than a first threshold, the electronic device displays the updated first content element based on the tenth display size parameter; when the difference between the tenth and eleventh display size parameters is greater than or equal to the first threshold, the tenth display size parameter is adjusted, and the updated first content element is displayed based on the adjusted tenth display size parameter. This allows the display size parameters of the first content element to be adjusted according to the attribute information of the display screen, so that the document can maintain a consistent layout and visual effect on different display screens, thereby improving the display effect of the document on different display screens.

[0187] In this way, the electronic device determines the tenth display size parameter based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element. When the first content element is updated, the display size parameter of the first content element can be updated in a timely manner based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element. This ensures that the updated display size parameter can meet the display requirements of the updated first content element, thereby improving the display effect of the document.

[0188] The following example, using a table as the first content element in a document, illustrates how electronic devices process documents. Figure 8 As shown, this document processing method may include the following steps:

[0189] Step 21: The electronic device acquires the table in the document to be processed and preprocesses the table;

[0190] Step 22: The electronic device analyzes the table content row by row using a dynamic segmentation algorithm, identifies the content elements in each row, and determines the row height requirement for each content element. The dynamic segmentation algorithm calculates the maximum row height requirement for each row based on the text font size and image size of each content element.

[0191] Step 23: The electronic device constructs the first-layer adaptive adjustment model, receives the row height requirements generated by the dynamic segmentation algorithm, and generates a preliminary adaptive row height adjustment scheme in combination with the overall structure of the table. The first-layer adaptive adjustment model dynamically adjusts the row height of each row according to the adaptive row height adjustment scheme of the content.

[0192] Step 24: The electronic device optimizes the adaptive row height adjustment scheme generated by the first-layer adaptive adjustment model, and evaluates the overall visual aesthetics and coordination of the table through the row height smoothing algorithm to make the row heights of the table transition smoothly.

[0193] For example, in combination Figure 9 As shown, the process of generating an adaptive row height adjustment scheme using the first-layer adaptive adjustment model may include the following steps:

[0194] Step 301: The electronic device first receives the row height requirement generated by the dynamic segmentation algorithm;

[0195] Step 302: The electronic device, in conjunction with the overall structure of the table, executes step 303.

[0196] Step 303: The electronic device calculates the initial row height adjustment value for each row.

[0197] Step 304: The electronic device dynamically adjusts the row height of each row according to the row height requirement;

[0198] Step 305: The electronic device uses a row height smoothing algorithm to optimize the row height transition.

[0199] Step 306: The electronic device generates a preliminary row height adjustment plan.

[0200] For example, when an electronic device adjusts its row height using a preliminary row height adjustment scheme, it can generate corresponding preliminary row height values ​​based on different row height requirements. For example... Figure 9 As shown, row height requirement 1 can be used to generate initial row height value 1, row height requirement 2 can be used to generate initial row height value 2, and row height requirement 3 can be used to generate initial row height value 3.

[0201] Step 25: The electronic device constructs a second-layer adaptive adjustment model, further optimizes the row height adjustment scheme based on the adaptive row height adjustment scheme, and obtains the final adaptive row height adjustment scheme for the case where the table contains cross-row images and embedded charts.

[0202] For example, in combination Figure 10 As shown, the second-layer adaptive adjustment model for row height of multi-line images and embedded charts may include the following steps:

[0203] Step 401: Preliminary line height adjustment scheme for electronic equipment reception.

[0204] Step 402: The electronic device identifies cross-row images and embedded charts in the table.

[0205] Step 403: The electronic device calculates the row height requirements for cross-line images and the row height requirements for embedded charts.

[0206] Step 404: Row height requirements for cross-line images and embedded charts in electronic devices.

[0207] Step 405: The electronic device generates the final adaptive row height adjustment scheme.

[0208] For example, combined Figure 10 As shown, electronic devices can adopt a final adaptive row height adjustment scheme, adjusting the row height according to the row height requirements of cross-line images and embedded charts, and generating the final row height adjustment value.

[0209] Step 26: When the table content changes dynamically, the electronic device updates the adaptive row height adjustment scheme in real time. The adaptive adjustment model dynamically captures the changes and adjusts the row height of the table in real time.

[0210] Step 27: The electronic device outputs the final table structure after adaptive row height adjustment, and adaptively adjusts the column width according to the column width adjustment scheme. The column width adjustment method is the same as the row height adjustment method, so that the table content can maintain a consistent display effect on different display terminals.

[0211] In this embodiment, step 21 includes the following sub-steps:

[0212] Step 211: The electronic device acquires the table data in the document to be processed, table data M. table It is a cell C containing multiple cells i,j The matrix:

[0213] M table ={C i,j |i=1,2,…,n; j=1,2,…,m}; (18)

[0214] Where i represents the row number of the table, j represents the column number of the table, n and m represent the total number of rows and columns of the table, respectively, and C i,j For the cell located in row i and column j, the table data includes text, images, and other content in various formats.

[0215] Step 212: The electronic device preprocesses the table data.

[0216] Step 213: Identify row R in the electronic device identification table. i and L i And determine each cell C i,j The content elements in the text are distinguished by the following piecewise functions:

[0217]

[0218] Among them, E i,j This refers to cell C. i,j The content element in T i,j For text elements, P i,j For image elements, O i,j For other content elements.

[0219] For example, an electronic device can parse the format and structure information of a document and identify the format attributes of each content element, including the font size F of the text. s (T i,j ) and image size S (P i,j ), and record each cell Ci,j The content types in the data are represented using a classification function:

[0220]

[0221] Where Text represents cell C i,j The content type is text, and Image represents cell C. i,j The content type in the text is an image, and "Other" indicates cell C. i,j The content type is any type other than text and images.

[0222] In this embodiment, step 22 includes the following sub-steps:

[0223] Step 221: The electronic device uses a dynamic segmentation algorithm to process each row R in the table. i The analysis is performed line by line, and the R values ​​in each line are identified during the analysis. i Content element E i,j , content element E i,j For cell C in row i and column j i,j Content elements within;

[0224] Step 222: The electronic device determines the row height requirement for each content element, and calculates the row height requirement (i.e., the row height H(E) of the first cell mentioned above) according to the different content element types in the table. i,j )):

[0225] When the content element is text T i,j At that time, the demand for H(E) is high. i,j It can be calculated by combining multiple text feature functions, specifically by using the above formula (1).

[0226] When the content element is an image (P) i,j At that time, the demand for H(E) is high. i,j The calculation is based on the multidimensional attributes of the image, and the display requirements of the image are represented by a nonlinear function. Specifically, it can be calculated using the above formula (2).

[0227] When the content element is other content O i,j At that time, the demand for H(E) is high. i,j The content is segmented according to its unique attributes, and can be calculated using the formula (3) above.

[0228] Step 223, the electronic device in each line R i In the middle, by comparing the line height demand H(E) of each content element i,j )Calculate the maximum row height requirement H max (R i(i.e., the second display size parameter determined by the above formula (4)).

[0229] S24, Based on the maximum row height requirement H for each row max (R i For each row R in the table i Adjust the row height to match the content requirements.

[0230] In this embodiment, step 23 includes the following sub-steps:

[0231] Step 231: The electronic device constructs a first-layer adaptive adjustment model. The first-layer adaptive adjustment model receives the maximum row height requirement H for each row. max (R i ), combined with the overall structure G of the table, the overall structure includes the arrangement order of each row, the content density and the row spacing;

[0232] Step 232, based on row height requirement H max (R i Given the overall table layout structure G, calculate the initial adaptive row height adjustment value A1(R) for each row. i (i.e., the third display size parameter calculated by formula (5)).

[0233] Step 233: Adjust the initial adaptive row height value A1(R) i The row height of each row is dynamically adjusted to conform to the overall table layout requirements, and the actual row height of each row is updated. (That is, the first display parameter shown by the above formula (6))

[0234] In this embodiment, step 24 includes the following sub-steps:

[0235] Step 241: The electronic device performs a preliminary adaptive line height adjustment scheme A1(R). i The table is optimized by applying a row height smoothing algorithm to evaluate the overall visual aesthetics and harmony of the table. During the optimization process, the changes in row height between adjacent rows are smoothed.

[0236] Step 242: The electronic device evaluates and adjusts the row height of each row by constructing a row height smoothing function, and adjusts the smoothed row height S(R) of each row. i Adjustments are made based on the row height difference ΔH between adjacent rows. i A smooth transition is performed to obtain the optimized row height adjustment scheme A2(R). i (i.e., the fifth display parameter mentioned above).

[0237] For example, the electronic device calculates the optimized row height adjustment scheme A2(R) using the above formula 7. i ).

[0238] Step 243: The electronic device will adjust the line height according to scheme A2(R) i A smooth transition between row heights in each row of a table.

[0239] For example, the electronic device can adjust the initial adaptive row height value A1(R) in the above formula (6). i Replace with the optimized row height adjustment scheme A2(R) described above. i Then, the actual row height of each row is calculated using the above formula (6) to achieve a smooth transition between row heights.

[0240] In this embodiment, step 25 includes the following sub-steps:

[0241] Step 251: The electronic device constructs a second-layer adaptive adjustment model, which is based on the first-layer adaptive adjustment scheme A2(R). i Optimize for images containing cross-line views (P) cross and embedded chart G embed In this case, ensure that the row height of the content is consistent with the rest of the table;

[0242] Step 252: For the multi-line image P cross Calculate the required row height H(P) cross (i.e., the display size parameters of the aforementioned cross-line image), for the embedded chart G embed Calculate the required row height H(G) embed (Embedded chart display size parameters), and adjusted based on the chart's multidimensional attributes:

[0243] For example, an electronic device can use the above formula (8) to calculate the embedded graph G. embed Required row height H(G) embed The electronic time can be calculated using the above formula (9) for the cross-line image P. cross Required row height H(P) cross ).

[0244] Step 253: Adjust the row height requirement H(P) for multi-line images and embedded charts. cross ) and H(G embed The line height adjustment scheme A3(R) is updated by combining the line height of other content with the overall line height calculation. i (i.e., the sixth display size parameter mentioned above), and uses the final optimized adaptive line height adjustment scheme A3(R) i Adjust the actual row height of each row.

[0245] For example, the electronic device can use the above formula (10) to calculate the final optimized adaptive line height adjustment scheme A3(R) i ).

[0246] In this embodiment, step 26 includes the following sub-steps:

[0247] Step 261: When the table content changes dynamically, the electronic device monitors the status changes of each cell in the table in real time. Dynamic changes in the table content include the addition, deletion, or modification of content elements. The device records and updates the content type E of each cell. i,j and its high demand;

[0248] Step 262: The electronic device recalculates the row height requirement for each cell based on the dynamically changing table content and uses the updated row height requirement H. new (E i,j (i.e., the updated display size parameters mentioned above) dynamically adjusts the row height of the entire table.

[0249] For example, the electronic device can use the above formula (11) to calculate the updated row height requirement H. new (E i,j ).

[0250] Step 263: When changes in the table content affect adjacent rows, the electronic device automatically updates the row height smoothing adjustment scheme and outputs the final adaptive row height adjustment scheme A4(R). i (i.e., the ninth display size parameter mentioned above) ensures that the overall row height of the table remains consistent after the content changes.

[0251] For example, the electronic device can use the above formula (13) to calculate the final adaptive line height adjustment scheme A4(R) i ).

[0252] Step 264: The electronic device dynamically adjusts the row height of each row of the table according to the updated row height requirements and row height smoothing scheme, and outputs the final adaptive row height adjustment scheme so that the table row height keeps synchronized with the content under any content change.

[0253] In this embodiment, step 27 includes the following sub-steps:

[0254] Step 271: After completing all line height adjustments, the electronic device outputs the final adaptive line height adjustment scheme A4(R). i After that, the optimized table structure S is generated. final The optimized table structure S final The final row height H of each row final (R i (i.e., the tenth display parameter mentioned above), the table structure is based on the final row height H of each row. final (R i The content characteristics of each cell are displayed in a comprehensive manner.

[0255] For example, the electronic device can use the above formula (14) to calculate the final row height H. final (R i ).

[0256] Step 272: Evaluate the table at different resolutions R on different display terminals using electronic devices. s Screen size D s and display ratio S r The display effect ensures that the table maintains a consistent layout and display effect across various terminals;

[0257] Step 273: The electronic device adaptively adjusts the slight line height deviation appearing on the display terminal based on the evaluation results, adjusting the line height deviation ΔH on different terminals. final The value is less than the preset value ε to ensure that the table content is displayed consistently across various terminals.

[0258] For example, electronic devices can adaptively adjust for small line height deviations using the above formulas (15) to (17).

[0259] Step 274: The electronic device adaptively adjusts the column width according to the column width adjustment scheme. The column width adjustment method is the same as the row height adjustment method.

[0260] Step 275: The electronic device outputs the final optimized table structure. The layout of the table content is consistent across all display terminals, and the row height and column width are synchronized with the content.

[0261] The document processing method provided in this application is based on a multi-layer adaptive model for precise row height adjustment. By constructing a first-layer and a second-layer adaptive adjustment model, it can accurately identify complex content in tables, such as multi-row images and embedded charts, and automatically adjust the row height of each row. The first-layer model handles the row height requirements of ordinary text and image elements based on a preliminary adjustment scheme generated by a dynamic segmentation algorithm, while the second-layer model is specifically optimized for handling multi-row content, ensuring that complex content remains consistent with other parts of the table. Compared to traditional fixed row height algorithms, this invention adopts an optimization method based on weight coefficients and multi-dimensional characteristic analysis, resulting in a more aesthetically pleasing layout after adjustment, avoiding layout chaos caused by manual adjustments.

[0262] The document processing method provided in this application can dynamically capture and adjust row height in real time. Addressing the frequent updates to table content on mobile devices, this invention designs a mechanism for real-time capture of table content changes and dynamic adjustment of row height. By monitoring the content status of each cell, when a user adds, deletes, or modifies content, the system can immediately calculate the new row height requirement and complete the adjustment within milliseconds. The row height calculation employs a smoothing adjustment function and a decay factor to ensure a natural transition in height differences between adjacent rows, avoiding table structure imbalance caused by frequent modifications. This mechanism is particularly suitable for mobile office scenarios, improving the smoothness and user experience when editing tables.

[0263] The document processing method provided in this application enables consistent display and adaptation optimization across devices. Specifically, it addresses the differences in resolution and screen ratio between mobile devices and various terminal devices by designing a multi-terminal adaptation algorithm based on consistency assessment and row height optimization. By introducing a display terminal adaptation formula, the row height of the table is dynamically corrected to ensure consistent display of the same table on different devices. At different resolutions, the algorithm of this invention can automatically scale and adjust the height of content elements, ensuring a uniform visual effect for the table on mobile phones, tablets, and high-resolution displays. Compared to traditional row height adjustment techniques, this invention significantly improves the cross-device user experience and solves the problems of table misalignment and distortion caused by differences in terminal display.

[0264] It should be noted that the specific implementation process of the document processing method in the above steps can be found in the relevant description of the above embodiments. To avoid repetition, this embodiment will not repeat it here.

[0265] It should be noted that each of the above method embodiments, or various possible implementations of each method embodiment, can be executed individually or in combination of any two or more. The specific implementation can be determined according to actual usage requirements, and this application embodiment does not impose any restrictions on this.

[0266] The document processing method provided in this application can be executed by a document processing device. This application uses a document processing device executing the document processing method as an example to illustrate the document processing device provided in this application.

[0267] Figure 11 This is a schematic diagram of the structure of a document processing device 1100 provided in an embodiment of this application. The document processing device 1100 includes: an acquisition module 1101, a determination module 1102, and a display module 1103.

[0268] Among them, the acquisition module 1101 is used to acquire the attribute information of the first content element in the document;

[0269] The determining module 1102 is used to determine a first display size parameter of the first content element based on the attribute information, wherein the first display size parameter includes at least one of row height and column width;

[0270] Display module 1103 is used to display the first content element based on the first display size parameter.

[0271] In some embodiments of this application, the first content element includes multiple sub-elements; the determining module is specifically used for:

[0272] Based on the attribute information of each child element, determine the display size parameters of the corresponding child element;

[0273] The first display size parameter is determined based on the maximum display size parameter among the display size parameters of the plurality of sub-elements.

[0274] In some embodiments of this application, the determining module 1102 is specifically used for:

[0275] The first display size parameter is determined based on the maximum display size parameter and the first smoothing parameter, wherein the first smoothing parameter is determined based on the difference between the display size parameters of any two sub-elements among the plurality of sub-elements.

[0276] In some embodiments of this application, the determining module 1102 is specifically used for:

[0277] Based on the maximum display size parameter and the first smoothing parameter, the second display size parameter is determined;

[0278] The first display size parameter is determined based on the second display size parameter and the maximum display size parameter of the second content element, and the second content element is the content element in the document that is adjacent to the first content element.

[0279] In some embodiments of this application, the determining module 1102 is specifically used for:

[0280] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0281] The first display size parameter is determined based on the third display size parameter and the maximum display size parameter of the second content element.

[0282] In some embodiments of this application, the determining module 1102 is specifically used for:

[0283] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0284] Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined;

[0285] Based on the fourth display size parameter and the first value, a fifth display size parameter is determined, wherein the first value is determined based on the second display size parameter corresponding to the second content element;

[0286] The first display size parameter is determined based on the fourth display size parameter and the maximum display size parameter of the second content element.

[0287] In some embodiments of this application, the determining module 1102 is specifically used for:

[0288] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0289] Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined;

[0290] Based on the fourth display size parameter and the third content element's display size parameter, a sixth display size parameter is determined, wherein the third content element is a specific type of content element in the document;

[0291] The first display size parameter is determined based on the sixth display size parameter and the maximum display size parameter of the second content element.

[0292] In some embodiments of this application, the acquisition module 1101 is further configured to:

[0293] If the first content element is updated, obtain the attribute information of the updated first content element;

[0294] The determining module is further configured to determine the seventh display size parameter of the updated first content element based on the updated attribute information of the first content element;

[0295] Based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter, a ninth display size parameter is determined. The eighth display size parameter is the display size parameter of the content element in the document that is adjacent to the updated first content element.

[0296] The display module is also used to display the updated first content element based on the ninth display size parameter.

[0297] In some embodiments of this application, the determining module 1102 is specifically used for:

[0298] The difference between the seventh display size parameter and the eighth display size parameter is calculated to obtain the second value;

[0299] The ninth display size parameter is determined based on the seventh display size parameter, the eighth display size parameter, the second value, and the second smoothing parameter.

[0300] In some embodiments of this application, the display module 1103 is specifically used for:

[0301] Based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element, the tenth display size parameter is determined;

[0302] Based on the tenth display size parameter and the display screen's attribute information, the eleventh display size parameter is determined;

[0303] Based on the tenth display size parameter and the eleventh display size parameter, the updated first content element is displayed.

[0304] In some embodiments of this application, the display module 1103 is specifically used for:

[0305] If the difference between the tenth display size parameter and the eleventh display size parameter is less than a first threshold, the updated first content element is displayed based on the tenth display size parameter;

[0306] or,

[0307] If the difference between the tenth display size parameter and the eleventh display size parameter is greater than or equal to the first threshold, the tenth display size parameter is adjusted, and the updated first content element is displayed based on the adjusted tenth display size parameter; wherein the difference between the adjusted tenth display size parameter and the eleventh display size parameter is less than or equal to the first threshold.

[0308] The document processing apparatus provided in this application obtains attribute information of a first content element in a document; a determining module is used to determine a first display size parameter of the first content element based on the attribute information, the first display size parameter including at least one of row height and column width; and a display module is used to display the first content element based on the first display size parameter. Thus, by determining at least one of row height and column width based on the attribute information of the first content element in the document, the electronic device can adjust the row height and column width of the first content element based on its attribute information, regardless of the type of content element. This allows the electronic device to meet the display requirements of various complex content in the document when displaying the first content element based on at least one of the row height and column width, thereby improving the document's display effect.

[0309] The document processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device, augmented reality / virtual reality device, robot, wearable device, super mobile personal computer, netbook, or personal digital assistant, etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the scope of the device.

[0310] The document processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0311] The document processing apparatus provided in this application embodiment can implement the various processes implemented in the various embodiments of the above document processing method. To avoid repetition, it will not be described again here.

[0312] Optionally, such as Figure 12 As shown, this application embodiment also provides an electronic device 1200, including a processor 1201 and a memory 1202. The memory 1202 stores a program or instructions that can run on the processor 1201. When the program or instructions are executed by the processor 1201, they implement the various steps of the above-described document processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0313] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0314] Figure 13 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0315] The electronic device 1300 includes, but is not limited to, components such as: radio frequency unit 1301, network module 1302, audio output unit 1303, input unit 1304, sensor 1305, display unit 1306, user input unit 1307, interface unit 1308, memory 1309, and processor 1310.

[0316] Those skilled in the art will understand that the electronic device 1300 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1310 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 13 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0317] Among them, processor 1310 is used to obtain the attribute information of the first content element in the document;

[0318] Based on the attribute information, a first display size parameter of the first content element is determined, wherein the first display size parameter includes at least one of row height and column width;

[0319] Display unit 1306 is used to display the first content element based on the first display size parameter.

[0320] In some embodiments of this application, the first content element includes multiple sub-elements; the processor 1310 is specifically used for:

[0321] Based on the attribute information of each child element, determine the display size parameters of the corresponding child element;

[0322] The first display size parameter is determined based on the maximum display size parameter among the display size parameters of the plurality of sub-elements.

[0323] In some embodiments of this application, the processor 1310 is specifically used for:

[0324] The first display size parameter is determined based on the maximum display size parameter and the first smoothing parameter, wherein the first smoothing parameter is determined based on the difference between the display size parameters of any two sub-elements among the plurality of sub-elements.

[0325] In some embodiments of this application, the processor 1310 is specifically used for:

[0326] Based on the maximum display size parameter and the first smoothing parameter, the second display size parameter is determined;

[0327] The first display size parameter is determined based on the second display size parameter and the maximum display size parameter of the second content element, and the second content element is the content element in the document that is adjacent to the first content element.

[0328] In some embodiments of this application, the processor 1310 is specifically used for:

[0329] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0330] The first display size parameter is determined based on the third display size parameter and the maximum display size parameter of the second content element.

[0331] In some embodiments of this application, the processor 1310 is specifically used for:

[0332] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0333] Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined;

[0334] Based on the fourth display size parameter and the first value, a fifth display size parameter is determined, wherein the first value is determined based on the second display size parameter corresponding to the second content element;

[0335] The first display size parameter is determined based on the fourth display size parameter and the maximum display size parameter of the second content element.

[0336] In some embodiments of this application, the processor 1310 is specifically used for:

[0337] Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document;

[0338] Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined;

[0339] Based on the fourth display size parameter and the third content element's display size parameter, a sixth display size parameter is determined, wherein the third content element is a specific type of content element in the document;

[0340] The first display size parameter is determined based on the sixth display size parameter and the maximum display size parameter of the second content element.

[0341] In some embodiments of this application, the processor 1310 is specifically used for:

[0342] If the first content element is updated, obtain the attribute information of the updated first content element;

[0343] The determining module is further configured to determine the seventh display size parameter of the updated first content element based on the updated attribute information of the first content element;

[0344] Based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter, a ninth display size parameter is determined. The eighth display size parameter is the display size parameter of the content element in the document that is adjacent to the updated first content element.

[0345] The display module is also used to display the updated first content element based on the ninth display size parameter.

[0346] In some embodiments of this application, the processor 1310 is specifically used for:

[0347] The difference between the seventh display size parameter and the eighth display size parameter is calculated to obtain the second value;

[0348] The ninth display size parameter is determined based on the seventh display size parameter, the eighth display size parameter, the second value, and the second smoothing parameter.

[0349] In some embodiments of this application, the display unit 1306 is specifically used for:

[0350] Based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element, the tenth display size parameter is determined;

[0351] Based on the tenth display size parameter and the display screen's attribute information, the eleventh display size parameter is determined;

[0352] Based on the tenth display size parameter and the eleventh display size parameter, the updated first content element is displayed.

[0353] In some embodiments of this application, the display unit 1306 is specifically used for:

[0354] If the difference between the tenth display size parameter and the eleventh display size parameter is less than a first threshold, the updated first content element is displayed based on the tenth display size parameter;

[0355] or,

[0356] If the difference between the tenth display size parameter and the eleventh display size parameter is greater than or equal to the first threshold, the tenth display size parameter is adjusted, and the updated first content element is displayed based on the adjusted tenth display size parameter; wherein the difference between the adjusted tenth display size parameter and the eleventh display size parameter is less than or equal to the first threshold.

[0357] In this way, the electronic device determines at least one of the row height and column width based on the attribute information of the first content element in the document. This allows the electronic device to adjust the row height and column width of the first content element based on its attribute information, regardless of what kind of content element it is. As a result, when the electronic device displays the first content element based on at least one of the row height and column width, it can meet the display requirements of various complex content in the document, thereby improving the display effect of the document.

[0358] In the electronic device provided in this application, attribute information of a first content element in a document is obtained; based on the attribute information, a first display size parameter of the first content element is determined, wherein the first display size parameter includes at least one of row height and column width; and based on the first display size parameter, the first content element is displayed.

[0359] It should be understood that, in this embodiment, the input unit 1304 may include a graphics processing unit (GPU) 13041 and a microphone 13042. The GPU 13041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1306 may include a display panel 13061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 1307 includes a touch panel 13071 and at least one of other input devices 13072. The touch panel 13071 is also called a touch screen. The touch panel 13071 may include a touch detection device and a touch controller. Other input devices 13072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0360] The memory 1309 can be used to store software programs and various data. The memory 1309 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1309 may include volatile memory or non-volatile memory, or both. The non-volatile memory may 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. Volatile memory can be random access memory (RAM), 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), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1309 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0361] Processor 1310 may include one or more processing units; optionally, processor 1310 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 1310.

[0362] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described document processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0363] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0364] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described document processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0365] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0366] This application provides a computer program product that is stored in a storage medium and executed by at least one processor to implement the various processes of the document processing method embodiments described above, and can achieve the same technical effects. To avoid repetition, it will not be described again here.

[0367] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0368] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0369] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A document processing method, characterized in that, The method includes: Retrieve the attribute information of the first content element in the document; Based on the attribute information, a first display size parameter of the first content element is determined, wherein the first display size parameter includes at least one of row height and column width; Based on the first display size parameter, display the first content element; The method further includes: If the first content element is updated, obtain the attribute information of the updated first content element; Based on the updated attribute information of the first content element, determine the seventh display size parameter of the updated first content element; Based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter, a ninth display size parameter is determined. The eighth display size parameter is the display size parameter of the content element in the document that is adjacent to the updated first content element. Based on the ninth display size parameter, the updated first content element is displayed.

2. The method according to claim 1, characterized in that, The first content element includes multiple child elements; determining the first display size parameter of the first content element based on the attribute information includes: Based on the attribute information of each child element, determine the display size parameters of the corresponding child element; The first display size parameter is determined based on the maximum display size parameter among the display size parameters of the plurality of sub-elements.

3. The method according to claim 2, characterized in that, Determining the first display size parameter based on the maximum display size parameter among the display size parameters of the plurality of sub-elements includes: The first display size parameter is determined based on the maximum display size parameter and the first smoothing parameter, wherein the first smoothing parameter is determined based on the difference between the display size parameters of any two sub-elements among the plurality of sub-elements.

4. The method according to claim 3, characterized in that, Determining the first display size parameter based on the maximum display size parameter and the first smoothing parameter includes: Based on the maximum display size parameter and the first smoothing parameter, the second display size parameter is determined; The first display size parameter is determined based on the second display size parameter and the maximum display size parameter of the second content element, and the second content element is the content element in the document that is adjacent to the first content element.

5. The method according to claim 4, characterized in that, Determining the first display size parameter based on the second display size parameter and the maximum display size parameter of the second content element includes: Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document; The first display size parameter is determined based on the third display size parameter and the maximum display size parameter of the second content element.

6. The method according to claim 4, characterized in that, Determining the first display size parameter based on the second display size parameter and the maximum display size parameter of the second content element includes: Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document; Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined; Based on the fourth display size parameter and the first value, a fifth display size parameter is determined, wherein the first value is determined based on the fourth display size parameter corresponding to the second content element; The first display size parameter is determined based on the fifth display size parameter and the maximum display size parameter of the second content element.

7. The method according to claim 4, characterized in that, Determining the first display size parameter based on the second display size parameter and the maximum display size parameter of the second content element includes: Based on the second display size parameter and the first layout information, a third display size parameter is determined, wherein the first layout information characterizes the layout structure of the content elements in the document; Based on the third display size parameter and the maximum display size parameter of the second content element, a fourth display size parameter is determined; Based on the fourth display size parameter and the third content element's display size parameter, a sixth display size parameter is determined, wherein the third content element is a specific type of content element in the document; The first display size parameter is determined based on the sixth display size parameter and the maximum display size parameter of the second content element.

8. The method according to claim 1, characterized in that, The determination of the ninth display size parameter based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter includes: The difference between the seventh display size parameter and the eighth display size parameter is calculated to obtain the second value; The ninth display size parameter is determined based on the seventh display size parameter, the eighth display size parameter, the second value, and the second smoothing parameter.

9. The method according to claim 1, characterized in that, The step of displaying the updated first content element based on the ninth display size parameter includes: Based on the ninth display size parameter and the updated display size parameters of the sub-elements in the first content element, the tenth display size parameter is determined; Based on the tenth display size parameter and the display screen's attribute information, the eleventh display size parameter is determined; Based on the tenth display size parameter and the eleventh display size parameter, the updated first content element is displayed.

10. The method according to claim 9, characterized in that, The step of displaying the updated first content element based on the tenth display size parameter and the eleventh display size parameter includes: If the difference between the tenth display size parameter and the eleventh display size parameter is less than a first threshold, the updated first content element is displayed based on the tenth display size parameter; or, If the difference between the tenth display size parameter and the eleventh display size parameter is greater than or equal to the first threshold, the tenth display size parameter is adjusted, and the updated first content element is displayed based on the adjusted tenth display size parameter; wherein the difference between the adjusted tenth display size parameter and the eleventh display size parameter is less than or equal to the first threshold.

11. A document processing apparatus, characterized in that, The device includes: The retrieval module is used to retrieve the attribute information of the first content element in the document; The determining module is configured to determine a first display size parameter of the first content element based on the attribute information, wherein the first display size parameter includes at least one of row height and column width; The display module is used to display the first content element based on the first display size parameter; The acquisition module is also used for: If the first content element is updated, obtain the attribute information of the updated first content element; The determining module is further configured to determine the seventh display size parameter of the updated first content element based on the updated attribute information of the first content element; Based on the seventh display size parameter, the eighth display size parameter, and the second smoothing parameter, a ninth display size parameter is determined. The eighth display size parameter is the display size parameter of the content element in the document that is adjacent to the updated first content element. The display module is also used to display the updated first content element based on the ninth display size parameter.

12. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of document processing as described in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Table processing method and device, electronic equipment and computer readable storage medium

    CN114218902A