Document content arrangement method and device, electronic equipment and storage medium
By using layout blocks as advanced elements in documents, the problem of complex and inflexible document content arrangement in the prior art is solved, free orchestration and efficient content expression are achieved, diversified layout and infinite nesting are supported, and user experience is improved.
Patent Information
- Application Number
- CN202510154438.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-07-04
AI Technical Summary
The prior art methods in the arrangement of document content are complex and not flexible enough, making it difficult to achieve user-friendly and free arrangement.
The layout block is used as the advanced layout element. By obtaining the target layout block and operation requests selected by the user, the layout block is added, deleted, size adjustment, dragging, embedding and color definition are performed to generate document content arrangements that meet user needs.
It realizes free arrangement of document content, improves user creative efficiency and content expression capabilities, supports infinite nesting and diversified layout of layout blocks, simplifies user operations, and improves orchestration efficiency and effect.
Smart Images

Figure CN120257946A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, particularly to the fields of natural language processing and knowledge base, etc., and specifically relates to a method, apparatus, electronic device, and storage medium for document content layout. Background Art
[0002] Currently, when performing document content layout, the implementation methods are usually relatively complex and not flexible and convenient enough. Summary of the Invention
[0003] The present disclosure provides a method, apparatus, electronic device, and storage medium for document content layout.
[0004] A method for document content layout includes:
[0005] For a target document to be laid out, obtain inserted layout blocks;
[0006] Determine a target layout block selected by a user from the layout blocks in the target document, and determine a layout block operation request issued by the user for the target layout block;
[0007] According to the target layout block, complete the current content layout process according to the layout block processing method corresponding to the layout block operation request.
[0008] A document content layout apparatus includes: an obtaining module, a determining module, and a processing module;
[0009] The obtaining module is configured to obtain inserted layout blocks for a target document to be laid out;
[0010] The determining module is configured to determine a target layout block selected by a user from the layout blocks in the target document, and determine a layout block operation request issued by the user for the target layout block;
[0011] The processing module is configured to complete the current content layout process according to the target layout block and according to the layout block processing method corresponding to the layout block operation request.
[0012] An electronic device includes:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method as described above.
[0016] A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method as described above.
[0017] A computer program product comprising a computer program / instructions which, when executed by a processor, implement the method as described above.
[0018] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0020] Figure 1 is a flowchart of an embodiment of the method for arranging document content according to the present disclosure;
[0021] Figure 2 is a schematic diagram of a certain document block and the corresponding layout tree according to the present disclosure;
[0022] Figure 3 is a first schematic diagram of the method for adding layout blocks according to the present disclosure;
[0023] Figure 4 is a second schematic diagram of the method for adding layout blocks according to the present disclosure;
[0024] Figure 5 is a third schematic diagram of the method for adding layout blocks according to the present disclosure;
[0025] Figure 6 is a first schematic diagram of the first layout tree update method according to the present disclosure;
[0026] Figure 7 is a second schematic diagram of the first layout tree update method according to the present disclosure;
[0027] Figure 8 is a third schematic diagram of the first layout tree update method according to the present disclosure;
[0028] Figure 9 is a fourth schematic diagram of the first layout tree update method according to the present disclosure;
[0029] Figure 10 is a fifth schematic diagram of the first layout tree update method according to the present disclosure;
[0030] Figure 11 is a schematic diagram of the method for adjusting the width of the target layout block according to the present disclosure;
[0031] Figure 12Schematic diagram of the height adjustment method for the target layout block described in the present disclosure;
[0032] Figure 13 Schematic diagram of the method for determining the target adsorption height described in the present disclosure;
[0033] Figure 14 First schematic diagram of the method for determining the target adsorption width described in the present disclosure;
[0034] Figure 15 Second schematic diagram of the method for determining the target adsorption width described in the present disclosure;
[0035] Figure 16 Third schematic diagram of the method for determining the target adsorption width described in the present disclosure;
[0036] Figure 17 First schematic diagram of the dragging method for the layout block described in the present disclosure;
[0037] Figure 18 Second schematic diagram of the dragging method for the layout block described in the present disclosure;
[0038] Figure 19 Schematic diagram of different typesetting methods described in the present disclosure;
[0039] Figure 20 Schematic diagram of the composition structure of Embodiment 2000 of the document content arrangement device described in the present disclosure;
[0040] Figure 21 Schematic block diagram showing an electronic device 2100 that can be used to implement the embodiments of the present disclosure. Detailed implementation manners
[0041] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0042] In addition, it should be understood that the term "and / or" herein is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.
[0043] Figure 1 Flowchart of the embodiment of the document content arrangement method described in the present disclosure. As Figure 1 shown, it includes the following specific implementation manners.
[0044] In step 101, for the target document to be arranged, obtain the inserted layout blocks.
[0045] In step 102, determine the target layout block selected by the user from the layout blocks in the target document, and determine the layout block operation request issued by the user for the target layout block.
[0046] In step 102, according to the target layout block, complete the current content arrangement process according to the layout block processing method corresponding to the layout block operation request.
[0047] Adopting the solution described in the above method embodiment, layout blocks can be used for document content arrangement. As a new type of advanced layout element and also a container - like element, the layout block is a brand - new element form in the industry's document - type products. For any target layout block in the document, the corresponding content arrangement process can be completed according to the layout block processing method corresponding to the layout block operation request, thus realizing the free arrangement of content, etc., and enabling the user to quickly build the desired effect, achieving the enhancement of content expression and the improvement of creation efficiency, etc.
[0048] In some embodiments of the present disclosure, in response to determining that the content arrangement process for the target document ends, the target document can be rendered and generated according to the latest obtained content arrangement result.
[0049] Determining that the content arrangement process for the target document ends may mean obtaining the user's arrangement completion instruction, etc. Then, the target document can be rendered and generated according to the latest obtained content arrangement result, thus facilitating the viewing and use of the target document, etc.
[0050] In some embodiments of the present disclosure, the content arrangement result may include: each document block (block) and the layout tree corresponding to each document block respectively. Each document block includes at least two layout blocks. The first layout block in each document block is respectively inserted into the document block through the insertion menu. The layout tree is generated according to the positional relationship between the layout blocks in the corresponding document block.
[0051] In some embodiments of the present disclosure, the layout tree may meet the following requirements: It includes at least two levels, each level being a row node level or a column node level respectively. Nodes in the row node level are all row nodes, and nodes in the column node level are all column nodes; the next level of any row node level is a column node level, and the next level of any column node level is a row node level, and the first level is a row node level; the first level includes a root node, and each of the other levels except the first level includes at least two nodes; each leaf node corresponds to a layout block in the document block corresponding to the layout tree. Nodes other than leaf nodes are all parent nodes, and each parent node includes at least two child nodes; in addition, the types of layout blocks include: row layout blocks and column layout blocks. Nodes corresponding to row layout blocks are row nodes, and nodes corresponding to column layout blocks are column nodes.
[0052] Figure 2 It is a schematic diagram of a certain document block and the corresponding layout tree according to the present disclosure. As Figure 2 shown, the document block includes a total of 5 layout blocks, namely layout block A, layout block B, layout block C, layout block D, and layout block E. The corresponding layout tree includes a total of 4 levels, which are arranged alternately in a row node level, a column node level, a row node level, and a column node level. The 5 layout blocks as a whole can be regarded as a row, corresponding to the root node in the first level of the layout tree. The root node must be a row node. The row includes 3 columns, corresponding to node A, node E, and node X respectively. Node A, node E, and node X are all column nodes. Among them, node A corresponds to layout block A, node E corresponds to layout block E, and node X corresponds to the column composed of node B, node C, and node D. In addition, the column composed of node E, node C, and node D includes two rows, corresponding to node D and node X' respectively. Node D and node X' are both row nodes. Among them, node D corresponds to layout block D, and node X' corresponds to the row composed of layout block B and layout block C. Node B and node C are both column nodes. Among them, node B corresponds to layout block B, and node C corresponds to layout block C.
[0053] It can be seen that Figure 2 the layout tree shown includes a total of 5 leaf nodes, namely node A, node B, node C, node D, and node E. Each leaf node corresponds to a layout block in the document block. Except for the leaf nodes, other nodes in the layout tree are all parent nodes, and each parent node includes at least two child nodes. That is to say, for each node in the layout tree, either it has no child nodes or it includes at least 2 child nodes.
[0054] In addition, the row nodes have the characteristic of minimum height. The actual display height of the element is related to the size of the user's device. When the window of the user's device is narrow, less content is displayed in one row, so the height will be stretched. When the window of the user's device is wide, more content is displayed in one row, and the relative height will be smaller. In the solution described in the present disclosure, the user is supported to adjust the height of the layout block, but generally it cannot be less than the minimum height. The column nodes have the characteristic of width. In the solution described in the present disclosure, the user is supported to adjust the width of the layout block.
[0055] In the process of content layout of the target document, for the existing layout blocks in the target document, the target layout block selected by the user from the existing layout blocks and the layout block operation request issued by the user for the target layout block can be determined. Then, according to the target layout block, the content layout process can be completed according to the layout block processing method corresponding to the layout block operation request.
[0056] The layout block operation request may include one or any combination of the following: layout block addition request, layout block deletion request, layout block size (height or width) adjustment request, layout block drag request, embedding request, color definition request, etc., which will be introduced separately below.
[0057] 1) Layout block addition request
[0058] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block addition request, a new layout block can be added above, below, to the left or to the right of the target layout block as the newly added layout block, and the first layout tree corresponding to the first document block where the target layout block is located can be updated according to the newly added layout block. For the sake of convenience of description, the document block where the target layout block is located is called the first document block, and the corresponding layout tree is called the first layout tree.
[0059] The solution described in the present disclosure supports at least three layout block addition methods, which will be introduced separately below.
[0060] Figure 3 This is the first schematic diagram of the layout block addition method described in the present disclosure. As Figure 3 shown, after the user issues a layout block addition request in a certain way, the mouse can be hovered above the target layout block. Correspondingly, dot prompts can be made at the upper left corner and upper right corner of the target layout block. If it is determined that the user moves the mouse into the dot at the upper left corner, a guiding line can be displayed on the left side of the target layout block. After the user clicks the guiding line, a layout block can be added on the left side of the target layout block. If it is determined that the user moves the mouse into the dot at the upper right corner, as Figure 3 shown, a guiding line (bold line segment) can be displayed on the right side of the target layout block. After the user clicks the guiding line, a layout block can be added on the right side of the target layout block.
[0061] Figure 4This is the second schematic diagram of the layout block addition method described in the present disclosure. As Figure 4 shown, after the user sends a layout block addition request in a certain way, the user can hover the mouse over the middle position between two layout blocks (the blank area between the two vertically arranged layout blocks shown in the figure). Correspondingly, these two layout blocks can be regarded as a whole and determined as the target layout block, and dot prompts can be made at the upper left corner and upper right corner of the target layout block. If it is determined that the user moves the mouse into the dot at the upper left corner, a guiding line can be displayed on the left side of the target layout block. After the user clicks on the guiding line, a layout block can be added to the left side of the target layout block. If it is determined that the user moves the mouse into the dot at the upper right corner, as Figure 4 shown, a guiding line (bold line segment) can be displayed on the right side of the target layout block. After the user clicks on the guiding line, a layout block can be added to the right side of the target layout block.
[0062] Figure 5 This is the third schematic diagram of the layout block addition method described in the present disclosure. As Figure 5 shown, the user can hover the mouse over the target layout block and click on a predetermined menu button (the specific position is not limited). Correspondingly, a toolbar can be displayed for the user so that the user can add layout blocks to the left side, right side, upper side, or lower side of the target layout block through the toolbar.
[0063] Which of the above specific methods to adopt can be determined according to actual needs, which is very flexible and convenient. Moreover, each implementation method is relatively simple, thus improving the user's layout block addition efficiency, etc.
[0064] In practical applications, for any document block, the first layout block therein can be inserted into the document block through a predetermined insertion menu, and subsequent layout block additions can adopt Figure 3 、 Figure 4 or Figure 5 shown methods.
[0065] After adding a layout block, it will cause the corresponding layout tree to change. Therefore, it is also necessary to update the first layout tree corresponding to the first document block where the target layout block is located according to the newly added layout block.
[0066] In some embodiments of the present disclosure, in response to determining that the newly added layout block and the target layout block are layout blocks of the same type, a first newly added node corresponding to the newly added layout block may be added at the level where the node to be processed is located, and the parent node of the node to be processed may be determined as the parent node of the first newly added node. The node to be processed is the node corresponding to the target layout block. In response to determining that the newly added layout block and the target layout block are layout blocks of different types, the node to be processed may be replaced with a second newly added node at the level where the node to be processed is located, and a third newly added node corresponding to the target layout block and a fourth newly added node corresponding to the newly added layout block may be newly added at the next level of the level where the second newly added node is located. The third newly added node and the fourth newly added node are determined as the child nodes of the second newly added node.
[0067] Figure 6 This is the first schematic diagram of the first layout tree update method described in the present disclosure. As Figure 6 shown, layout blocks A, B, and C are all column layout blocks. If a new column layout block D is added to the right of layout block C (the target layout block), then a node D corresponding to layout block D may be added at the level where the node C corresponding to layout block C is located, and the parent node of node C (i.e., the root node) may be determined as the parent node of node D.
[0068] Figure 7 This is the second schematic diagram of the first layout tree update method described in the present disclosure. As Figure 7 shown, layout blocks A, B, and C are all column layout blocks. If a new row layout block D is added below layout block C (the target layout block), then node C may be replaced with a newly added node such as node Y at the level where node C is located, and a node C corresponding to layout block C and a node D corresponding to layout block D may be newly added at the next level of the level where node Y is located. Both node C and node D are the child nodes of node Y.
[0069] It can be seen that after adding a layout block, according to whether the types of the newly added layout block and the target layout block are the same, corresponding update methods can be used to update the first layout tree respectively, thereby improving the accuracy of the update result, etc.
[0070] 2) Layout block deletion request
[0071] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block deletion request, the target layout block may be deleted, and the first layout tree corresponding to the first document block where the target layout block is located may be updated accordingly.
[0072] The solution described in the present disclosure supports the deletion of row layout blocks and column layout blocks, and also supports the deletion of a single layout block and the batch deletion of multiple layout blocks. Among them, the user can delete the layout block by clicking a predetermined menu button. Corresponding to the first layout tree, when adding a layout block, it can be added to a non-leaf node, but the deletion operation is only applicable to leaf nodes. In addition, the batch deletion operation can be regarded as executing the deletion operation of a single layout block multiple times.
[0073] After deleting a layout block, it will cause the corresponding layout tree to change. Therefore, it is also necessary to update the first layout tree corresponding to the first document block where the target layout block is located according to the deletion operation.
[0074] In some embodiments of the present disclosure, in response to determining that the parent node of the node to be processed includes at least 3 child nodes, where the at least 3 child nodes include the node to be processed and at least 2 sibling nodes other than the node to be processed, the node to be processed can be deleted from the first layout tree. The node to be processed is the node corresponding to the target layout block. In response to determining that the parent node of the node to be processed includes 2 child nodes, the 2 child nodes include the node to be processed and 1 sibling node other than the node to be processed, and it is determined that the sibling node is a leaf node, the sibling node can be used to replace the parent node of the node to be processed, and the node to be processed can be deleted. In response to determining that the parent node of the node to be processed includes 2 child nodes, the 2 child nodes include the node to be processed and 1 sibling node other than the node to be processed, and it is determined that the sibling node is a non-leaf node, all child nodes of the sibling node can be used to replace the parent node of the node to be processed, and the node to be processed and the sibling node can be deleted.
[0075] Figure 8 This is the third schematic diagram of the update method of the first layout tree described in the present disclosure. As Figure 8 shown, assuming that layout block C is deleted, the parent node (i.e., the root node) of its corresponding node C includes 3 child nodes, namely node A, node B, and node C. Then, node C can be directly deleted from the first layout tree.
[0076] Figure 9 This is the fourth schematic diagram of the update method of the first layout tree described in the present disclosure. As Figure 9 shown, assuming that layout block D is deleted, the parent node (node Y) of its corresponding node D includes 2 child nodes, namely node C and node D. Since node C is a leaf node, node C can be used to replace node Y, and node D can be deleted.
[0077] Figure 10 This is the fifth schematic diagram of the update method of the first layout tree described in the present disclosure. As Figure 10As shown, assume that layout block E is deleted. Its corresponding parent node (node Z) includes two child nodes, namely node W and node E. Node W is a non-leaf node. Then, all child nodes of node W (i.e., node C and node D) can be used to replace node Z, and node E and node W can be deleted.
[0078] It can be seen that after deleting the layout block, according to the number of sibling nodes of the node corresponding to the deleted layout block and whether the sibling nodes are leaf nodes, corresponding update methods can be adopted to update the first layout tree respectively, thereby improving the accuracy of the update result, etc.
[0079] 3) Layout block size adjustment request
[0080] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block size adjustment request, and in response to determining that the target layout block is a row layout block, the height of the target layout block can be adjusted to the target height required by the user. In response to determining that the target layout block is a column layout block, the width of the target layout block can be adjusted to the target width required by the user.
[0081] In practical applications, the user can adjust the height and width of the target layout block through guide lines.
[0082] Figure 11 It is a schematic diagram of the width adjustment method of the target layout block described in the present disclosure. As Figure 11 shown, after the user issues a layout block size adjustment request in a certain way, the mouse can be hovered over the middle area between the left and right layout blocks. Then, the two layout blocks can be regarded as a whole as the target layout block, and a horizontal guide line (bold line segment) can be displayed for the user. The user can adjust the width of each target layout block by performing a left-right drag operation on the horizontal guide line. Or, one of the two layout blocks (such as the left layout block) can be regarded as the target layout block, and the width of the target layout block can be adjusted. Correspondingly, the width of the non-target layout block on the right will also be adjusted accordingly.
[0083] Figure 12 It is a schematic diagram of the height adjustment method of the target layout block described in the present disclosure. As Figure 12 shown, after the user issues a layout block size adjustment request in a certain way, the mouse can be hovered over the middle area between the upper and lower layout blocks. Then, the two layout blocks can be regarded as a whole as the target layout block, and a vertical guide line can be displayed for the user. The user can adjust the height of each target layout block by performing an up-down drag operation on the vertical guide line. Or, one of the two layout blocks (such as the upper layout block) can be regarded as the target layout block, and the height of the target layout block can be adjusted. Correspondingly, the height of the non-target layout block below will also be adjusted accordingly.
[0084] Through the above processing, the width and height of the layout block can be adjusted arbitrarily, so as to meet the different page layout requirements of users, etc.
[0085] In some embodiments of the present disclosure, when adjusting the height of the target layout block to the target height required by the user, the vertical guide line corresponding to the target layout block may be displayed. In response to determining that there is no target adsorption height, for each vertical guide line dragging operation performed by the user, the height of the target layout block may be adjusted respectively according to a predetermined adjustment range. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block may be determined as the target height. In response to determining that there is at least one target adsorption height, for each vertical guide line dragging operation performed by the user, the following first processing may be performed respectively: In response to determining that the gap between the latest height of the target layout block and any target adsorption height is greater than the first threshold, the height of the target layout block is adjusted according to the predetermined adjustment range. In response to determining that the gap is less than or equal to the first threshold, the height of the target layout block is directly adjusted to the target adsorption height. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block is determined as the target height, otherwise the first processing is repeated.
[0086] In addition, in some embodiments of the present disclosure, the determination method of the target adsorption height may include: screening the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block. In response to screening out the adsorption nodes that meet the requirements, the height of the layout block corresponding to the adsorption node is determined as the target adsorption height.
[0087] Figure 13 It is a schematic diagram of the determination method of the target adsorption height described in the present disclosure. As Figure 13 shown, the nodes corresponding to the two columns are represented by node L and node L' respectively. Assuming that it is necessary to adjust the height of layout block A2, all non-right child nodes among all non-parent nodes outside its column can be selected, such as selecting nodes A4 and A5 as the nodes that may generate adsorption. Then, according to the positional relationship between each node that may generate adsorption and node A2, etc., the adsorption node, such as node A5, can be determined, and the height of layout block A5 corresponding to node A5 can be determined as the target adsorption height.
[0088] In this way, when the user adjusts the height of layout block A2, for each drag operation of the vertical guiding line performed by the user, if it is determined that there is no target adsorption height, the height of the target layout block can be directly adjusted according to a predetermined adjustment amplitude. If it is determined that there is a target adsorption height, then it can be determined whether the difference between the latest height of layout block A2 and the target adsorption height is greater than a first threshold. If so, the height of layout block A2 can be adjusted according to the predetermined adjustment amplitude. Otherwise, the height of layout block A2 can be directly adjusted to the target adsorption height, so as to achieve alignment adsorption with the target adsorption height. If an adjustment end instruction of the user is obtained at this time, the target adsorption height is the final target height. If the adjustment end instruction of the user is not obtained, the height of layout block A2 can continue to be adjusted.
[0089] The specific values of the predetermined adjustment amplitude and the first threshold can both be determined according to actual needs. For example, the predetermined adjustment amplitude can be 1 pixel, and the first threshold can be 5 pixels, etc.
[0090] As Figure 13 shown, in practical applications, considering aspects such as the aesthetics of the layout, the user is likely to have a need to adjust the height of layout block A2 to be the same as the height of layout block A5 corresponding to the adsorption node. Correspondingly, adopting the above processing method can simplify the user's operation, thereby improving the user's adjustment efficiency, reducing the error caused by manual adjustment by the user, and improving the accuracy of the adjustment result, etc.
[0091] The above is described by taking the existence of one target adsorption height as an example. The processing method for multiple target adsorption heights is similar, except that there may be multiple alignment adsorptions.
[0092] In addition, in some embodiments of the present disclosure, the method of adjusting the width of the target layout block to the target width required by the user may include: displaying the horizontal guiding line corresponding to the target layout block, in response to determining that there is no target adsorption width, for each drag operation of the horizontal guiding line performed by the user, respectively adjusting the width of the target layout block according to a predetermined adjustment amplitude, in response to obtaining an adjustment end instruction of the user, determining the latest width of the target layout block as the target width, in response to determining that there is at least one target adsorption width, for each drag operation of the horizontal guiding line performed by the user, respectively performing the following second processing: in response to determining that the difference between the latest width of the target layout block and any target adsorption width is greater than a second threshold, adjusting the width of the target layout block according to a predetermined adjustment amplitude, in response to determining that the difference is less than or equal to the second threshold, directly adjusting the width of the target layout block to the target adsorption width, in response to obtaining an adjustment end instruction of the user, determining the latest width of the target layout block as the target width, otherwise repeating the second processing.
[0093] In some embodiments of the present disclosure, the method for determining the target adsorption width may include: screening the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block; in response to screening out the adsorption nodes that meet the requirements, determining the width of the layout block corresponding to the adsorption node as the target adsorption width; or, obtaining the sum of the width of the target layout block and the widths of the layout blocks corresponding to each sibling node, where the sibling nodes are other nodes that belong to the same parent node as the node corresponding to the target layout block, and determining the quotient of the sum and M + 1 as the target adsorption width, where M represents the number of sibling nodes; or, obtaining the sum of the width of the target layout block and the width of the layout block adjacent to the right side of the target layout block, and determining the quotient of the sum and 2 as the target adsorption width.
[0094] Figure 14 This is the first schematic diagram of the method for determining the target adsorption width according to the present disclosure. As Figure 14 shown, the upper and lower document blocks are adjacent document blocks. In addition, nodes P, P', Q, Q', Q", etc. respectively represent different parent nodes. Assuming that it is necessary to adjust the width of layout block B4, non-right-side child nodes among all non-parent nodes outside its row can be selected, such as nodes A1, A2, B2, etc., as the nodes that may generate adsorption. Then, according to the positional relationship between each node that may generate adsorption and node B4, etc., the adsorption node, such as node A2, can be determined, and the width of node A2 can be determined as the target adsorption width.
[0095] In this way, when the user adjusts the width of layout block B4, each time the user performs a drag operation on the horizontal guide line, if it is determined that there is no target adsorption width, the width of the target layout block can be directly adjusted according to the predetermined adjustment amplitude; if it is determined that there is a target adsorption width, then it can be determined whether the gap between the latest width of layout block B4 and the target adsorption width is greater than the second threshold. If so, the width of layout block B4 can be adjusted according to the predetermined adjustment amplitude; otherwise, the width of layout block B4 can be directly adjusted to the target adsorption width, so as to achieve alignment adsorption with the target adsorption width. If the user's adjustment end instruction is obtained at this time, then the target adsorption width is the final target width; if the user's adjustment end instruction is not obtained, the width of layout block B4 can continue to be adjusted. The specific values of the predetermined adjustment amplitude and the second threshold can be determined according to actual needs.
[0096] Figure 15 This is the second schematic diagram of the method for determining the target adsorption width according to the present disclosure. As Figure 15As shown in the figure, assume that a certain document block includes 4 layout blocks, namely layout block A1, layout block A2, layout block A3, and layout block A4, and assume that the width of layout block A1 needs to be adjusted. Then, the sum of the widths of the 4 layout blocks can be obtained as the first reference width. After that, the first reference width can be divided by 4 to obtain the target adsorption width, as shown by the black dot in the figure. Among them, if the quotient obtained is an integer, the obtained quotient can be directly used as the target adsorption width; otherwise, the obtained quotient can be rounded up or down to be used as the target adsorption width. Assume that the first reference width is 100, then the target adsorption width is 25.
[0097] Based on Figure 15 the target adsorption width shown, the width of the target layout block A1 can be adjusted to achieve percentage adsorption.
[0098] Figure 16 This is the third schematic diagram of the determination method of the target adsorption width described in the present disclosure. As Figure 16 shown in the figure, assume that a certain document block includes 4 layout blocks, namely layout block A1, layout block A2, layout block A3, and layout block A4, and assume that the width of layout block A1 needs to be adjusted. Then, the sum of the widths of layout block A1 and layout block A2 can be obtained as the second reference width. After that, the second reference width can be divided by 2 to obtain the target adsorption width, as shown by the black dot in the figure. Among them, if the quotient obtained is an integer, the obtained quotient can be directly used as the target adsorption width; otherwise, the obtained quotient can be rounded up or down to be used as the target adsorption width.
[0099] Based on Figure 16 the target adsorption width shown, the width of the target layout block A1 can be adjusted to achieve equal division adsorption.
[0100] In practical applications, considering aspects such as the aesthetics of the page layout, users are very likely to have a need to adjust the width of the target layout block to the target adsorption width. Correspondingly, adopting the above processing method can simplify the operation of users, thereby improving the adjustment efficiency of users, and can reduce the errors caused by manual adjustment of users, improving the accuracy of the adjustment results, etc.
[0101] When adjusting the width of the target layout block, in addition to adjusting the width of the target layout block itself, the widths of other related layout blocks also need to be adjusted correspondingly. For example, when increasing Figure 14 the width of layout block B4 shown in the figure, the width of layout block B5 needs to be adjusted correspondingly to ensure that the width of the row where layout block B4 and layout block B5 are located remains unchanged.
[0102] 4) Layout block drag request
[0103] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block drag request, the target layout block can be dragged to a position where it is placed horizontally or vertically with other layout blocks.
[0104] Figure 17 This is the first schematic diagram of the layout block dragging method described in the present disclosure. As Figure 17 shown, there are two layout blocks above and below respectively, namely layout block A and layout block B. The layout block B can be dragged to the right of layout block A, so as to realize the horizontal placement of layout block A and layout block B from left to right.
[0105] Figure 18 This is the second schematic diagram of the layout block dragging method described in the present disclosure. As Figure 18 shown, layout block A and layout block B are placed horizontally, and layout block C is located below layout block A and layout block B. The layout block C can be dragged to the below of layout block B, so as to realize the vertical placement of layout block C and layout block B from top to bottom.
[0106] In short, through the above processing, the layout block can be made to have the ability of free arrangement, and the horizontal and vertical placement between layout blocks can be realized by dragging, etc.
[0107] 5) Embedding request
[0108] In some embodiments of the present disclosure, in response to determining that the layout block operation request is an embedding request, any element specified by the user can be embedded in the target layout block. Among them, in response to the embedded element being a layout block, infinite nesting of the layout block can be supported.
[0109] That is to say, for the target layout block, any element can be embedded therein, such as a table, a picture, etc., and at the same time including embedding the layout block itself. Moreover, when embedding a layout block, infinite nesting of the layout block can be supported, thereby improving the freedom of the user when arranging the document content and improving the arrangement efficiency, etc.
[0110] 6) Color definition request
[0111] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a color definition request, the border color of the target layout block can be set to the color specified by the user, and / or the fill color of the target layout block can be set to the color specified by the user.
[0112] For example, for the target layout block, a color palette can be displayed for the user. The user can set the border color and fill color of the target layout block by clicking on the specific color in the color palette, etc., thereby improving the display effect of the document.
[0113] When it is determined that the content arrangement process for the target document is completed, the target document can be rendered and generated according to the latest obtained content arrangement result.
[0114] In some embodiments of the present disclosure, when rendering according to the latest obtained content layout result, for any two layout blocks that need to maintain an alignment relationship, in response to determining that the height of one of the layout blocks changes, the height of the other layout block can be adjusted according to the principle of maintaining the alignment relationship.
[0115] For example, due to the width differences in the window sizes of different user devices, different typesetting methods may be seen on different user devices.
[0116] Figure 19 It is a schematic diagram of different typesetting methods described in the present disclosure. As Figure 19 shown, in the upper window, two layout blocks in different columns appear to have the same height, but in the lower window, a different situation is presented.
[0117] Therefore, in the solution described in the present disclosure, it is proposed that for any two layout blocks that need to maintain an alignment relationship, in response to determining that the height of one of the layout blocks changes, the height of the other layout block can be adjusted according to the principle of maintaining the alignment relationship, that is, the height of the other layout block needs to change synchronously to improve the display effect of the document, etc.
[0118] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations. However, those skilled in the art should know that the present disclosure is not limited by the described action sequence, because according to the present disclosure, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present disclosure.
[0119] The above is the introduction of the method embodiments. The following further illustrates the solution of the present disclosure through device embodiments.
[0120] Figure 20 It is a schematic structural diagram of Embodiment 2000 of the document content layout device described in the present disclosure. As Figure 20 shown, it includes: an acquisition module 2001, a determination module 2002, and a processing module 2003.
[0121] The acquisition module 2001 is used to acquire the inserted layout blocks for the target document to be laid out.
[0122] The determination module 2002 is used to determine the target layout block selected by the user from the layout blocks in the target document, and determine the layout block operation request issued by the user for the target layout block.
[0123] The processing module 2003 is configured to complete the current content layout processing according to the target layout block and the layout block processing method corresponding to the layout block operation request.
[0124] By adopting the solution described in the above device embodiment, layout blocks can be used for document content layout. As a new type of advanced layout element and also a container element, the layout block is a brand-new element form in the industry's document products. For any target layout block in the document, the corresponding layout block processing method can be used according to the corresponding layout block operation request to complete the corresponding content layout processing, thereby realizing the free layout of content, etc., and enabling users to quickly build the desired effect, realizing the enhancement of content expression and the improvement of creation efficiency, etc.
[0125] In some embodiments of the present disclosure, when the processing module 2003 determines that the content layout process for the target document ends, it can render and generate the target document according to the latest obtained content layout result.
[0126] In some embodiments of the present disclosure, the content layout result may include: each document block and the layout tree corresponding to each document block. Each document block includes at least two layout blocks. The first layout block in each document block is inserted into the document block through the insertion menu. The layout tree is generated according to the positional relationship between the layout blocks in the corresponding document block.
[0127] In some embodiments of the present disclosure, the layout tree may meet the following requirements: including at least two levels, each level is a row node level or a column node level. The nodes in the row node level are all row nodes, and the nodes in the column node level are all column nodes; the next level of any row node level is a column node level, and the next level of any column node level is a row node level, and the first level is a row node level; the first level includes a root node, and each of the other levels except the first level includes at least two nodes; each leaf node corresponds to a layout block in the document block corresponding to the layout tree. Except for the leaf nodes, the other nodes are all parent nodes, and each parent node includes at least two child nodes; in addition, the types of layout blocks include: row layout blocks and column layout blocks. The nodes corresponding to the row layout blocks are row nodes, and the nodes corresponding to the column layout blocks are column nodes.
[0128] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block addition request, the processing module 2003 can add a new layout block above, below, to the left, or to the right of the target layout block as the newly added layout block, and can update the first layout tree corresponding to the first document block where the target layout block is located according to the newly added layout block.
[0129] In some embodiments of the present disclosure, in response to determining that the newly added layout block and the target layout block are layout blocks of the same type, the processing module 2003 may add a first newly added node corresponding to the newly added layout block at the level where the node to be processed is located, and may determine the parent node of the node to be processed as the parent node of the first newly added node. The node to be processed is the node corresponding to the target layout block. In response to determining that the newly added layout block and the target layout block are layout blocks of different types, the processing module 2003 may replace the node to be processed with a second newly added node at the level where the node to be processed is located, and may add a third newly added node corresponding to the target layout block and a fourth newly added node corresponding to the newly added layout block at the next level of the level where the second newly added node is located, and determine the third newly added node and the fourth newly added node as the child nodes of the second newly added node.
[0130] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block deletion request, the processing module 2003 may delete the target layout block and may correspondingly update the first layout tree of the first document block where the target layout block is located.
[0131] In some embodiments of the present disclosure, in response to determining that the parent node of the node to be processed includes at least 3 child nodes, the at least 3 child nodes include the node to be processed and at least 2 sibling nodes other than the node to be processed, the processing module 2003 may delete the node to be processed from the first layout tree. The node to be processed is the node corresponding to the target layout block. In response to determining that the parent node of the node to be processed includes 2 child nodes, the 2 child nodes include the node to be processed and 1 sibling node other than the node to be processed, and it is determined that the sibling node is a leaf node, the processing module 2003 may replace the parent node of the node to be processed with the sibling node and delete the node to be processed. In response to determining that the parent node of the node to be processed includes 2 child nodes, the 2 child nodes include the node to be processed and 1 sibling node other than the node to be processed, and it is determined that the sibling node is a non-leaf node, the processing module 2003 may replace the parent node of the node to be processed with all the child nodes of the sibling node and delete the node to be processed and the sibling node.
[0132] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block size adjustment request, and in response to determining that the target layout block is a row layout block, the processing module 2003 may adjust the height of the target layout block to the target height required by the user. In response to determining that the target layout block is a column layout block, the processing module 2003 may adjust the width of the target layout block to the target width required by the user.
[0133] In some embodiments of the present disclosure, when the processing module 2003 adjusts the height of the target layout block to the target height required by the user, it may display the vertical guiding line corresponding to the target layout block. In response to determining that there is no target adsorption height, for each vertical guiding line dragging operation performed by the user, the height of the target layout block may be adjusted respectively according to a predetermined adjustment range. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block may be determined as the target height. In response to determining that there is at least one target adsorption height, for each vertical guiding line dragging operation performed by the user, the following first processing may be performed respectively: In response to determining that the gap between the latest height of the target layout block and any target adsorption height is greater than the first threshold, the height of the target layout block is adjusted according to the predetermined adjustment range. In response to determining that the gap is less than or equal to the first threshold, the height of the target layout block is directly adjusted to the target adsorption height. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block is determined as the target height, otherwise the first processing is repeated.
[0134] In some embodiments of the present disclosure, the manner in which the processing module 2003 determines the target adsorption height may include: screening the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block. In response to screening out the adsorption nodes that meet the requirements, the height of the layout block corresponding to the adsorption node is determined as the target adsorption height.
[0135] In some embodiments of the present disclosure, the manner in which the processing module 2003 adjusts the width of the target layout block to the target width required by the user may include: displaying the horizontal guiding line corresponding to the target layout block. In response to determining that there is no target adsorption width, for each horizontal guiding line dragging operation performed by the user, the width of the target layout block is adjusted respectively according to a predetermined adjustment range. In response to obtaining the user's adjustment end instruction, the latest width of the target layout block is determined as the target width. In response to determining that there is at least one target adsorption width, for each horizontal guiding line dragging operation performed by the user, the following second processing may be performed respectively: In response to determining that the gap between the latest width of the target layout block and any target adsorption width is greater than the second threshold, the width of the target layout block is adjusted according to the predetermined adjustment range. In response to determining that the gap is less than or equal to the second threshold, the width of the target layout block is directly adjusted to the target adsorption width. In response to obtaining the user's adjustment end instruction, the latest width of the target layout block is determined as the target width, otherwise the second processing is repeated.
[0136] In some embodiments of the present disclosure, the manner in which the processing module 2003 determines the target adsorption width may include: screening the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block. In response to screening out the adsorption nodes that meet the requirements, the width of the layout block corresponding to the adsorption node is determined as the target adsorption width. Alternatively, the sum of the width of the target layout block and the widths of the layout blocks corresponding to each sibling node is obtained to get the first reference width. The sibling nodes are other nodes that belong to the same parent node as the node corresponding to the target layout block. The quotient of the first reference width divided by M + 1 is determined as the target adsorption width, where M represents the number of sibling nodes. Alternatively, the sum of the width of the target layout block and the width of the layout block adjacent to the right of the target layout block is obtained to get the second reference width. The quotient of the second reference width divided by 2 is determined as the target adsorption width.
[0137] In addition, in some embodiments of the present disclosure, in response to determining that the layout block operation request is a layout block drag request, the processing module 2003 may drag the target layout block to a position where it is placed horizontally or vertically with other layout blocks.
[0138] In some embodiments of the present disclosure, in response to determining that the layout block operation request is an embedding request, the processing module 2003 may embed any element specified by the user in the target layout block. Among them, in response to the embedded element being a layout block, infinite nesting of the layout block is supported.
[0139] In some embodiments of the present disclosure, in response to determining that the layout block operation request is a color definition request, the processing module 2003 may set the border color of the target layout block to the color specified by the user, and / or may set the fill color of the target layout block to the color specified by the user.
[0140] In addition, in some embodiments of the present disclosure, when the processing module 2003 performs rendering according to the latest obtained content layout result, for any two layout blocks that need to maintain an alignment relationship, in response to determining that the height of one of the layout blocks has changed, the height of the other layout block may be adjusted in accordance with the principle of maintaining the alignment relationship.
[0141] The specific working process of the above device embodiment may refer to the relevant description in the foregoing method embodiment and will not be elaborated here.
[0142] In summary, adopting the solution described in this disclosure can help users achieve free layout of any element within a document, thus enriching the document construction ability, enhancing content expression, and improving creation efficiency. Additionally, users can create documents with various different graphic styles according to the solution described in this disclosure, such as business architecture diagrams, product planning flowcharts, product planning diagrams, requirement-benefit review diagrams, team introduction diagrams, data display diagrams, etc., so as to meet the usage requirements of different scenarios.
[0143] The solution described in this disclosure can be applied to the field of artificial intelligence, particularly in the fields of natural language processing and knowledge bases. Artificial intelligence is a discipline that studies how to make computers simulate certain human thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level technologies and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, and knowledge graph technology.
[0144] In addition, the documents and the like in the embodiments described in this disclosure are not targeted at a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the processing of the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information complies with the provisions of relevant laws and regulations and does not violate public order and good customs.
[0145] According to an embodiment of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0146] Figure 21 FIG. shows a schematic block diagram of an electronic device 2100 that can be used to implement the embodiments of this disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of this disclosure described and / or claimed herein.
[0147] As Figure 21As shown, the electronic device 2100 includes a computing unit 2101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 2102 or a computer program loaded from a storage unit 2108 into a random access memory (RAM) 2103. In the RAM 2103, various programs and data required for the operation of the electronic device 2100 can also be stored. The computing unit 2101, the ROM 2102, and the RAM 2103 are connected to each other via a bus 2104. An input / output (I / O) interface 2105 is also connected to the bus 2104.
[0148] Multiple components in the electronic device 2100 are connected to the I / O interface 2105, including: an input unit 2106, such as a keyboard, a mouse, etc.; an output unit 2107, such as various types of displays, speakers, etc.; a storage unit 2108, such as a magnetic disk, an optical disc, etc.; and a communication unit 2109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 2109 allows the electronic device 2100 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0149] The computing unit 2101 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 2101 include, but are not limited to, a central processing unit (CPU), a graphic processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 2101 executes the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 2108. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 2100 via the ROM 2102 and / or the communication unit 2109. When the computer program is loaded into the RAM 2103 and executed by the computing unit 2101, one or more steps of the methods described in the present disclosure can be executed. Alternatively, in other embodiments, the computing unit 2101 can be configured to execute the methods described in the present disclosure by any other appropriate means (e.g., by means of firmware).
[0150] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPS), system on chip (SOC) systems, complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.
[0151] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.
[0152] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0154] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0155] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The client-server relationship is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
[0156] It should be understood that various forms of the processes shown above may be used, steps may be reordered, added or deleted. For example, the steps described in this disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this is not limited herein.
[0157] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A method for document content layout, comprising: Obtaining inserted layout blocks for a target document to be laid out; Determining a target layout block selected by a user from the layout blocks in the target document, and determining a layout block operation request issued by the user for the target layout block; Completing the current content layout processing according to the target layout block and the layout block processing method corresponding to the layout block operation request.
2. The method according to claim 1, further comprising: In response to determining the end of the content layout process for the target document, rendering and generating the target document according to the latest obtained content layout result.
3. The method according to claim 2, wherein The content layout result includes: each document block and a layout tree corresponding to each document block respectively, each document block includes at least two layout blocks, and the layout tree is generated according to the positional relationship between the layout blocks in the corresponding document block.
4. The method according to claim 3, wherein The layout tree meets the following requirements: including at least two levels, each level is a row node level or a column node level respectively, the nodes in the row node level are all row nodes, and the nodes in the column node level are all column nodes; The next level of any row node level is the column node level, the next level of any column node level is the row node level, and the first level is the row node level; The first level includes a root node, and each of the other levels except the first level includes at least two nodes; each leaf node corresponds to a layout block in the document block corresponding to the layout tree, and the nodes except the leaf nodes are all parent nodes, and each parent node includes at least two child nodes; The types of the layout blocks include: row layout blocks and column layout blocks, the nodes corresponding to the row layout blocks are the row nodes, and the nodes corresponding to the column layout blocks are the column nodes.
5. The method according to claim 4, wherein The layout block operation request includes: a layout block addition request; Completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: adding a new layout block above, below, to the left or to the right of the target layout block as a newly added layout block, and updating the first layout tree corresponding to the first document block where the target layout block is located according to the newly added layout block.
6. The method according to claim 5, wherein Updating the first layout tree corresponding to the first document block where the target layout block is located according to the newly added layout block includes: In response to determining that the newly added layout block and the target layout block are layout blocks of the same type, adding a first newly added node corresponding to the newly added layout block in the level where the node to be processed is located, and determining the parent node of the node to be processed as the parent node of the first newly added node, where the node to be processed is the node corresponding to the target layout block; In response to determining that the newly added layout block and the target layout block are layout blocks of different types, replace the to-be-processed node with a second newly added node at the level where the to-be-processed node is located, and add a third newly added node corresponding to the target layout block and a fourth newly added node corresponding to the newly added layout block at the next level of the level where the second newly added node is located, and determine the third newly added node and the fourth newly added node as child nodes of the second newly added node.
7. The method according to claim 4, wherein the layout block operation request includes: a layout block deletion request; completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: deleting the target layout block and correspondingly updating the first layout tree of the first document block where the target layout block is located.
8. The method according to claim 7, wherein, The correspondingly updating the first layout tree of the first document block where the target layout block is located includes: In response to determining that the parent node of the to-be-processed node includes at least 3 child nodes, where the at least 3 child nodes include the to-be-processed node and at least 2 sibling nodes other than the to-be-processed node, delete the to-be-processed node from the first layout tree, where the to-be-processed node is the node corresponding to the target layout block; In response to determining that the parent node of the to-be-processed node includes 2 child nodes, where the 2 child nodes include the to-be-processed node and 1 sibling node other than the to-be-processed node, and determining that the sibling node is a leaf node, replace the parent node of the to-be-processed node with the sibling node and delete the to-be-processed node; In response to determining that the parent node of the to-be-processed node includes 2 child nodes, where the 2 child nodes include the to-be-processed node and 1 sibling node other than the to-be-processed node, and determining that the sibling node is a non-leaf node, replace the parent node of the to-be-processed node with all child nodes of the sibling node, and delete the to-be-processed node and the sibling node.
9. The method according to claim 4, wherein the layout block operation request includes: a layout block size adjustment request; completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: In response to determining that the target layout block is a row layout block, adjust the height of the target layout block to the target height required by the user; In response to determining that the target layout block is a column layout block, adjust the width of the target layout block to the target width required by the user.
10. The method according to claim 9, wherein The adjusting the height of the target layout block to the target height required by the user includes: displaying a vertical guide line corresponding to the target layout block; In response to determining that there is no target adsorption height, for each vertical guide line dragging operation performed by the user, adjust the height of the target layout block by a predetermined adjustment amplitude respectively, and in response to obtaining the adjustment end instruction of the user, determine the latest height of the target layout block as the target height; In response to determining that there is at least one target adsorption height, for each vertical guide line dragging operation performed by the user, the following first processing is respectively carried out: In response to determining that the gap between the latest height of the target layout block and any target adsorption height is greater than the first threshold, adjust the height of the target layout block according to the predetermined adjustment range; in response to determining that the gap is less than or equal to the first threshold, directly adjust the height of the target layout block to the target adsorption height; in response to obtaining the adjustment end instruction of the user, determine the latest height of the target layout block as the target height, otherwise repeat the first processing.
11. The method according to claim 10, wherein, The determination method of the target adsorption height includes: Screen the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block; In response to screening out the adsorption nodes that meet the requirements, determine the height of the layout block corresponding to the adsorption node as the target adsorption height.
12. The method according to claim 9, wherein The adjustment of the width of the target layout block to the target width required by the user includes: Display the horizontal guide line corresponding to the target layout block; In response to determining that there is no target adsorption width, for each horizontal guide line dragging operation performed by the user, adjust the width of the target layout block according to the predetermined adjustment range respectively. In response to obtaining the adjustment end instruction of the user, determine the latest width of the target layout block as the target width; In response to determining that there is at least one target adsorption width, for each horizontal guide line dragging operation performed by the user, the following second processing is respectively carried out: In response to determining that the gap between the latest width of the target layout block and any target adsorption width is greater than the second threshold, adjust the width of the target layout block according to the predetermined adjustment range; in response to determining that the gap is less than or equal to the second threshold, directly adjust the width of the target layout block to the target adsorption width; in response to obtaining the adjustment end instruction of the user, determine the latest width of the target layout block as the target width, otherwise repeat the second processing.
13. The method according to claim 12, wherein, The determination method of the target adsorption width includes: Screen the leaf nodes in the first layout tree and the second layout tree, where the first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block. In response to screening out the adsorption nodes that meet the requirements, determine the width of the layout block corresponding to the adsorption node as the target adsorption width; Alternatively, obtain the sum of the widths of the target layout block and the layout blocks corresponding to each sibling node to obtain a first reference width. The sibling nodes are other nodes that belong to the same parent node as the node corresponding to the target layout block. Determine the quotient of the first reference width and M + 1 as the target adsorption width, where M represents the number of sibling nodes; Alternatively, obtain the sum of the width of the target layout block and the width of the layout block adjacent to the right of the target layout block, to obtain a second reference width, and determine the target adsorption width as the quotient of the second reference width divided by 2.
14. The method according to any one of claims 1 to 12, wherein the layout block operation request includes: a layout block drag request; completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: dragging the target layout block to a position where it is placed horizontally or vertically with other layout blocks.
15. The method according to any one of claims 1 to 12, wherein the layout block operation request includes: an embedding request; completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: embedding any element specified by the user in the target layout block, wherein, in response to the embedded element being a layout block, infinite nesting of the layout block is supported.
16. The method according to any one of claims 1 to 12, wherein the layout block operation request includes: a color definition request; completing the current content layout processing according to the layout block processing method corresponding to the layout block operation request includes: setting the border color of the target layout block to the color specified by the user, and / or setting the fill color of the target layout block to the color specified by the user.
17. The method according to any one of claims 2 to 12, wherein, Rendering and generating the target document according to the latest obtained content layout result includes: When rendering according to the latest obtained content layout result, for any two layout blocks that need to maintain an alignment relationship, in response to determining that the height of one of the layout blocks changes, adjust the height of the other layout block according to the principle of maintaining the alignment relationship.
18. A document content layout device, comprising: An acquisition module, a determination module, and a processing module; The acquisition module is configured to acquire inserted layout blocks for a target document to be laid out; The determination module is configured to determine a target layout block selected by the user from the layout blocks in the target document, and determine a layout block operation request issued by the user for the target layout block; The processing module is configured to complete the current content layout processing according to the target layout block and the layout block processing method corresponding to the layout block operation request.
19. The apparatus according to claim 18, wherein the processing module is further configured to, in response to determining that the content layout process for the target document ends, render and generate the target document according to the latest obtained content layout result.
20. The apparatus according to claim 19, wherein the content layout result includes: each document block and a layout tree corresponding to each document block, each document block includes at least two layout blocks, and the layout tree is generated according to the positional relationship between the layout blocks in the corresponding document block.
21. The apparatus according to claim 20, wherein the layout tree meets the following requirements: includes at least two levels, each level is a row node level or a column node level, the nodes in the row node level are all row nodes, and the nodes in the column node level are all column nodes; The next level of any row node level is the column node level, the next level of any column node level is the row node level, and the first level is the row node level; The first level includes a root node, and each of the other levels except the first level includes at least two nodes; each leaf node corresponds to a layout block in the document block corresponding to the layout tree, and each node except the leaf node is a parent node, and each parent node includes at least two child nodes; The types of the layout blocks include: row layout blocks and column layout blocks, the nodes corresponding to the row layout blocks are the row nodes, and the nodes corresponding to the column layout blocks are the column nodes.
22. The apparatus according to claim 21, wherein, The layout block operation request includes: a layout block addition request; The processing module adds a new layout block above, below, to the left, or to the right of the target layout block as the newly added layout block, and updates the first layout tree corresponding to the first document block where the target layout block is located according to the newly added layout block.
23. The apparatus according to claim 22, wherein, The processing module, in response to determining that the newly added layout block and the target layout block are layout blocks of the same type, adds a first newly added node corresponding to the newly added layout block at the level where the node to be processed is located, and determines the parent node of the node to be processed as the parent node of the first newly added node, where the node to be processed is the node corresponding to the target layout block. In response to determining that the newly added layout block and the target layout block are layout blocks of different types, replaces the node to be processed with a second newly added node at the level where the node to be processed is located, and adds a third newly added node corresponding to the target layout block and a fourth newly added node corresponding to the newly added layout block at the next level of the level where the second newly added node is located, and determines the third newly added node and the fourth newly added node as the child nodes of the second newly added node.
24. The apparatus according to claim 21, wherein, The layout block operation request includes: a layout block deletion request; The processing module deletes the target layout block and correspondingly updates the first layout tree corresponding to the first document block where the target layout block is located.
25. The apparatus according to claim 24, wherein, The processing module, in response to determining that the parent node of the node to be processed includes at least three child nodes, where the at least three child nodes include the node to be processed and at least two sibling nodes other than the node to be processed, deletes the node to be processed from the first layout tree, where the node to be processed is the node corresponding to the target layout block. In response to determining that the parent node of the node to be processed includes two child nodes, where the two child nodes include the node to be processed and one sibling node other than the node to be processed, and determining that the sibling node is a leaf node, replaces the parent node of the node to be processed with the sibling node and deletes the node to be processed. In response to determining that the parent node of the node to be processed includes two child nodes, where the two child nodes include the node to be processed and one sibling node other than the node to be processed, and determining that the sibling node is a non-leaf node, replaces the parent node of the node to be processed with all the child nodes of the sibling node and deletes the node to be processed and the sibling node.
26. The apparatus according to claim 21, wherein, the layout block operation request includes: a layout block size adjustment request; The processing module, in response to determining that the target layout block is a row layout block, adjusts the height of the target layout block to the target height required by the user. In response to determining that the target layout block is a column layout block, adjusts the width of the target layout block to the target width required by the user.
27. The apparatus according to claim 26, wherein, The processing module displays the vertical guide line corresponding to the target layout block. In response to determining that there is no target adsorption height, for each vertical guide line dragging operation performed by the user, the height of the target layout block is adjusted respectively according to a predetermined adjustment amplitude. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block is determined as the target height. In response to determining that there is at least one target adsorption height, for each vertical guide line dragging operation performed by the user, the following first processing is performed respectively: In response to determining that the gap between the latest height of the target layout block and any target adsorption height is greater than a first threshold, the height of the target layout block is adjusted according to the predetermined adjustment amplitude. In response to determining that the gap is less than or equal to the first threshold, the height of the target layout block is directly adjusted to the target adsorption height. In response to obtaining the user's adjustment end instruction, the latest height of the target layout block is determined as the target height, otherwise the first processing is repeated.
28. The apparatus according to claim 27, wherein, The processing module screens the leaf nodes in the first layout tree and the second layout tree. The first layout tree is the layout tree corresponding to the first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to the document block adjacent to the first document block. In response to screening out the adsorption nodes that meet the requirements, the height of the layout block corresponding to the adsorption node is determined as the target adsorption height.
29. The apparatus according to claim 26, wherein the processing module displays a horizontal guiding line corresponding to the target layout block, and in response to determining that there is no target adsorption width, for each horizontal guiding line dragging operation performed by the user, the width of the target layout block is adjusted respectively according to a predetermined adjustment range, and in response to obtaining the adjustment end instruction of the user, the latest width of the target layout block is determined as the target width; in response to determining that there is at least one target adsorption width, for each horizontal guiding line dragging operation performed by the user, the following second processing is performed respectively: in response to determining that the gap between the latest width of the target layout block and any target adsorption width is greater than a second threshold, the width of the target layout block is adjusted according to the predetermined adjustment range, in response to determining that the gap is less than or equal to the second threshold, the width of the target layout block is directly adjusted to the target adsorption width, and in response to obtaining the adjustment end instruction of the user, the latest width of the target layout block is determined as the target width, otherwise the second processing is repeated.
30. The apparatus according to claim 29, wherein the processing module filters leaf nodes in a first layout tree and a second layout tree, the first layout tree is the layout tree corresponding to a first document block where the target layout block is located, and the second layout tree is the layout tree corresponding to a document block adjacent to the first document block; in response to filtering out adsorption nodes that meet the requirements, the width of the layout block corresponding to the adsorption node is determined as the target adsorption width, or the sum of the width of the target layout block and the widths of the layout blocks corresponding to each sibling node is obtained to get a first reference width, the sibling nodes are other nodes that belong to the same parent node as the node corresponding to the target layout block, and the quotient of the first reference width divided by M + 1 is determined as the target adsorption width, M represents the number of the sibling nodes, or the sum of the width of the target layout block and the width of the layout block adjacent to the right side of the target layout block is obtained to get a second reference width, and the quotient of the second reference width divided by 2 is determined as the target adsorption width.
31. The apparatus according to any one of claims 18 to 29, wherein the layout block operation request includes: a layout block dragging request; the processing module drags the target layout block to a position where it is placed horizontally or vertically with other layout blocks.
32. The apparatus according to any one of claims 18 to 29, wherein the layout block operation request includes: an embedding request; the processing module embeds any element specified by the user in the target layout block, and wherein in response to the embedded element being a layout block, infinite nesting of the layout block is supported.
33. The apparatus according to any one of claims 18 to 29, wherein the layout block operation request includes: a color definition request; the processing module sets the border color of the target layout block to the color specified by the user, and / or sets the fill color of the target layout block to the color specified by the user.
34. The apparatus according to any one of claims 19 to 29, wherein when rendering according to the latest obtained content layout result, the processing module is further configured to, for any two layout blocks that need to maintain an alignment relationship, in response to determining that the height of one of the layout blocks changes, adjust the height of the other layout block in accordance with the principle of maintaining the alignment relationship.
35. An electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method according to any one of claims 1 to 17.
36. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 17.
37. A computer program product, comprising computer programs / instructions which, when executed by a processor, implement the method according to any one of claims 1 to 17.