Document processing method, document processing device and electronic equipment
By obtaining the attribute information of content elements in the document and dynamically adjusting the row height and column width, the problem of insufficient adjustment of table row height in the prior art is solved, and the display effect and user experience of the document are improved.
Patent Information
- Application Number
- CN202411715941.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-27
AI Technical Summary
The existing row height adjustment algorithm cannot effectively adjust the row height of the table during document editing, especially when inserting large-size pictures or complex charts, resulting in incomplete display of the table content or inconsistent text layout, which in turn affects the display effect of the document.
By obtaining attribute information of the first content element in the document, it determines its first display size parameter, including at least one of row height and column width, and displays the content element based on these parameters. This method can dynamically adjust the row height and column width according to the attribute information of the content element to meet the display needs of various complex content.
It realizes the effective display of various complex content in the document, improving the display effect and user experience of the document, especially when processing tables containing large-sized pictures or complex charts.
Smart Images

Figure CN119578368A_ABST
Abstract
Description
Technical Field
[0001] The present 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 Art
[0002] As the functions of electronic devices such as mobile phones continue to improve, using electronic devices for office work has become more and more common. For example, users can use mobile phones to edit documents.
[0003] At present, during the document editing process, electronic devices can use a row height adjustment algorithm to adjust the row height of a table in a document, thereby avoiding incomplete display of table content due to inconsistent row heights of tables in the document. However, existing row height adjustment algorithms are mostly based on text content, ignoring the display requirements of complex content such as pictures and charts inserted in tables, which results in poor display of tables. For example, when a user uses a mobile phone to insert large-size pictures or complex charts into a table in a document, the existing row height adjustment algorithm cannot adjust the row height of the table according to the inserted pictures or charts, resulting in incomplete display of the pictures in the table or disordered text layout of the table, which results in poor display of the document. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a document processing method, a document processing device and an electronic device, which can improve the display effect of the document.
[0005] In a first aspect, an embodiment of the present application provides a document processing method, the method comprising:
[0006] Get the attribute information of the first content element in the document;
[0007] Determine a first display size parameter of the first content element based on the attribute information, where the first display size parameter includes at least one of a row height and a column width;
[0008] Based on the first display size parameter, a first content element is displayed.
[0009] In a second aspect, an embodiment of the present application provides a document processing device, the device comprising:
[0010] An acquisition module, used to acquire attribute information of the first content element in the document;
[0011] A determination module, 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 a row height and a column width;
[0012] The display module is configured to display a first content element based on a first display size parameter.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the document processing method described in the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the document processing method described in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the document processing method as described in the first aspect.
[0016] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the document processing method as described in the first aspect.
[0017] In the embodiment of the present application, the attribute information of the first content element in the document is obtained; based on the attribute information, the first display size parameter of the first content element is determined, and the first display size parameter includes at least one of the row height and the column width; based on the first display size parameter, the first content element is displayed. In this way, the electronic device determines at least one of the row height and the column width according to the attribute information of the first content element in the document, so that no matter what kind of content element the first content element is, the electronic device can adjust the row height and the column width of the first content element based on the attribute information of the first content element, so that when the electronic device displays the first content element based on at least one of the row height and the column width, it can meet the display requirements of various complex contents in the document, thereby improving the display effect of the document. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0019] Figure 2 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0020] Figure 3 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0021] Figure 4 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0022] Figure 5It is a flowchart of a document processing method provided by an embodiment of the present application;
[0023] Figure 6 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0024] Figure 7 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0025] Figure 8 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0026] Fig. 9 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0027] Fig.10 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0028] Fig.11 is a structural schematic diagram of a document processing device provided in an embodiment of the present application;
[0029] Fig.12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0030] Fig.13 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0033] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "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 (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".
[0034] The document processing method, document processing device, electronic device and medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0035] The document processing method, document processing device and electronic device provided in the embodiments of the present application can be applied to document editing scenarios.
[0036] In an application scenario, the document processing method provided in the embodiment of the present application can be applied to the scenario of editing tables in documents on a mobile phone.
[0037] At present, during the document editing process, the mobile phone can use a row height adjustment algorithm to adjust the row height of the table in the document, thereby avoiding incomplete display of the table content due to inconsistent row heights of the table in the document. However, the core parameter of the existing row height adjustment algorithm is the font height of the text in the table. When the row height is adjusted using the existing row height adjustment algorithm, the row height increases linearly with the increase of the font height of the text. Therefore, the existing row height adjustment algorithm is suitable for the display of single text content in the table. When large-size pictures or complex charts are inserted into the table, the existing row height adjustment algorithm cannot adjust the row height of the table according to the inserted pictures or charts, resulting in incomplete display of the pictures in the table or disordered text layout of the table, which in turn leads to poor display of the table.
[0038] To this end, the embodiments of the present application provide a document processing method, a document processing device, and an electronic device, which obtains the attribute information of the first content element in the document; determines the first display size parameter of the first content element based on the attribute information, and the first display size parameter includes at least one of the row height and the column width; and displays the first content element based on the first display size parameter. In this way, the electronic device determines at least one of the row height and the column width according to the attribute information of the first content element in the document, so that no matter what kind of content element the first content element is, the electronic device can adjust the row height and the column width of the first content element based on the attribute information of the first content element, so that when the electronic device displays the first content element based on at least one of the row height and the column width, it can meet the display requirements of various complex contents in the document, thereby improving the display effect of the document.
[0039] The document processing method provided in the embodiment of the present application may be executed by a document processing device. By way of example, the document processing device may be an electronic device, or a functional component or functional entity in the electronic device. The document processing method provided in the embodiment of the present application is described below by taking the execution subject as an electronic device as an example.
[0040] Figure 1 is a flowchart of a document processing method provided in an embodiment of the present application, such as Figure 1 As shown, the document processing method provided in the embodiment of the present application may include the following steps 101 to 103.
[0041] Step 101: The electronic device obtains attribute information of a first content element in a document.
[0042] In some embodiments of the present application, the above-mentioned document may include but is not limited to any of the following: word document, excel document, PDF document, TXT document, WPS document, e-book document and PPT document. The specific one can be determined according to actual needs and is not limited to this in some embodiments.
[0043] In some embodiments of the present application, the first content element includes but is not limited to at least one of the following: a row of content elements or a column of content elements in the document. The specific content can be determined according to actual needs and is not limited in some embodiments.
[0044] It should be noted that, when there is a table in the document, the first content element may be a row of cells or a column of cells in the table.
[0045] In some embodiments of the present application, the attribute information includes but is not limited to at least one of the following: the type of the first content element and the display parameter of the first content element. The specific information can be determined according to actual needs and is not limited in some embodiments.
[0046] Step 102: The electronic device determines a first display size parameter of the first content element based on the attribute information.
[0047] In some embodiments of the present application, the first display size parameter includes at least one of a row height and a column width.
[0048] In some embodiments of the present application, the first content element includes multiple sub-elements; Figure 1 ,like Figure 2 As shown, the above step 102 can be implemented by the following step 102a and the following step 102b:
[0049] Step 102a: The electronic device determines a display size parameter of the corresponding sub-element based on the attribute information of each sub-element.
[0050] In some embodiments of the present application, when the first content element is a row of cells in the table, the multiple sub-elements may be multiple cells in the row of cells, and the display size parameter of the corresponding sub-element may be the row height of the corresponding cell. Below, the document processing method provided by the present application will be described by taking the first content element being a row of cells in the table, the multiple sub-elements being multiple cells in the row of cells, and the display size parameter being the row height as an example.
[0051] In some embodiments of the present application, the attribute information of each cell may 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 may be text, the display parameters of the content element in the first cell may be the font size of the text, the font width of the text and the number of rows of text in the corresponding cell, and the first cell may be any cell in the first row of cells.
[0053] For another example, when the content element in the first cell is a picture, the type of the content element in the first cell may be a picture, and the display parameters of the content element in the first cell may be the width of the picture, the height of the picture, and the resolution of the picture.
[0054] In some embodiments of the present application, the electronic device may determine the row height adjustment coefficient of the first cell according to the type of the content element in the first cell, and then determine the row height of the first cell according to the row height adjustment coefficient and the display parameter, wherein one type corresponds to one row height adjustment coefficient.
[0055] For example, when the type of the content element in the first cell is text, the row height adjustment coefficient of the first cell is the row height adjustment coefficient of text. For another example, when the type of the content element in the first cell is a picture, the row height adjustment coefficient of the first cell is the row height adjustment coefficient of the picture.
[0056] In some embodiments of the present application, when the content element in the first cell is text, the electronic device may use the following formula to determine the row height of the first cell:
[0057]
[0058] Among them, H(E i,j ) represents the row height of the first cell, Ei,j represents the first cell, H(T 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 ) indicates the font width of the text, L(T i,j ) represents the number of text rows, k1 is the text row height adjustment coefficient, α1, β1 and γ1 represent the first adjustment parameter, the second adjustment parameter and the third adjustment parameter respectively, i represents that the first cell is located in the i-th row of the above table, and j represents that the first cell is located in the j-th column of the above table.
[0059] In some embodiments of the present application, when the content element in the first cell is a picture, the electronic device may use the following formula to determine the row height of the first cell:
[0060]
[0061] Among them, S w (P i,j ) and S h (P i,j ) represent the width and height of the image, S r (P i,j ) represents the resolution of the image, k2 is the row height adjustment coefficient of the image, δ and λ are the third smoothing parameter and the fourth smoothing parameter respectively.
[0062] In some embodiments of the present application, when the content element in the first cell is a content element other than text and a picture, the electronic device may use the following formula to determine the row height of the first cell:
[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 change of other content elements, the integral interval is [a,b], and k3 is the row height adjustment coefficient of other content elements.
[0065] Step 102b: The electronic device determines a first display size parameter based on a maximum display size parameter among display size parameters of a plurality of sub-elements.
[0066] In some embodiments of the present application, when the display parameter is a row height, the maximum display size parameter is a maximum row height among the row heights of the multiple cells.
[0067] In this way, the electronic device determines the display size parameter of the corresponding sub-element based on the attribute information of each sub-element; determines the first display size parameter based on the maximum display size parameter among the display size parameters of multiple sub-elements, and 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 the present application, Figure 2 ,like Figure 3 As shown, the above step 102b can be implemented by the following step 102b1:
[0069] Step 102b1: The electronic device determines a first display size parameter based on a maximum display size parameter and a first smoothing parameter.
[0070] In some embodiments of the present application, the first smoothing parameter is determined based on a difference between display size parameters of any two sub-elements among the multiple sub-elements.
[0071] In some embodiments of the present application, when the first content element is a row of the table, the first display parameter may be a row height of the row of the table:
[0072] In some embodiments of the present 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, Represents the above maximum row height, ΔH i,j represents the first smoothing parameter, H(E i,1 ),H(E i,2 ),…,H(E i,m ) represents the row height of the first cell in the i-th row of cells in the above table, the row height of the second cell, and so on. i Indicates that the first content element is the cell in the i-th row of the table.
[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, so that the row height and / or column width can meet the display requirements of different content elements in the first content element, and can visually maintain the smoothness of the transition of row and / or column changes, thereby improving the display effect of the document.
[0076] In some embodiments of the present application, Figure 3 ,like Figure 4 As shown, the above step 102b1 can also be implemented through the following steps A1 and A2:
[0077] Step A1: The electronic device determines a second display size parameter based on a maximum display size parameter and a first smoothing parameter.
[0078] It should be noted that the electronic device can use formula (4) to determine the second display size parameter, which will not be described in detail 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 the present application, the second content element is a content element adjacent to the first content element in the document.
[0081] In some embodiments of the present application, when the first content element is a row of cells in the table, the second content element is a cell in an 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 through the maximum display size parameter and the first smoothing parameter; and determines the first display size parameter based on the second display size parameter and the maximum display size parameter of the second content element, so that the overall row height and / or column width of the document can not only meet the display requirements of different content elements, but also visually maintain the smoothness and consistency of the transition between rows and / or columns, thereby improving the display effect of the document.
[0083] In some embodiments of the present application, Figure 4 ,like Figure 5 As shown, the electronic device can implement the above step A2 through the following steps B1 and B2:
[0084] Step B1: The electronic device determines a third display size parameter based on the second display size parameter and the first layout information.
[0085] In some embodiments of the present application, the first layout information represents the layout structure of the content elements in the document.
[0086] In some embodiments of the present application, when the content element is a table in the above document, the above first layout information may be structural information of the above table, including the arrangement order of cells in each row of the above table, the content density and the row spacing between adjacent rows in the above table.
[0087] In some embodiments of the present application, the electronic device may calculate the third display size parameter using the following formula:
[0088]
[0089] Among them, A1(R i ) represents the third display size parameter, ρ and ν are the first row height smoothing adjustment parameter and the second row height smoothing adjustment parameter, respectively, D(R i ) represents the difference in row spacing between the i-th row and the adjacent row in the table; κ is the overall layout adjustment coefficient, w j is the weight of the cell in row j in the above table, H max (R i ) represents the second display size parameter, H max (R j ) represents the second display size parameter corresponding to the cell in the j-th row in the above table, and ∈ represents the attenuation factor, so that the influence of adjacent rows in the above table gradually weakens 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 the present application, the electronic device may calculate the 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 upper and lower rows of cells adjacent to the first content element, f(x) is an adaptive smoothing function, and η1 is a 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; and determines the first display size parameter based on the third display size parameter and the maximum display size parameter of the second content element, 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 the present application, Figure 4 ,like Figure 6 As shown, the above step A2 can also be implemented through the following steps C1 to C4:
[0096] Step C1: The electronic device determines a third display size parameter based on the second display size parameter and the first layout information.
[0097] In some embodiments of the present application, the first layout information represents the layout structure of the content elements in the document.
[0098] Step C2: The electronic device determines a 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 through the above formula (6). To avoid repetition, this implementation will not be repeated here.
[0100] Step C3: The electronic device determines a fifth display size parameter based on the fourth display size parameter and the first value.
[0101] In some embodiments of the present application, the first value is determined based on a fourth display size parameter corresponding to the second content element.
[0102] In some embodiments of the present application, the fourth display size parameter corresponding to the second content element may be determined by the following process: determining the second display size parameter corresponding to the second content element based on the maximum display size parameter of the second content element and the first smoothing parameter; determining the third display size parameter corresponding to the second content element based on the second display size parameter corresponding to the second content element and the first layout information; determining the fourth display size parameter corresponding to the second content element based on the third display size parameter corresponding to the second content element and the maximum display size parameter of the fourth content element, wherein the fourth content element is a content element adjacent to the second content element in the document. For details, reference may be made to the determination process of the fourth display parameter corresponding to the first content parameter, and to avoid repetition, this embodiment will not be repeated here.
[0103] In some embodiments of the present application, the electronic device may calculate the 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, λ1 is the smoothing adjustment coefficient, ΔH i is the first value mentioned above, H ′ (R i ) represents the fourth display parameter, H ′ (Ri-1 ) and H ′ (R i+1 ) represents the fourth display parameter corresponding to the two upper rows of cells adjacent to the first content element, S(R 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 the present application, the electronic device may convert the third display parameter A1(R i ) is replaced by the fifth display parameter A2(R i ), and then use the above formula (6) to calculate the above first display parameter.
[0109] In this way, the electronic device determines the fifth display size parameter based on the fourth display size parameter and the first numerical value; determines the first display size parameter based on the fifth display size parameter and the maximum display size parameter of the second content element, thereby being able to further adjust and balance the changes in the display size parameters of the first content element. At the same time, when the first display size parameter is determined in combination with the maximum display size parameter of the second content element, a more natural transition of the display size parameters of the first content element can be achieved, thereby enhancing the overall aesthetics of the document.
[0110] In some embodiments of the present application, Figure 4 ,like Figure 7 As shown, the above step A2 can also be implemented through the following steps D1 to D4:
[0111] Step D1: The electronic device determines a third display size parameter based on the second display size parameter and the first layout information.
[0112] In some embodiments of the present application, the first layout information represents the layout structure of content elements in the document.
[0113] Step D2: The electronic device determines a 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 through the above formula (6). To avoid repetition, this implementation will not be repeated here.
[0115] Step D3: The electronic device determines a 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 the present application, the third content element is a specific type of content element in the document. For example, the third content element may be at least one item in a cross-row picture or an embedded chart in the table.
[0117] In some embodiments of the present application, when the third content element is an embedded chart, the electronic device may 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, R s (G embed ) represents the resolution of the embedded chart, k5 is the row height adjustment coefficient, and θ1 and ψ represent the smoothing adjustment parameters.
[0120] In some embodiments of the present application, when the third content element is a cross-row picture, the electronic device may calculate the display size parameter of the cross-row picture using the following formula:
[0121]
[0122] Among them, H(P cross ) represents the display size parameter of the cross-row image, S W (P cross ) and S H (P cross ) represent the width and height of the cross-row image, R S (P cross ) indicates the resolution of the cross-row image.
[0123] In some embodiments of the present application, the electronic device may calculate the 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 ) represents 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 the present application, the electronic device may convert the third display parameter A1(R i ) is replaced by the sixth display parameter A3(R i ), and then use the above formula (6) to calculate the above first display parameter.
[0128] It should be noted that the method for determining the column width of a column of cells in the above table is similar to the method for determining the row height of a row of cells in the above table. To avoid repetition, this embodiment will not be described in detail 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, so that when there is a specific type of content element in the document, the electronic device can keep the layout and display parameter size of the specific type of content element consistent with that of other content elements in the overall structure of the document, thereby meeting the needs of different types of content elements and ensuring that the specific type of content element is displayed completely and clearly in the document without being cropped or reduced, while maintaining a smooth transition of the display parameters of the first content element and the adjacent content elements and the consistency of the overall layout of the document, thereby improving the display effect of the document and the readability of the content.
[0130] Step 103: The electronic device displays a first content element based on a first display size parameter.
[0131] In some embodiments of the present application, when the first content element is a row of cells in the table and the first display size parameter is a row height, the electronic device displays the row of cells based on the first display size parameter.
[0132] In some embodiments of the present application, when the first content element is a column of cells in the table and the first display size parameter is a 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 the embodiment of the present application, the attribute information of the first content element in the document is obtained; based on the attribute information, the first display size parameter of the first content element is determined, and the first display size parameter includes at least one of the row height and the column width; based on the first display size parameter, the first content element is displayed. In this way, the electronic device determines at least one of the row height and the column width according to the attribute information of the first content element in the document, so that no matter what kind of content element the first content element is, the electronic device can adjust the row height and the column width of the first content element based on the attribute information of the first content element, so that when the electronic device displays the first content element based on at least one of the row height and the column width, it can meet the display requirements of various complex contents in the document, thereby improving the display effect of the document.
[0134] In some embodiments of the present application, after the above step 103, the document processing method provided by the present application may further include the following steps 104 to 107:
[0135] Step 104: When the first content element is updated, the electronic device obtains attribute information of the updated first content element.
[0136] In some embodiments of the present application, the electronic device may, when the first content element is updated, obtain attribute information of each sub-element in the updated first content element.
[0137] In some embodiments of the present application, when the first content element is a row of cells in the table, the electronic device can obtain attribute information of each cell in the updated first content element, including the type of content element in the corresponding cell and display parameters.
[0138] For example, in the case where 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 another example, in the case where the first content element is updated, the content element in the first cell is a picture, the type of the content element in the first cell is a picture, and the display parameter of the content element in the first cell is the area of the picture.
[0140] Step 105: The electronic device determines a seventh display size parameter of the updated first content element based on the updated attribute information of the first content element.
[0141] In some embodiments of the present application, when the first content element is a row of cells in the table, the electronic device updates the attribute information of the first cell in the first content element to determine the updated display size parameters of the first cell.
[0142] In some embodiments of the present application, the electronic device may use the following formula to calculate the updated display size parameter of the first cell:
[0143]
[0144] Among them, H new (E i,j ) represents the updated display size parameter of the first cell, k6 represents the row height adjustment coefficient of the text, k7 represents the row height adjustment coefficient of the picture, and k8 represents the row height adjustment coefficient of other content elements except text and pictures S(P i,j ) represents the area of the image, f(O i,j ) is a characteristic function of other content elements.
[0145] In some embodiments of the present application, the electronic device determines the updated display size parameters of each sub-element in the updated first content element through formula (11), and then determines the updated maximum display size parameters therefrom, 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 a 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 the present application, the eighth display size parameter is a display size parameter of a 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 the calculation process of the seventh display size parameter, and to avoid repetition, this embodiment will not be described again.
[0149] In some embodiments of the present application, the above step 106 may be implemented by the following step 106a and the following step 106b:
[0150] Step 106a: The electronic device calculates a difference between the seventh display size parameter and the eighth display size parameter to obtain a second value.
[0151] In some embodiments of the present application, the eighth display size parameter may be an updated row height of a next row of cells adjacent to the first content element.
[0152] In some embodiments of the present 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 represents the second value mentioned above, H new (R i ) represents the seventh display size parameter, H new (R i+1 ) represents the eighth display size parameter mentioned above.
[0155] Step 106b: The electronic device determines a 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 the present application, the electronic device may calculate the ninth display size parameter using the following formula:
[0157]
[0158] Among them, A4(R i ) represents the ninth display parameter, and λ2 is the smoothing adjustment coefficient.
[0159] In this way, the electronic device obtains the second value through the difference between the seventh display size parameter and the eighth display size parameter; and 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, 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 elements and maintain the beauty and coordination of the overall 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 the present application, the above step 107 may be implemented by the following steps 107a to 107c:
[0162] Step 107a: The electronic device determines a tenth display size parameter based on the ninth display size parameter and the updated display size parameter of the sub-element in the first content element.
[0163] In some embodiments of the present application, the electronic device may determine the tenth display size parameter according to the seventh display parameter determined by the updated display size parameter of the sub-element in the first content element and the ninth display size parameter.
[0164] In some embodiments of the present application, the electronic device may calculate the tenth display parameter using the following formula:
[0165]
[0166] In some embodiments of the present application, H final (R i ) represents the tenth display size parameter, H ′ max (R i ) represents the seventh parameter mentioned above.
[0167] Step 107b: The electronic device determines an eleventh display size parameter based on the tenth display size parameter and attribute information of the display screen.
[0168] In some embodiments of the present application, the attribute information of the display screen may include at least one of the following: resolution of the display screen, screen size of the display screen, and display ratio of the display screen. The specific information may be determined according to actual needs and is not limited in some embodiments.
[0169] In some embodiments of the present application, the electronic device may calculate the eleventh display size parameter using the following formula:
[0170]
[0171] Among them, H display (R i ,R s ,D s ,S r ) represents the eleventh display size parameter, R s Indicates the resolution of the above display, D s Indicates the screen size of the above display, S r Indicates the display ratio of the above display.
[0172] Step 107c: The electronic device displays the updated first content element based on the tenth display size parameter and the eleventh display size parameter.
[0173] In some embodiments of the present application, the above step 107c may be implemented by the following step 107c1 or the following step 107c2:
[0174] Step 107c1: When the difference between the tenth display size parameter and the eleventh display size parameter is less than a first threshold, the electronic device displays the updated first content element based on the tenth display size parameter.
[0175] In some embodiments of the present 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 Represents the difference between the tenth display size parameter and the eleventh display size parameter.
[0178] In some embodiments of the present application, if the difference between the tenth display size parameter and the eleventh display size parameter satisfies the following formula, the updated first content element is displayed based on the tenth display size parameter.
[0179] |ΔH final |<ε; (17)
[0180] Here, ε represents the first threshold.
[0181] In some embodiments of the present application, when the first content element is a row of cells in the table and the tenth display size parameter is the row height, the electronic device may display the updated row of cells based on the ten display size parameters.
[0182] In some embodiments of the present 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 may display the updated column of cells based on the ten display size parameters.
[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] The difference between the adjusted tenth display size parameter and the eleventh display size parameter is smaller than the first threshold.
[0185] In some embodiments of the present 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 may 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, and then display the updated first content element based on the adjusted tenth display size parameter.
[0186] In this way, the electronic device displays the updated first content element based on the tenth display size parameter when the difference between the tenth display size parameter and the eleventh display size parameter is less than the first threshold; adjusts the tenth display size parameter when the difference between the tenth display size parameter and the eleventh display size parameter is greater than or equal to the first threshold, and displays the updated first content element based on the adjusted tenth display size parameter. The display size parameter of the first content element can be adjusted according to the attribute information of the display screen, so that the document can maintain a unified 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 display size parameters of the sub-elements in the updated first content element. When the first content element is updated, the electronic device can timely update the display size parameters of the first content element based on the ninth display size parameter and the display size parameters of the sub-elements in the updated first content element, so that the updated display size parameters can meet the display requirements of the updated first content element, thereby improving the display effect of the document.
[0188] The following uses the first content element being a table in a document as an example to illustrate how an electronic device processes a document. Figure 8 As shown, the document processing method may include the following steps:
[0189] Step 21: The electronic device obtains a table in the document to be processed and pre-processes the table;
[0190] Step 22: The electronic device analyzes the table content row by row through a dynamic segmentation algorithm, identifies the content elements in each row and determines the row height requirement of each content element. The dynamic segmentation algorithm calculates the maximum row height requirement of each row according to the text font size and image size of each content element.
[0191] Step 23: The electronic device constructs a first-layer adaptive adjustment model, receives the row height requirement generated by the dynamic segmentation algorithm, and generates a preliminary adaptive row height adjustment plan 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 plan of the content.
[0192] Step 24: The electronic device optimizes the adaptive row height adjustment solution generated by the first-layer adaptive adjustment model, evaluates the overall visual aesthetics and coordination of the table through a row height smoothing algorithm, and makes a smooth transition between row heights of the table.
[0193] Example, combined Fig. 9 As shown, the process of generating an adaptive row height adjustment solution by the first-layer adaptive adjustment model may include the following steps:
[0194] Step 301: The electronic device receives a row height requirement generated by a dynamic segmentation algorithm;
[0195] Step 302: The electronic device executes step 303 based on the overall structure of the table.
[0196] Step 303: The electronic device calculates a preliminary row height adjustment value for each row.
[0197] Step 304: The electronic device dynamically adjusts the height of each row according to the row height requirement;
[0198] Step 305: The electronic device uses a row height smoothing algorithm to optimize row height transition.
[0199] Step 306: The electronic device generates a preliminary row height adjustment plan.
[0200] For example, when the electronic device uses the preliminary row height adjustment scheme to adjust the row height, it can generate corresponding preliminary row height values according to different row height requirements. Fig. 9 As shown, row height requirement 1 can be used to generate preliminary row height value 1, row height requirement 2 can be used to generate preliminary row height value 2, and row height requirement 3 can be used to generate preliminary 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 pictures and embedded charts.
[0202] Example, combined Fig.10 As shown, the second-layer adaptive adjustment model for the row height of cross-row images and embedded charts may include the following steps:
[0203] Step 401: The electronic device receives a preliminary row height adjustment plan.
[0204] Step 402: The electronic device identifies the cross-row images and embedded charts in the table.
[0205] Step 403: The electronic device calculates the required row height of the cross-row image and the required row height of the embedded chart.
[0206] Step 404: The electronic device meets the row height requirements for cross-row images and embedded charts.
[0207] Step 405: The electronic device generates a final adaptive row height adjustment solution.
[0208] For example, in combination Fig.10 As shown, the electronic device can adopt a final adaptive row height adjustment solution to adjust the row height according to the row height requirements of the cross-row images and the row height requirements of the embedded charts, and generate a final row height adjustment value.
[0209] Step 26: When the content of the table changes dynamically, the electronic device updates the adaptive row height adjustment scheme in real time, and the adaptive adjustment model dynamically captures the change 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 maintains a consistent display effect on different display terminals.
[0211] In this implementation, step 21 includes the following sub-steps:
[0212] Step 211: The electronic device obtains table data in the document to be processed. The table data M table is a cell containing multiple cells C i,j The matrix:
[0213] M table ={C i,j |i=1,2,…,n; j=1,2,…,m}; (18)
[0214] Among them, 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 The cell at row i and column j. The table data includes text, pictures and other multi-format contents.
[0215] Step 212: The electronic device pre-processes the table data.
[0216] Step 213: The electronic device identifies row R in the table i and column L i , and determine each cell C i,j The content elements in the , content elements are distinguished by the following piecewise functions:
[0217]
[0218] Among them, E i,j Represents cell C i,j The content element in T i,j For text elements, P i,j is the picture element, O i,j For other content elements.
[0219] For example, the electronic device may parse the format and structure information of the document, and identify the format attributes of each content element, including the font size F of the text. s (T i,j ) and the image size S(P i,j ), and record each cell Ci,j The content type in is represented by a classification function:
[0220]
[0221] Among them, Text represents cell C i,j The content type is text, and Image represents cell C i,j The content type in the cell is picture, and Other indicates that the cell C i,j The content type in is other than text and image.
[0222] In this implementation, step 22 includes the following sub-steps:
[0223] Step 221: The electronic device uses a dynamic segmentation algorithm to segment each row R in the table. i Analyze line by line, identifying each line R during the analysis process i Content element E i,j , content element E i,j is the cell C in row i and column j i,j Content elements in ;
[0224] Step 222: The electronic device determines the required row height of each content element, and calculates the required row height (i.e., the row height H of the first cell) according to different content element types in the table. i,j )):
[0225] When the content element is text T i,j When the row height requirement H(E i,j ) can be calculated by combining multiple text feature functions, and can be specifically calculated by the above formula (1).
[0226] When the content element is a picture P i,j When the row height requirement H(E i,j ) is calculated based on the multi-dimensional attributes of the image and a nonlinear function is used to represent the display requirements of the image, which can be specifically calculated using the above formula (2).
[0227] When the content element is other content O i,j When the row height requirement H(E i,j ) is segmented according to the unique attributes of the content, which can be calculated using the above formula (3).
[0228] Step 223, the electronic device is in each row R i By comparing the line height requirements H(E 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 line height so that the height of each line matches the content requirements.
[0230] In this implementation, 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 of each row. max (R i ), combined with the overall structure G of the table, the overall structure includes the order of each row, the density of content and the spacing between rows;
[0232] Step 232: Based on the row height requirement H max (R i ) and the overall layout structure G of the table, calculate the initial adaptive row height adjustment value A1 (R i ) (i.e. the third display size parameter calculated by formula (5)).
[0233] Step 233: According to the preliminary adaptive row height adjustment value A1 (R i ) to dynamically adjust the height of each row so that the row height changes meet the layout requirements of the overall table and update the actual row height of each row. (That is, the first display parameter displayed by the above formula (6))
[0234] In this implementation, step 24 includes the following sub-steps:
[0235] Step 241: The electronic device performs a preliminary adaptive row height adjustment scheme A1 (R i ) is optimized, and a row height smoothing algorithm is applied to evaluate the overall visual aesthetics and coordination of the table. During the optimization process, the changes in the row heights of adjacent rows are smoothed;
[0236] Step 242: The electronic device evaluates and adjusts the height of each row by constructing a row height smoothing function, and calculates the smoothed row height S(R i ) is adjusted based on the row height difference ΔH between adjacent rows i Perform a smooth transition to obtain the optimized row height adjustment solution A2 (R i ) (ie the fifth display parameter mentioned above).
[0237] For example, the electronic device uses the above formula 7 to calculate the optimized row height adjustment solution A2 (R i ).
[0238] Step 243, the electronic device adjusts the row height scheme A2 (R i ) is applied to each row of a table to provide a smooth transition between row heights.
[0239] For example, the electronic device may adjust the initial adaptive row height value A1(R i ) is replaced with the above optimized row height adjustment solution A2 (R i ), and then use the above formula (6) to calculate the actual row height of each row to achieve a smooth transition between row heights.
[0240] In this implementation, step 25 includes the following sub-steps:
[0241] Step 251: The electronic device constructs a second-layer adaptive adjustment model. The second-layer adaptive adjustment model is based on the first-layer adaptive adjustment scheme A2 (R i ) is optimized for images that span multiple rows. cross and the embedded graph G embed In the case of , make the row height of the content consistent with the rest of the table;
[0242] Step 252: For the cross-row picture P cross , calculate the required row height H(P cross ) (i.e., the display size parameter of the above cross-row image), for the embedded chart G embed , calculate the required row height H(G embed ) and adjust based on the multidimensional properties of the chart:
[0243] For example, the electronic device may use the above formula (8) to calculate the embedded graph G embed Required row height H(G embed ), the electronic moment can use the above formula (9) to calculate the cross-row image P cross Required row height H(P cross ).
[0244] Step 253: Set the row height requirement H(P cross ) and H(G embed ) and other content line heights to update the final line height adjustment plan A3(R i ) (i.e. the sixth display size parameter mentioned above), and use the final optimized adaptive row height adjustment solution A3 (R i ) adjusts the actual row height of each row.
[0245] For example, the electronic device may use the above formula (10) to calculate the final optimized adaptive row height adjustment solution A3 (R i ).
[0246] In this implementation, step 26 includes the following sub-steps:
[0247] Step 261: When the table content changes dynamically, the electronic device monitors the state change of each cell in the table in real time. The dynamic change of the table content includes the addition, deletion or modification of content elements, and records and updates the content type E of each cell. i,j and its high demand;
[0248] Step 262: The electronic device recalculates the required row height of each cell based on the dynamically changing table content, and uses the updated required row height 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 may use the above formula (11) to calculate the updated row height requirement H new (E i,j ).
[0250] Step 263: When the content change in the table affects the 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) to keep the overall row height of the table coordinated after the content changes.
[0251] For example, the electronic device may use the above formula (13) to calculate the final adaptive row height adjustment solution 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 requirement and the row height smoothing solution, and outputs a final adaptive row height adjustment solution, so that the table row height remains synchronized with the content in any case of content changes.
[0253] In this implementation, step 27 includes the following sub-steps:
[0254] Step 271: After all row height adjustments are completed, the electronic device outputs the final adaptive row height adjustment solution A4 (R i ) to generate the optimized table structure S final , the optimized table structure S final The final row height H of each row final (R i ) (i.e. the tenth display parameter above), the table structure is based on the final row height H of each row final (R i ) and the content characteristics of each cell are comprehensively displayed.
[0255] For example, the electronic device may use the above formula (14) to calculate the final row height H final (R i ).
[0256] Step 272: The electronic device displays the evaluation table at different resolutions R on different display terminals. s , screen size D s And display ratio S r The following display effect enables the table to maintain a consistent layout and display effect on various terminals;
[0257] Step 273: The electronic device adaptively adjusts the small line height deviation on the display terminal according to the evaluation result, and adjusts the line height deviation ΔH on different terminals. final Less than the preset value ε, ensuring that the table content is displayed consistently on all types of terminals;.
[0258] Exemplarily, the electronic device can use the above formula (15) to formula (17) to adaptively adjust the small line height deviation.
[0259] Step 274: the electronic device adaptively adjusts the column width according to the column width adjustment scheme, and 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 on any display terminal, and the row height and column width are synchronized with the content.
[0261] The document processing method provided by the present application is based on the precise row height adjustment of the multi-layer adaptive model, and by constructing the first and second layer adaptive adjustment models, it can accurately identify the complex content in the table, such as cross-row pictures and embedded charts, and automatically adjust the row height of each row. The first layer model generates a preliminary adjustment plan based on the dynamic segmentation algorithm to handle the row height requirements of ordinary text and picture elements, while the second layer model specifically optimizes the processing of cross-row content to ensure that the complex content is consistent with other table parts. Compared with the traditional fixed row height algorithm, the present invention adopts an optimization method based on weight coefficients and multi-dimensional characteristic analysis, so that the table content presents a higher layout aesthetics after adjustment, avoiding layout confusion caused by manual adjustment.
[0262] The document processing method provided by the present application can dynamically capture and adjust the row height in real time. In view of the fact that the table content on the mobile phone is frequently updated, the present invention designs a mechanism to capture the changes in the table content in real time and dynamically adjust the row height. By monitoring the content status of each cell, when the user adds, deletes or modifies the content, the system can immediately calculate based on the new row height requirements and complete the adjustment within the millisecond response time. A smooth adjustment function and attenuation factor are used in the row height calculation to make the height difference of adjacent rows transition naturally and avoid imbalance in the table structure caused by frequent modifications. This mechanism is particularly suitable for mobile office scenarios, which improves the fluency and operating experience of users when editing tables.
[0263] The document processing method provided by this application can achieve consistent display and adaptation optimization across devices. In particular, a multi-terminal adaptation algorithm based on consistency evaluation and row height optimization is designed for the differences in resolution and screen ratio between mobile phones and different terminal devices. By introducing the display terminal adaptation formula, the row height of the table is dynamically corrected to ensure that the display effect of the same table on different devices is consistent. At different resolutions, the algorithm of the present invention can automatically scale and adjust the height of content elements so that the table can maintain a unified visual effect regardless of whether it is on a mobile phone, tablet or high-resolution display. Compared with traditional row height adjustment technology, the present invention significantly improves the cross-device usage experience and solves the problems of table misalignment and distortion caused by terminal display differences.
[0264] It should be noted that the specific implementation process of the document processing method in the above steps can refer to the relevant description of the above embodiment. To avoid repetition, this embodiment will not be repeated here.
[0265] It should be noted that the above-mentioned method embodiments, or various possible implementation methods in each method embodiment, can be executed separately, or any two or more can be executed in combination with each other. The specific implementation method can be determined according to actual usage requirements, and the embodiments of the present application do not impose any restrictions on this.
[0266] The document processing method provided in the embodiment of the present application can be executed by a document processing device. In the embodiment of the present application, the document processing device provided in the embodiment of the present application is described by taking the document processing method executed by the document processing device as an example.
[0267] Fig.11 1 is a schematic diagram of the structure of a document processing device 1100 provided in an embodiment of the present application. The document processing device 1100 includes: an acquisition module 1101, a determination module 1102 and a display module 1103.
[0268] Wherein, the acquisition module 1101 is used to acquire the attribute information of the first content element in the document;
[0269] A determination module 1102, configured to determine a first display size parameter of the first content element based on the attribute information, where the first display size parameter includes at least one of a row height and a column width;
[0270] The display module 1103 is configured to display the first content element based on the first display size parameter.
[0271] In some embodiments of the present application, the first content element includes multiple sub-elements; the determining module is specifically configured to:
[0272] Based on the attribute information of each sub-element, determine the display size parameters of the corresponding sub-element;
[0273] The first display size parameter is determined based on a maximum display size parameter among the display size parameters of the plurality of sub-elements.
[0274] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0275] The first display size parameter is determined based on the maximum display size parameter and a first smoothing parameter, wherein the first smoothing parameter is determined based on a difference between display size parameters of any two sub-elements among the plurality of sub-elements.
[0276] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0277] Determining a second display size parameter based on the maximum display size parameter and the first smoothing parameter;
[0278] The first display size parameter is determined based on the second display size parameter and a maximum display size parameter of a second content element, wherein the second content element is a content element adjacent to the first content element in the document.
[0279] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0280] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0281] The first display size parameter is determined based on the third display size parameter and a maximum display size parameter of the second content element.
[0282] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0283] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0284] determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element;
[0285] determining a fifth display size parameter based on the fourth display size parameter and a first value, wherein the first value is determined based on a 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 a maximum display size parameter of the second content element.
[0287] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0288] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0289] determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element;
[0290] determining a sixth display size parameter based on the fourth display size parameter and a display size parameter of a third content element, wherein the third content element is a content element of a specific type in the document;
[0291] The first display size parameter is determined based on the sixth display size parameter and a maximum display size parameter of the second content element.
[0292] In some embodiments of the present application, the acquisition module 1101 is further used to:
[0293] When the first content element is updated, acquiring updated attribute information of the first content element;
[0294] The determining module is further configured to determine an updated seventh display size parameter of the first content element based on the updated attribute information of the first content element;
[0295] determining a ninth display size parameter based on the seventh display size parameter, the eighth display size parameter and the second smoothing parameter, wherein the eighth display size parameter is a display size parameter of a content element adjacent to the updated first content element in the document;
[0296] The display module is further configured to display the updated first content element based on the ninth display size parameter.
[0297] In some embodiments of the present application, the determining module 1102 is specifically configured to:
[0298] Calculating a difference between the seventh display size parameter and the eighth display size parameter to obtain a 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 the present application, the display module 1103 is specifically used for:
[0301] determining a tenth display size parameter based on the ninth display size parameter and the updated display size parameter of the sub-element in the first content element;
[0302] Determining an eleventh display size parameter based on the tenth display size parameter and the attribute information of the display screen;
[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 the present application, the display module 1103 is specifically used for:
[0305] When a difference between the tenth display size parameter and the eleventh display size parameter is smaller than a first threshold, displaying the updated first content element based on the tenth display size parameter;
[0306] or,
[0307] 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 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 device provided in the embodiment of the present application obtains the attribute information of the first content element in the document; a determination module is used to determine the first display size parameter of the first content element based on the attribute information, and the first display size parameter includes at least one of the row height and the column width; and a display module is used to display the first content element based on the first display size parameter. In this way, the electronic device determines at least one of the row height and the column width according to the attribute information of the first content element in the document, so that no matter what kind of content element the first content element is, the electronic device can adjust the row height and column width of the first content element based on the attribute information of the first content element, so that when the electronic device displays the first content element based on at least one of the row height and the column width, it can meet the display requirements of various complex contents in the document, thereby improving the display effect of the document.
[0309] The document processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or a device other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device, an augmented reality / virtual reality device, a robot, a wearable device, a super mobile personal computer, a netbook or a personal digital assistant, etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0310] The document processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0311] The document processing device provided in the embodiment of the present application can implement each process implemented by each embodiment of the above-mentioned document processing method, and will not be described again here to avoid repetition.
[0312] Alternatively, if Fig.12 As shown, an embodiment of the present application also provides an electronic device 1200, including a processor 1201 and a memory 1202, wherein the memory 1202 stores programs or instructions that can be executed on the processor 1201, and when the program or instructions are executed by the processor 1201, the various steps of the above-mentioned document processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0313] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0314] Fig.13 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0315] The electronic device 1300 includes but is not limited to: a radio frequency unit 1301, a network module 1302, an audio output unit 1303, an input unit 1304, a sensor 1305, a display unit 1306, a user input unit 1307, an interface unit 1308, a memory 1309, and a processor 1310 and other components.
[0316] Those skilled in the art will appreciate that the electronic device 1300 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1310 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.13 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0317] The processor 1310 is used to obtain attribute information of a first content element in the document;
[0318] Determine, based on the attribute information, a first display size parameter of the first content element, where the first display size parameter includes at least one of a row height and a column width;
[0319] The display unit 1306 is configured to display the first content element based on the first display size parameter.
[0320] In some embodiments of the present application, the first content element includes multiple sub-elements; the processor 1310 is specifically configured to:
[0321] Based on the attribute information of each sub-element, determine the display size parameters of the corresponding sub-element;
[0322] The first display size parameter is determined based on a maximum display size parameter among the display size parameters of the plurality of sub-elements.
[0323] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0324] The first display size parameter is determined based on the maximum display size parameter and a first smoothing parameter, wherein the first smoothing parameter is determined based on a difference between display size parameters of any two sub-elements among the plurality of sub-elements.
[0325] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0326] Determining a second display size parameter based on the maximum display size parameter and the first smoothing parameter;
[0327] The first display size parameter is determined based on the second display size parameter and a maximum display size parameter of a second content element, wherein the second content element is a content element adjacent to the first content element in the document.
[0328] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0329] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0330] The first display size parameter is determined based on the third display size parameter and a maximum display size parameter of the second content element.
[0331] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0332] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0333] determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element;
[0334] determining a fifth display size parameter based on the fourth display size parameter and a first value, wherein the first value is determined based on a 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 a maximum display size parameter of the second content element.
[0336] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0337] determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document;
[0338] determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element;
[0339] determining a sixth display size parameter based on the fourth display size parameter and a display size parameter of a third content element, wherein the third content element is a content element of a specific type in the document;
[0340] The first display size parameter is determined based on the sixth display size parameter and a maximum display size parameter of the second content element.
[0341] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0342] When the first content element is updated, acquiring updated attribute information of the first content element;
[0343] The determining module is further configured to determine an updated seventh display size parameter of the first content element based on the updated attribute information of the first content element;
[0344] determining a ninth display size parameter based on the seventh display size parameter, the eighth display size parameter and the second smoothing parameter, wherein the eighth display size parameter is a display size parameter of a content element adjacent to the updated first content element in the document;
[0345] The display module is further configured to display the updated first content element based on the ninth display size parameter.
[0346] In some embodiments of the present application, the processor 1310 is specifically configured to:
[0347] Calculating a difference between the seventh display size parameter and the eighth display size parameter to obtain a 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 the present application, the display unit 1306 is specifically used to:
[0350] determining a tenth display size parameter based on the ninth display size parameter and the updated display size parameter of the sub-element in the first content element;
[0351] Determining an eleventh display size parameter based on the tenth display size parameter and the attribute information of the display screen;
[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 the present application, the display unit 1306 is specifically used to:
[0354] When a difference between the tenth display size parameter and the eleventh display size parameter is smaller than a first threshold, displaying the updated first content element based on the tenth display size parameter;
[0355] or,
[0356] 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 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 the column width according to the attribute information of the first content element in the document, so that no matter what kind of content element the first content element is, the electronic device can adjust the row height and the column width of the first content element based on the attribute information of the first content element, so that when the electronic device displays the first content element based on at least one of the row height and the column width, it can meet the display requirements of various complex contents in the document, thereby improving the display effect of the document.
[0358] In the electronic device provided by the present application, by acquiring 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 a row height and a column width; and displaying the first content element based on the first display size parameter.
[0359] It should be understood that in the embodiment of the present application, the input unit 1304 may include a graphics processor (Graphics Processing Unit, GPU) 13041 and a microphone 13042, and the graphics processor 13041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1306 may include a display panel 13061, and the display panel 13061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. 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 two parts: a touch detection device and a touch controller. Other input devices 13072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0360] The memory 1309 can be used to store software programs and various data. The memory 1309 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1309 may include a volatile memory or a non-volatile memory, or the memory 1309 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1309 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0361] The processor 1310 may include one or more processing units; optionally, the processor 1310 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1310.
[0362] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned document processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0363] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0364] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned document processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0365] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0366] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the document processing method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0367] It should be noted that, in this article, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0368] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0369] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A document processing method, characterized in that: The method comprises: Get the attribute information of the first content element in the document; Determine, based on the attribute information, a first display size parameter of the first content element, where the first display size parameter includes at least one of a row height and a column width; Based on the first display size parameter, the first content element is displayed.
2. The method according to claim 1, characterized in that: The first content element includes a plurality of sub-elements; and determining a first display size parameter of the first content element based on the attribute information includes: Based on the attribute information of each sub-element, determine the display size parameters of the corresponding sub-element; The first display size parameter is determined based on a 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 The 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 a first smoothing parameter, wherein the first smoothing parameter is determined based on a difference between display size parameters of any two sub-elements among the plurality of sub-elements.
4. The method according to claim 3, characterized in that The determining the first display size parameter based on the maximum display size parameter and the first smoothing parameter includes: Determining a second display size parameter based on the maximum display size parameter and the first smoothing parameter; The first display size parameter is determined based on the second display size parameter and a maximum display size parameter of a second content element, wherein the second content element is a content element adjacent to the first content element in the document.
5. The method according to claim 4, characterized in that The 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: determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document; The first display size parameter is determined based on the third display size parameter and a maximum display size parameter of the second content element.
6. The method according to claim 4, characterized in that The 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: determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document; determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element; determining a fifth display size parameter based on the fourth display size parameter and a first value, 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 a maximum display size parameter of the second content element.
7. The method according to claim 4, characterized in that The 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: determining a third display size parameter based on the second display size parameter and first layout information, wherein the first layout information represents a layout structure of content elements in the document; determining a fourth display size parameter based on the third display size parameter and a maximum display size parameter of the second content element; determining a sixth display size parameter based on the fourth display size parameter and a display size parameter of a third content element, wherein the third content element is a content element of a specific type in the document; The first display size parameter is determined based on the sixth display size parameter and a maximum display size parameter of the second content element.
8. The method according to claim 1, characterized in that: The method further comprises: When the first content element is updated, acquiring updated attribute information of the first content element; determining, based on the updated attribute information of the first content element, an updated seventh display size parameter of the first content element; determining a ninth display size parameter based on the seventh display size parameter, the eighth display size parameter and the second smoothing parameter, wherein the eighth display size parameter is a display size parameter of a content element adjacent to the updated first content element in the document; Based on the ninth display size parameter, the updated first content element is displayed.
9. The method according to claim 8, characterized in that The determining a ninth display size parameter based on the seventh display size parameter, the eighth display size parameter and the second smoothing parameter comprises: Calculating a difference between the seventh display size parameter and the eighth display size parameter to obtain a 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.
10. The method according to claim 8, characterized in that The displaying the updated first content element based on the ninth display size parameter includes: determining a tenth display size parameter based on the ninth display size parameter and the updated display size parameter of the sub-element in the first content element; Determining an eleventh display size parameter based on the tenth display size parameter and the attribute information of the display screen; Based on the tenth display size parameter and the eleventh display size parameter, the updated first content element is displayed.
11. The method according to claim 10, characterized in that The displaying the updated first content element based on the tenth display size parameter and the eleventh display size parameter includes: When a difference between the tenth display size parameter and the eleventh display size parameter is smaller than a first threshold, displaying the updated first content element based on the tenth display size parameter; or, 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 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.
12. A document processing device, characterized in that: The device comprises: An acquisition module, used to acquire attribute information of the first content element in the document; a determination module, 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 a row height and a column width; The display module is configured to display the first content element based on the first display size parameter.
13. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a program or an instruction that can be run on the processor, and when the program or the instruction is executed by the processor, the steps of document processing according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Processing method and system of electronic medical records
CN107578798A
Table management method, device and equipment and storage medium
CN111428455A
Picture document blind denoising system, method and device
CN111797838A
Table processing method and device, electronic equipment and computer readable storage medium
CN114218902A
Computer implemented method for segmenting a binarized document
US20220237932A1