Format document display method and device

By cutting the layout document after flow typesetting to generate sub-pages that adapt to the screen size of the terminal device, it solves the problem that flow typesetting documents cannot be used for left and right page turning, and realizes support for multiple reading modes.

CN118536471APending Publication Date: 2024-08-23ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310156532.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the layout document processed by flow typesetting cannot be adapted to the left and right page turning reading mode, resulting in reading difficulties.

Method used

By determining the display width and height according to the screen size of the terminal device, the document after flow typesetting is cropped to generate multiple orderly arranged sub-pages. The width and height of each sub-page are the display width and height, so that on the terminal Display the document on the device.

Benefits of technology

It supports both up and down page turning and left and right page turning on the terminal device, providing a more flexible reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118536471A
    Figure CN118536471A
Patent Text Reader

Abstract

The invention provides a layout document display method and device, and is applied to terminal equipment, the method comprises the following steps: determining a display width and a display height corresponding to a first document according to a screen size of the terminal equipment, the first document being a layout document; performing streaming typesetting processing on the first document according to the display width to obtain the first document after streaming typesetting; according to the display height, the first document after streaming typesetting is cut, a plurality of orderly arranged sub-pages corresponding to the first document are generated, the width of any sub-page is the display width, and the height of any sub-page is the display height; and displaying the first document on the terminal equipment according to the plurality of orderly arranged sub-pages. The invention provides a format document display scheme capable of supporting an up-and-down page turning reading mode and a left-and-right page turning reading mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of document processing technology, and in particular to a method and device for displaying a layout document. Background Art

[0002] Layout documents are widely used in document presentation because of their characteristic of not "going out of layout".

[0003] When presenting a layout document on a device, since the size of the device presenting the layout document is different, in order to achieve a better presentation effect, the layout document may be stream-formatted according to the size of the device and then presented on the corresponding device.

[0004] The display scheme of the above-mentioned layout document, after the layout document is subjected to streaming typesetting processing, the height of the document obtained after streaming typesetting processing is usually much greater than the height of the device, so it is only suitable for reading in the form of flipping pages up and down, but not for reading in the form of flipping pages left and right. Summary of the invention

[0005] The present application provides a layout document display method and device to solve the problem that documents processed by current streaming typesetting cannot be applied to the left-right page turning reading mode.

[0006] In a first aspect, the present application provides a layout document display method, applied to a terminal device, the method comprising:

[0007] Determining a display width and a display height corresponding to a first document according to a screen size of the terminal device, wherein the first document is a layout document;

[0008] Performing a flow layout process on the first document according to the display width to obtain a first document after the flow layout;

[0009] The first document after the flow typesetting is cropped according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height;

[0010] The first document is displayed on the terminal device according to the plurality of sub-pages arranged in order.

[0011] In a possible implementation, the step of cropping the first document after flow layout according to the display height to generate a plurality of ordered sub-pages corresponding to the first document includes:

[0012] Executing a first operation, the first operation comprising: when the height of the document after the i-1th round of cropping is greater than the display height, cropping the document after the i-1th round of cropping according to the display height to generate an i-th sub-page and the document after the i-th round of cropping;

[0013] Here, the i is 1, 2, ... in sequence, and the document after the 0th round of cropping is the first document after the streaming typesetting.

[0014] In a possible implementation, the step of performing a cropping process on the document after the i-1th round of cropping according to the display height to generate the i-th subpage and the document after the i-th round of cropping includes:

[0015] Determining a cutting line corresponding to the document after the i-1th round of cutting according to the display height;

[0016] According to the positions of the elements in the document after the i-1th round of cropping, the relationship between the elements and the cropping line is determined; wherein the relationship between any element and the cropping line is one of: being located before the cropping line, intersecting the cropping line, and being located after the cropping line;

[0017] Determine the content in the i-th subpage and the content in the document after the i-th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements;

[0018] The i-th sub-page and the document after the i-th round of cropping are generated according to the content in the i-th sub-page and the content in the document after the i-th round of cropping.

[0019] In a possible implementation manner, the document after the i-1th round of cropping includes elements intersecting the cropping line; and determining the content in the i-th subpage and the content in the document after the i-1th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements includes:

[0020] If the element intersecting the cropping line is text, the element before the cropping line in the document after the (i-1)-th round of cropping is determined as the content in the i-th subpage, and the element intersecting the cropping line and the element after the cropping line are determined as the content in the document after the i-th round of cropping;

[0021] If the element intersecting the cropping line is a picture, then determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the position of the cropping line on the picture;

[0022] If the element intersecting the cropping line is a table, the content in the i-th subpage and the content in the document after the i-th round of cropping are determined according to the target table row where the cropping line is located on the table.

[0023] In a possible implementation, determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the target table row where the cropping line is located on the table includes:

[0024] Determining a dividing line of the table according to the attribute information of the target table row;

[0025] The table is divided according to the dividing line to obtain a first sub-table and a second sub-table corresponding to the table;

[0026] Determine the elements before the cropping line in the document after the (i-1)th round of cropping, and the first subtable as the content in the i-th subpage;

[0027] The elements after the cropping line in the document after the (i-1)th round of cropping and the second subtable are determined as the content in the document after the (i)th round of cropping.

[0028] In a possible implementation, determining the partition line of the table according to the attribute information of the target table row includes:

[0029] If the target table row does not include upper and lower merged cells and background common cells, the top table line of the target table row is determined as the dividing line;

[0030] If the target table row includes the upper and lower merged cells or the background common cells, then determine the associated table rows in the table that do not include the upper and lower merged cells and the background common cells; and determine the segmentation line according to the distance from the associated table row to the cropping line.

[0031] In a possible implementation manner, dividing the table according to the dividing line to obtain a first sub-table and a second sub-table corresponding to the table includes:

[0032] Determine the portion of the table before the dividing line as the first subtable;

[0033] determining a header of the second subtable according to attribute information of the header in the table, a type of the table, and at least one of historical user data;

[0034] The second sub-table is determined according to the table header of the second sub-table and the portion of the table after the dividing line.

[0035] In a possible implementation, determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the position of the cropping line on the image includes:

[0036] Determine the distance from the top of the picture to the cropping line, and the distance from the bottom of the picture to the cropping line;

[0037] If the distance from the top of the image to the cropping line is greater than or equal to the distance from the bottom of the image to the cropping line, then the elements before the cropping line in the document after the (i-1)-th round of cropping are determined as the content in the i-th subpage, and the image and the elements after the cropping line are determined as the content in the document after the i-th round of cropping;

[0038] If the distance from the top of the image to the cropping line is less than the distance from the bottom of the image to the cropping line, the elements before the cropping line and the image in the document after the i-1th round of cropping are determined as the content of the i-th sub-page, and the elements after the cropping line are determined as the content of the document after the i-1th round of cropping.

[0039] In a possible implementation, generating the i-th sub-page and the document after the i-th round of cropping according to the content in the i-th sub-page and the content in the document after the i-th round of cropping includes:

[0040] Scaling the content in the ith subpage according to the height corresponding to the content in the ith subpage and the display height to generate the ith subpage;

[0041] The document after the i-th round of cropping is generated according to the content in the document after the i-th round of cropping.

[0042] In a second aspect, the present application provides a layout document display device, applied to a terminal device, the device comprising:

[0043] A determination module, configured to determine a display width and a display height corresponding to a first document according to a screen size of the terminal device, wherein the first document is a layout document;

[0044] A first processing module, configured to perform stream layout processing on the first document according to the display width to obtain a first document after stream layout;

[0045] A second processing module is used to perform a cropping process on the first document after the stream layout according to the display height, to generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height;

[0046] A display module is configured to display the first document on the terminal device according to the plurality of orderly arranged sub-pages.

[0047] In a possible implementation manner, the second processing module is specifically configured to:

[0048] Executing a first operation, the first operation comprising: when the height of the document after the i-1th round of cropping is greater than the display height, cropping the document after the i-1th round of cropping according to the display height to generate an i-th sub-page and the document after the i-th round of cropping;

[0049] Here, the i is 1, 2, ... in sequence, and the document after the 0th round of cropping is the first document after the streaming typesetting.

[0050] In a possible implementation manner, the second processing module is specifically configured to:

[0051] Determining a cutting line corresponding to the document after the i-1th round of cutting according to the display height;

[0052] According to the positions of the elements in the document after the i-1th round of cropping, the relationship between the elements and the cropping line is determined; wherein the relationship between any element and the cropping line is one of: being located before the cropping line, intersecting the cropping line, and being located after the cropping line;

[0053] Determine the content in the i-th subpage and the content in the document after the i-th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements;

[0054] The i-th sub-page and the document after the i-th round of cropping are generated according to the content in the i-th sub-page and the content in the document after the i-th round of cropping.

[0055] In a possible implementation manner, the document after the (i-1)th round of cropping includes elements intersecting with the cropping line; and the second processing module is specifically configured to:

[0056] If the element intersecting the cropping line is text, the element before the cropping line in the document after the (i-1)-th round of cropping is determined as the content in the i-th subpage, and the element intersecting the cropping line and the element after the cropping line are determined as the content in the document after the i-th round of cropping;

[0057] If the element intersecting the cropping line is a picture, then determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the position of the cropping line on the picture;

[0058] If the element intersecting the cropping line is a table, the content in the i-th subpage and the content in the document after the i-th round of cropping are determined according to the target table row where the cropping line is located on the table.

[0059] In a possible implementation manner, the second processing module is specifically configured to:

[0060] Determining a dividing line of the table according to the attribute information of the target table row;

[0061] The table is divided according to the dividing line to obtain a first sub-table and a second sub-table corresponding to the table;

[0062] Determine the elements before the cropping line in the document after the (i-1)th round of cropping, and the first subtable as the content in the i-th subpage;

[0063] The elements after the cropping line in the document after the (i-1)th round of cropping and the second subtable are determined as the content in the document after the (i)th round of cropping.

[0064] In a possible implementation manner, the second processing module is specifically configured to:

[0065] If the target table row does not include upper and lower merged cells and background common cells, the top table line of the target table row is determined as the dividing line;

[0066] If the target table row includes the upper and lower merged cells or the background common cells, then determine the associated table rows in the table that do not include the upper and lower merged cells and the background common cells; and determine the segmentation line according to the distance from the associated table row to the cropping line.

[0067] In a possible implementation manner, the second processing module is specifically configured to:

[0068] Determine the portion of the table before the dividing line as the first subtable;

[0069] determining a header of the second subtable according to attribute information of the header in the table, a type of the table, and at least one of historical user data;

[0070] The second sub-table is determined according to the table header of the second sub-table and the portion of the table after the dividing line.

[0071] In a possible implementation manner, the second processing module is specifically configured to:

[0072] Determine the distance from the top of the picture to the cropping line, and the distance from the bottom of the picture to the cropping line;

[0073] If the distance from the top of the image to the cropping line is greater than or equal to the distance from the bottom of the image to the cropping line, then the elements before the cropping line in the document after the (i-1)-th round of cropping are determined as the content in the i-th subpage, and the image and the elements after the cropping line are determined as the content in the document after the i-th round of cropping;

[0074] If the distance from the top of the image to the cropping line is less than the distance from the bottom of the image to the cropping line, the elements before the cropping line and the image in the document after the i-1th round of cropping are determined as the content of the i-th sub-page, and the elements after the cropping line are determined as the content of the document after the i-1th round of cropping.

[0075] In a possible implementation manner, the second processing module is specifically configured to:

[0076] Scaling the content in the ith subpage according to the height corresponding to the content in the ith subpage and the display height to generate the ith subpage;

[0077] The document after the i-th round of cropping is generated according to the content in the document after the i-th round of cropping.

[0078] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the layout document display method as described in any one of the first aspects is implemented.

[0079] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the layout document display method as described in any one of the first aspects is implemented.

[0080] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the layout document display method as described in any one of the first aspects.

[0081] The layout document display method and device provided in the embodiment of the present application are applied to a terminal device. First, the terminal device determines the display width and display height corresponding to the first document according to its own screen size, and then performs streaming typesetting processing on the first document according to the display width to obtain the first document after streaming typesetting. The width of the first document after streaming typesetting is the display width; then, the first document after streaming typesetting is cropped according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document. Since the width of the first document after streaming typesetting is the display width, the width of any sub-page obtained after cropping is also the display width. And since it is cropped according to the display height, the height of any sub-page is also the display height, and the arrangement order of the plurality of sub-pages corresponds to their positions in the first document after streaming typesetting. Finally, the first document is displayed on the terminal device according to the plurality of orderly arranged sub-pages. Since the width of any subpage is the display width, and the height of any subpage is the display height, and both the display width and the display height are determined according to the screen size of the terminal device, they can be well adapted to the terminal device, and neither the height of the subpage is greater than the screen height of the terminal device, so that the terminal device screen cannot present all the contents of the subpage, nor the width of the subpage is too smaller than the screen height of the terminal device, so that a large blank area appears on the terminal device screen. Since the width and height of any subpage are adapted to the terminal device, both the up-down page turning reading mode and the left-right page turning reading mode can be supported, which provides convenience for users to read the first document. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0083] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0084] Figure 2 A schematic diagram of a flow chart of a layout document display method provided in an embodiment of the present application;

[0085] Figure 3 A schematic diagram of a process flow of a round of cutting processing provided in an embodiment of the present application;

[0086] Figure 4 A schematic diagram of determining a cutting line provided in an embodiment of the present application;

[0087] Figure 5 A schematic diagram of document cutting provided in an embodiment of the present application;

[0088] Figure 6 A schematic diagram of the process of table cutting provided in the embodiment of the present application;

[0089] Figure 7 A schematic diagram of determining a dividing line of a table provided in an embodiment of the present application;

[0090] Figure 8 A schematic diagram of a cropped document provided in an embodiment of the present application;

[0091] Fig. 9 A schematic diagram of zooming in on a subpage containing picture elements provided in an embodiment of the present application;

[0092] Fig.10 A schematic diagram of zooming in on a subpage containing table elements provided in an embodiment of the present application;

[0093] Fig.11 A schematic diagram of a page-turning reading mode provided in an embodiment of the present application;

[0094] Fig.12 A schematic diagram of a left-right page turning reading mode provided in an embodiment of the present application;

[0095] Fig.13 A schematic diagram of the structure of a layout document display device provided in an embodiment of the present application;

[0096] Fig.14 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0097] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0098] First, the basic concepts involved in this application are introduced.

[0099] Streaming document: A streaming document is a file that performs layout calculation and drawing in a streaming manner. A streaming document usually contains metadata, styles, bookmarks, sections, paragraphs, sentences, and other contents, which are described in a certain hierarchy to form the format of a streaming document.

[0100] In streaming documents, you can edit, add, delete, and other operations on the content. Due to the editable nature of streaming documents, streaming documents may display inconsistently due to different reader versions, operating system versions, and other environmental factors. This is also called the "running version" phenomenon of streaming documents. Streaming documents are mainly used for document editing. Common streaming document file formats include word, txt, and so on.

[0101] Layout document: Layout document is relative to flow document. Layout document refers to a non-editable, fixed-layout document. The content, position, style, etc. of the text elements in the layout document are fixed when the layout document is generated. It is not easy to modify and edit. Usually, only some comments, signatures and other information can be added. Due to these characteristics of layout documents, layout documents will not "run away from the layout". The display and printing effects of layout documents on any device are highly consistent and are not affected by environmental factors such as the reader version and operating system version. Layout documents are mainly used for document presentation. Common layout document file formats include Portable Document Format (PDF), Open Fixed-layout Document (OFD), etc.

[0102] Streaming layout: Streaming layout refers to the specific layout measurement of the text, numbers, tables, images, etc. contained in the document. The saved content is the original editing element. Users can view the edited layout style through reading software, and the layout size can be adaptively displayed at different zoom ratios.

[0103] Layout documents are widely used in document presentation because they do not "run away from the page" and their display and printing effects on different devices are highly consistent. Layout document reading mode refers to the way of viewing layout documents, which usually includes up and down page turning reading mode and left and right page turning reading mode. Among them, up and down page turning reading mode means that after reading a certain page of the document, the content of the next page is displayed by turning the page up and down, while left and right page turning reading mode means that after reading a certain page of the document, the content of the next page is displayed by turning the page left and right.

[0104] In some cases, in order to facilitate viewing of layout documents on different devices, the layout documents will be flow-typesetted. The height of each page of the layout document may change, resulting in restrictions on the reading mode allowed by the layout document. For example, you can combine Figure 1 Understand the process.

[0105] Figure 1 The following is a schematic diagram of an application scenario provided by an embodiment of the present application, such as Figure 1 As shown, document 11 is an original layout document, including 3 pages in total, namely Figure 1 In order to make the document 11 present well on the terminal device 12, it is necessary to perform flow typesetting on the document 11, that is, to rearrange the elements in the document 11.

[0106] like Figure 1 As shown, after the streaming typesetting, document 13 is generated, and document 13 also includes 3 pages, which correspond to the 3 pages of document 11, and have the same content, but different sizes. In order to adapt to the presentation on the terminal device 12, the width of each page in document 13 is reduced, and the corresponding height is increased.

[0107] When the document 13 is presented on the terminal device 12, the width of each page is adapted to the width of the terminal device 12, but the height of each page is greater than the height of the terminal device 12, so that the terminal device 12 can only display part of the content of a page in the document 13 at the same time, but cannot display the entire content of the document 13. Therefore, this solution of displaying after streaming typesetting can only be applied to the up-down page turning reading mode, but not to the left-right page turning reading mode. If the left-right page turning reading mode is adopted, part of the content in the document 13 will never be displayed, which makes it difficult to read the document.

[0108] Based on this, the embodiments of the present application provide a layout document display solution, so that the layout document can be displayed based on the size of the presentation device, and can be adapted to the reading modes of turning pages up and down and turning pages left and right, providing convenience for users to read documents. It should be noted that the execution subject of each embodiment in the present application can be a processor, microprocessor, etc., or a device that integrates a processor or microprocessor and other devices, such as a client, server or terminal device, etc. The specific execution subject of each embodiment of the present application is not limited, and it can be selected and set according to actual needs. The following first combines Figure 2 The solution of the embodiment of the present application is introduced.

[0109] Figure 2 The schematic diagram of the flow chart of the layout document display method provided in the embodiment of the present application is applied to a terminal device, such as Figure 2 As shown, the method may include:

[0110] S21, determining a display width and a display height corresponding to a first document according to a screen size of a terminal device, where the first document is a layout document.

[0111] The terminal device is a device for presenting the first document, and the first document is a layout document. Since the screen of the terminal device has a corresponding size, in order to achieve a better display effect, it is necessary to determine the display width and display height corresponding to the first document according to the screen size of the terminal device. Among them, the display width is the width of each page when the first document is subsequently presented on the terminal device, and the display height is the height of each page when the first document is subsequently presented on the terminal device. The display width is less than or equal to the screen width of the terminal device, and the display height is less than or equal to the screen height of the terminal device.

[0112] In one implementation, the terminal device may directly determine the display width and display height corresponding to the first document according to the screen size. For example, the display width may be obtained by subtracting a preset value from the screen width, and the display height may be obtained by subtracting a preset value from the screen height.

[0113] In another implementation, the user can input the display width and display height independently, and the terminal device obtains the display width and display height input by the user, and determines the display width and display height corresponding to the first document according to the screen size of the terminal device and the display width and display height input by the user. For example, if the display width input by the user does not exceed the screen width, the display width input by the user is determined as the display width corresponding to the first document, otherwise the screen width is determined as the display width corresponding to the first document; if the display height input by the user does not exceed the screen height, the display height input by the user is determined as the display height corresponding to the first document, otherwise the screen height is determined as the display height corresponding to the first document.

[0114] S22, performing stream layout processing on the first document according to the display width to obtain a first document after stream layout.

[0115] After determining the display width corresponding to the first document, the terminal device performs streaming typesetting processing on the first document, that is, it measures the typesetting method of the text, tables, images and other elements contained in the first document, and reformats the elements in the first document without changing the elements in the first document, so as to obtain the first document after streaming typesetting.

[0116] It should be noted that, in the process of performing streaming typesetting on the first document, in addition to changing the arrangement of elements in the first document, it may also involve scaling the elements in the first document. For example, if the text in the first document is large, and the screen of the terminal device is small, the effect of directly using the large text to present on the terminal device is not good, then the terminal device can scale the text in the first document in proportion, and then recalculate the coordinates of each element in the first document in combination with the display width to achieve re-typesetting and obtain the first document after streaming typesetting.

[0117] In the case where a table or an image is stored in the first document, in the process of performing flow typesetting processing on the first document according to the display width, the table or the image in the first document needs to be scaled according to the display width.

[0118] Take a table in the first document as an example, assuming that the width of the table is a, the height is b, and the display width is c. If c is greater than or equal to a, the table does not need to be scaled; if c is less than a, if the table is not scaled, the table will exceed the display range of the terminal device, so it is necessary to scale the table according to the display width c.

[0119] The requirement for scaling is that the width of the table after scaling must be less than or equal to c. For example, if the width of the table after scaling is c, the scaling ratio of the table is c / a. After scaling the table with a width of a according to the scaling ratio c / a, the width is updated to c.

[0120] After scaling the width of the table, in order to ensure that the display effect of the table remains roughly unchanged, the height of the table also needs to be scaled according to the same scaling ratio. Taking the scaling ratio as c / a as an example, the height of a table with a height of b is updated to bc / a after scaling. Therefore, the aspect ratio of the table after scaling remains the same as that before scaling, and the presentation effect of the table will not be greatly affected.

[0121] In the above embodiment, the streaming typesetting processing of the table is introduced when there is a table in the first document. It can be understood that when there is an image in the first document, the processing of the image is similar to the processing of the table. The width of the table or image needs to be scaled according to the display width, and then the height of the table or image needs to be scaled accordingly according to the scaling ratio.

[0122] S23, cropping the first document after flow layout according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height.

[0123] After obtaining the first document after streaming layout, the terminal device may perform cropping processing on the first document after streaming layout according to the display height. Specifically, starting from the starting position of the first document after streaming layout, the first document after streaming layout is cropped according to the display height to obtain orderly arranged sub-pages in sequence, each sub-page having a width of the display width and a height of the display height.

[0124] The contents included in the multiple subpages are the contents included in the first document, and the arrangement order of the multiple subpages corresponds to their positions in the first document after flow typesetting.

[0125] The first document after the flow layout includes text and may also include tables or images. As for text, since the area occupied by text is usually small, when the first document after the flow layout is cropped according to the display height, if the cropping location does not involve text, it can be cropped directly. If the cropping location involves text, the text at the cropping location can be selected as an element in the next subpage.

[0126] For images, images are usually indivisible. Therefore, in the process of cropping the first document after stream typesetting according to the display height, if the cropping location involves an image, it is necessary to comprehensively determine whether to place the entire image on the previous subpage as an element in the previous subpage, or to place the entire image on the next subpage as an element in the next subpage. For example, one possible implementation method is to determine the size of the area of ​​the image above the cropping location and the area below the cropping location. If the area of ​​the image above the cropping location is larger, the image is used as an element in the previous subpage. If the area of ​​the image below the cropping location is larger, the image is used as an element in the next subpage.

[0127] For a table, it is composed of multiple cells. Some cells are inseparable, such as merged cells, background common cells, etc., while some cells can be divided. Therefore, when the cropping location involves a table, you can find the location where the cells can be divided according to the location of the cropping location in the table and divide the table.

[0128] S24, displaying the first document on a terminal device according to the plurality of orderly arranged sub-pages.

[0129] After obtaining a plurality of orderly arranged sub-pages, the first document can be displayed on the terminal device according to the plurality of orderly arranged sub-pages. Among them, a certain sub-page is displayed at any time, and after the user finishes reading the current sub-page, the terminal device can be controlled to display the previous sub-page or the next sub-page through corresponding operations. Since the width and height of any sub-page are adapted to the terminal device, it can support both the up-down page turning reading mode and the left-right page turning reading mode.

[0130] The layout document display method provided in the embodiment of the present application is applied to a terminal device. First, the terminal device determines the display width and display height corresponding to the first document according to its own screen size, and then performs streaming typesetting processing on the first document according to the display width to obtain the first document after streaming typesetting. The width of the first document after streaming typesetting is the display width; then, the first document after streaming typesetting is cropped according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document. Since the width of the first document after streaming typesetting is the display width, the width of any sub-page obtained after cropping is also the display width. And since it is cropped according to the display height, the height of any sub-page is also the display height, and the arrangement order of the plurality of sub-pages corresponds to their positions in the first document after streaming typesetting. Finally, the first document is displayed on the terminal device according to the plurality of orderly arranged sub-pages. Since the width of any subpage is the display width, and the height of any subpage is the display height, and both the display width and the display height are determined according to the screen size of the terminal device, they can be well adapted to the terminal device, and neither the height of the subpage is greater than the screen height of the terminal device, so that the terminal device screen cannot present all the contents of the subpage, nor the width of the subpage is too smaller than the screen height of the terminal device, so that a large blank area appears on the terminal device screen. Since the width and height of any subpage are adapted to the terminal device, both the up-down page turning reading mode and the left-right page turning reading mode can be supported, which provides convenience for users to read the first document.

[0131] Based on any of the above embodiments, the solution of the present application is described in detail below in conjunction with the accompanying drawings.

[0132] After determining the display width and the display height, the terminal device performs streaming typesetting on the first document according to the display width to obtain the first document after streaming typesetting. Specifically, the terminal device recalculates the coordinates of each element in the first document according to the coordinates of each element in the first document and the display width, thereby generating the first document after streaming typesetting.

[0133] Since the width of the first document and the display width may be different, the elements in the first document may be scaled during the flow typesetting of the first document. For example, for the text in the first document, all the text may be scaled by a certain ratio, wherein the scaling ratio may be determined based on factors such as the display width and the width of the first document, the size of the text displayed on the terminal device, and the like.

[0134] If the first document includes a picture, the picture may also be scaled by a certain ratio, and the scaling ratio may be consistent with the scaling ratio of the text, or may be different from the scaling ratio of the text.

[0135] If the first document includes a table, the table can also be scaled by a certain ratio, and the scaling ratio can be determined based on the display width and the width of the original table. For example, the scaling ratio can be determined as the ratio of the display width to the width of the original table, and then the table is scaled and rearranged according to the scaling ratio. The height of the cells in the reformatted table may change, and for any table row, the maximum cell height in the table row can be used as the row height of the table row. Among them, the range of variation of the row height of the table row can be set. For example, the row height of the reformatted table row cannot exceed 3 times the original row height. If it exceeds 3 times the original row height, the table row is scaled proportionally, and the row height of the scaled table row is 3 times the original row height, and so on.

[0136] After obtaining the first document after the streaming layout, the terminal device performs the following first operation to implement the cropping process of the first document after the streaming layout:

[0137] When the height of the document after the i-1th round of cropping is greater than the display height, the document after the i-1th round of cropping is cropped according to the display height to generate the i-th subpage and the document after the i-th round of cropping;

[0138] Here, i is 1, 2, ..., and the document after the 0th round of cropping is the first document after streaming typesetting.

[0139] Specifically, when the height of the first document after flow typesetting is greater than the display height, the first document after flow typesetting is cropped according to the display height to generate the first subpage and the document after the first round of cropping; when the height of the document after the first round of cropping is greater than the display height, the document after the first round of cropping is cropped according to the display height to generate the second subpage and the document after the second round of cropping...

[0140] The first operation is repeatedly performed until the height of the newly generated document after the i-th round of cropping is less than or equal to the display height, the cropping process is stopped, and the generated multiple orderly arranged sub-pages are output. It should be noted that if the i-th sub-page generated after the last round of cropping and the document after the i-th round of cropping do not include any display content in the document after the i-th round of cropping, the i-th sub-page generated after the last round of cropping is used as the last sub-page; if the document after the i-th round of cropping includes display content, the i-th sub-page generated after the last round of cropping is used as the second to last sub-page, and the document after the i-th round of cropping is used as the last sub-page.

[0141] Through the above-mentioned multiple rounds of cropping process, multiple sub-pages with width and height that are adapted to the screen size of the terminal device can be obtained, which is helpful for presenting the first document on the terminal device and can support presenting the first document in different reading modes such as turning pages up and down and turning pages left and right.

[0142] In the above embodiment, the overall cropping process for the first document after stream typesetting is introduced. The overall cropping process includes multiple rounds of cropping processing. Figure 3 This section describes how to implement any round of clipping.

[0143] Figure 3 A schematic diagram of a process flow of a round of cropping processing provided in an embodiment of the present application, such as Figure 3 As shown, including:

[0144] S31, determining a cropping line corresponding to the document after the (i-1)th round of cropping according to the display height.

[0145] Since the document after the i-1th round of cropping is cropped according to the display height, the height of the newly generated i-th sub-page is the display height. Therefore, after the terminal device determines the starting line of the document after the i-1th round of cropping, it can determine the cropping line corresponding to the document after the i-1th round of cropping based on the starting line of the document after the i-1th round of cropping and the display height, and the document after the i-1th round of cropping can be cropped according to the corresponding cropping line.

[0146] This process can be combined with Figure 4 To understand. Figure 4 A schematic diagram of determining a cutting line provided in an embodiment of the present application, such as Figure 4 As shown, a scheme for determining the cropping line for three different documents is exemplified. The three documents are document 41, document 42 and document 43, and the display height is h.

[0147] like Figure 4 As shown, according to the starting line 411 and the display height h of the document 41, the cropping line 412 of the document 41 can be determined, and the distance between the starting line 411 and the cropping line 412 is h. Similarly, according to the starting line 421 and the display height h of the document 42, the cropping line 422 of the document 42 can be determined, and the distance between the starting line 421 and the cropping line 422 is h. According to the starting line 431 and the display height h of the document 43, the cropping line 432 of the document 43 can be determined, and the distance between the starting line 431 and the cropping line 432 is h.

[0148] S32, determining the relationship between each element and the cropping line according to the position of each element in the document after the i-1th round of cropping; wherein the relationship between any element and the cropping line is: located before the cropping line, intersecting with the cropping line, and located after the cropping line.

[0149] After determining the cropping line corresponding to the document after the i-1th round of cropping, it is necessary to further determine the relationship between each element and the cropping line according to the position of each element in the document after the i-1th round of cropping, so that the document after the i-1th round of cropping can be cropped based on the cropping line. In the embodiment of the present application, the relationship between any element in the document after the i-1th round of cropping and the cropping line is one of being located before the cropping line, intersecting with the cropping line, and being located after the cropping line.

[0150] For example, Figure 4 In the figure, for document 41, “hoeing the field at noon” and the elements before it are elements before the crop line 412, “sweat dripping on the soil under the field” is an element intersecting with the crop line 412, and “who knows what’s on the plate” and the elements after it are elements after the crop line; for document 42, “the farmer is still starving to death” and the elements before it are elements before the crop line 422, and the picture is an element intersecting with the crop line 422; for document 43, “the farmer is still starving to death” and the elements before it are elements before the crop line 432, and the table is an element intersecting with the crop line 432.

[0151] S33, determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the relationship between each element and the cropping line and the type of each element.

[0152] If the document after the i-1th round of cropping does not include elements intersecting the cropping line, then the elements in the document after the i-1th round of cropping that are located before the cropping line are directly determined as the content of the i-th sub-page, and the elements in the document after the i-1th round of cropping that are located after the cropping line are directly determined as the content of the document after the i-1th round of cropping.

[0153] If the document after the i-1th round of cropping includes elements that intersect with the cropping line, it is necessary to determine the content in the i-th subpage and the content in the document after the i-th round of cropping based on the relationship between each element and the cropping line and the type of each element. In the embodiment of the present application, the type of element is one of text, picture, and table. Different types of elements are introduced below.

[0154] If the element intersecting the cropping line is text, the terminal device determines the elements before the cropping line in the document after the i-1th round of cropping as the content in the i-th subpage, and determines the elements intersecting the cropping line and the elements after the cropping line as the content in the document after the i-1th round of cropping.

[0155] For example, Figure 4In the example, for document 41, the element intersecting with the cropping line 412 is text, then the terminal device determines the element before the cropping line 412 as the content in the i-th subpage, and determines the element intersecting with the cropping line 412 and the element after the cropping line 412 as the content in the document after the i-th round of cropping.

[0156] If the element intersecting with the cropping line is a picture, the picture will be divided as a whole into the i-th sub-page or the document after the i-th round of cropping, because the splitting of the picture will affect the display effect of the picture. It needs to be determined based on the position of the picture, that is, the terminal device determines the content in the i-th sub-page and the content in the document after the i-th round of cropping based on the position of the cropping line on the picture.

[0157] Specifically, the terminal device first determines the distance from the top of the picture to the cropping line, and the distance from the bottom of the picture to the cropping line, and determines the division of the picture according to these two distances.

[0158] If the distance from the top of the image to the cropping line is greater than or equal to the distance from the bottom of the image to the cropping line, the elements before the cropping line in the document after the i-1th round of cropping are determined as the content of the i-th subpage, and the image and the elements after the cropping line are determined as the content of the document after the i-1th round of cropping.

[0159] If the distance from the top of the image to the cropping line is less than the distance from the bottom of the image to the cropping line, the terminal device will determine the elements and images before the cropping line in the document after the i-1th round of cropping as the content of the i-th sub-page, and will determine the elements after the cropping line as the content of the document after the i-1th round of cropping.

[0160] Combine the following Figure 5 Make an introduction. Figure 5 The document cutting diagram provided in the embodiment of the present application is as follows: Figure 5 As shown, for document 50 , the cropping line corresponding to document 50 is cropping line 51 , and image 52 intersects with cropping line 51 .

[0161] Therefore, the terminal device first determines the top 521 and the bottom 522 of the image 52 , and then determines the distance h1 from the top 521 to the cropping line 51 , and the distance h2 from the bottom 522 to the cropping line 51 .

[0162] Then, the terminal device compares h1 with h2. If h1 is greater than or equal to h2, the image 52 is divided into the document after the i-th round of cropping. If h1 is less than h2, the image 52 is divided into the i-th subpage.

[0163] In view of the situation where there are images in the document that intersect with the cropping line, the solution of the embodiment of the present application divides the image based on the distance from the bottom and top of the image to the cropping line respectively. When most of the image is above the cropping line, the image is divided into the i-th sub-page located above. When most of the image is below the cropping line, the image is divided into the i-th cropped document located below, thereby achieving more reasonable cropping of the image.

[0164] In the above embodiment, a cropping solution is introduced when the elements intersecting the cropping line are texts and pictures. The following describes a cropping solution when the elements intersecting the cropping line are tables.

[0165] Tables are different from texts and pictures. After being split or truncated, texts and pictures will have a great impact on the display effect, while after being split or truncated, the display effect will be less affected. Therefore, tables can be split under certain conditions.

[0166] If the element intersecting the cropping line is a table, the terminal device determines the content of the i-th subpage and the content of the document after the i-th round of cropping according to the target table row where the cropping line is located on the table. Figure 6 This section introduces the process.

[0167] Figure 6 A schematic diagram of the process of table cutting provided in the embodiment of the present application is shown in FIG. Figure 6 As shown, including:

[0168] S61, determining a table dividing line according to the attribute information of the target table row.

[0169] The target table row is the row where the cropping line is located on the table, wherein the cropping line can be located at the top of the target table row, at the bottom of the target table row, or between the top and the bottom of the target table row. After the target table row is determined according to the cropping line, the table splitting line can be determined according to the attribute information of the target table row, and the table splitting line is used to split the table.

[0170] Figure 7 A schematic diagram of determining a dividing line of a table provided in an embodiment of the present application, such as Figure 7 As shown, the cutting line intersects with the table 70 in the document after the (i-1)th round of cutting. Therefore, it is necessary to determine the table dividing line according to the attribute information of the target table row where the cutting line is located on the table 70.

[0171] The attribute information of the target table row mainly refers to whether each cell in the target table row is a top-bottom merged cell or a background common cell.

[0172] Merged cells refer to cells that are merged from two different positions. One way to determine whether there are merged cells in the target table row is to obtain the height of each cell in the target table row and determine whether the heights of each cell in the target table row are the same. If so, it means that there are no merged cells in the target table row. If not, it means that there are merged cells in the target table row.

[0173] Background common cells refer to the situation where two or more cells have a common background. One implementation method for determining whether a cell is a background common cell is to identify the location of the background in the document, thereby determining the cells involved in the background according to the location of the background, and then determining whether the corresponding cell has a common background with other cells, thereby determining whether the corresponding cell is a background common cell.

[0174] exist Figure 7 In the example, the scenario where the target table row does not include upper and lower merged cells and background common cells, and the scenario where the target table row includes upper and lower merged cells or background common cells, how to determine the dividing line is illustrated.

[0175] like Figure 7 For example, if the cutting line is Figure 7 If the cropping line 71 in the table is , the target table row is row B, and row B does not include upper and lower merged cells and background common cells, then the top table line of row B is determined as the dividing line of the table.

[0176] like Figure 7 For example, if the cutting line is Figure 7 If the target table row is row D, and row D includes upper and lower merged cells or background common cells, then the associated table rows that do not include upper and lower merged cells or background common cells are determined in the table; the dividing line is determined according to the distance from the associated table row to the cropping line.

[0177] Specifically, in the case where the target table row includes upper and lower merged cells or background common cells, a table row without upper and lower merged cells or background common cells is searched above the target table row, and the table row closest to the target table row among the table rows without upper and lower merged cells or background common cells is determined as the first associated table row, and the distance from the bottom of the first associated table row to the cropping line is calculated, which is recorded as d1. Figure 7 As shown in , the first association table row is row C, and the distance between the bottom of row C and the cutting line 72 is d1.

[0178] Then, find a table row below the target table row that does not have upper and lower merged cells and background common cells, and determine the table row closest to the target table row among the table rows that do not have upper and lower merged cells and background common cells as the second associated table row, and calculate the distance from the bottom of the second associated table row to the cropping line, which is recorded as d2. Figure 7 As shown in , the first association table row is row E, and the distance between the bottom of row E and the cutting line 72 is d2.

[0179] If d1 is less than or equal to d2, the top of the first associated table row is determined as the dividing line of the table; if d1 is greater than d2, the bottom of the second associated table row is determined as the dividing line of the table.

[0180] For the situation where the target table row includes upper and lower merged cells or background common cells, the solution provided in the embodiment of the present application determines the table dividing line by finding the associated table rows that do not include the upper and lower merged cells or the background common cells, and based on the distance from the associated table rows to the cropping line, it is possible to achieve table segmentation while avoiding cropping of the upper and lower merged cells or the background common cells, thereby retaining the style of the original table to the greatest extent, reducing the impact of the cropping process on the presentation of the table, and improving the display effect of the table.

[0181] S62, dividing the table according to the dividing line to obtain a first sub-table and a corresponding second sub-table corresponding to the table.

[0182] After determining the dividing line of the table, the table can be divided according to the dividing line, and the part of the table before the dividing line is determined as the first sub-table. In one implementation, if d1 is greater than d2, the first sub-table can be compressed according to the aspect ratio, and the compression value is d2 / d3, where d3 is the distance from the bottom of the second associated table row to the top of the table. By compressing the first sub-table, it can be ensured that the height corresponding to the content in the i-th sub-page is the display height, so there is no need to scale other content in the i-th sub-page, thereby ensuring the display effect of other content in the i-th sub-page.

[0183] In one implementation, the terminal device may directly use the portion of the table after the dividing line as the second sub-table, thereby achieving the division of the table.

[0184] In another implementation, if the table header is located in the first subtable, a second subtable header can be generated based on the table header for the portion of the table after the dividing line, and the second subtable can be generated in combination with the portion of the table after the dividing line.

[0185] Specifically, the terminal device determines the header of the second sub-table according to the attribute information of the header in the table, the type of the table, and at least one of the historical user data.

[0186] The attribute information of the header may include, for example, the font of the header, the background of the header, the number of rows of the header, etc. The header of the second subtable may be determined based on the attribute information of the header. For example, if the table has an obvious header (such as a bold header font or a darker header background color), or the number of header rows is less than or equal to two rows and the number of table row data rows included in the table is greater than 10 rows, then the header of the second subtable needs to be generated based on the header of the table and added to the second subtable. For example, if the table does not have an obvious header, there is no need to add a header to the second subtable, and the header of the second subtable is empty.

[0187] The header of the second subtable can be determined according to the type of table. For example, if the table involves data statistics and the number of cells in the table is large, the header of the second subtable needs to be generated according to the header of the table to facilitate users to view and compare the data in the second subtable. If the number of cells in the table is small, there is no need to add a header to the second subtable, and the header of the second subtable is empty.

[0188] The header of the second subtable can also be determined based on the historical user data stored in the terminal device. For example, based on the historical user data, the terminal device learns that the user often takes the "freeze header" operation, which shows that the user has a high dependence on the header. At this time, it is necessary to generate the header of the second subtable based on the header of the table to facilitate the user to view the second subtable. Otherwise, there is no need to add a header to the second subtable, and the header of the second subtable is empty.

[0189] In the above embodiments, the terminal device determines the header of the second subtable based on the attribute information of the header, the type of the table, and the historical user data. The terminal device can also determine the header of the second subtable based on multiple information in the above information. For example, the attribute information of the header, the type of the table, and the historical user data can be given certain weights, and then the score is calculated based on the attribute information of the header, the type of the table, the historical user data, and the corresponding weight value, and whether to add a header to the second subtable is determined based on the comparison result of the score and the preset threshold.

[0190] If it is determined that the header of the second subtable is not empty, that is, it is determined that a header needs to be added to the second subtable, the header of the table can be obtained and then added to the corresponding position in the second subtable.

[0191] After determining the header of the second subtable, the terminal device determines the second subtable according to the header of the second subtable and the portion of the table after the dividing line.

[0192] S63: Determine the elements before the cropping line in the document after the (i-1)th round of cropping, and the first subtable as the content in the i-th subpage.

[0193] S64, determining the elements after the cropping line in the document after the i-1th round of cropping and the second subtable as the content in the document after the i-th round of cropping.

[0194] After generating the first sub-table and the second sub-table, the terminal device determines the elements before the cropping line in the document after the i-1th round of cropping, and the first sub-table, as the content in the i-th sub-page, and determines the elements after the cropping line in the document after the i-1th round of cropping, and the second sub-table, as the content in the document after the i-1th round of cropping.

[0195] Figure 8 A schematic diagram of a cropped document provided in an embodiment of the present application, such as Figure 8 As shown, after the document 80 after the i-1th round of cropping is cropped, the content in the i-th subpage and the content in the document after the i-th round of cropping can be obtained. Among them, the content 81 in the i-th subpage includes the elements before the cropping line in the document 80 after the i-1th round of cropping, and the first subtable; the content 82 in the document after the i-1th round of cropping includes the elements after the cropping line in the document 80 after the i-1th round of cropping, and the second subtable. If it is determined that the header of the second subtable needs to be supplemented according to the attribute information of the header in the table, the type of the table, and at least one of the historical user data, the headers such as "name", "category", "code", "number", and "quantity" can be supplemented in the corresponding position in the second subtable, so as to facilitate viewing of the content in the second subtable.

[0196] S34, generating the i-th sub-page and the document after the i-th round of cropping according to the content in the i-th sub-page and the content in the document after the i-th round of cropping.

[0197] Specifically, the terminal device scales the content in the ith subpage according to the height corresponding to the content in the ith subpage and the display height to generate the ith subpage, and then generates the document after the ith round of cropping according to the content in the document after the ith round of cropping.

[0198] For the case where the document after the i-1th round of cropping does not include elements intersecting the cropping line, since the height corresponding to the content in the i-th sub-page obtained by cropping in this case is the display height, there is no need to scale the content in the i-th sub-page, or to scale the content in the i-th sub-page 1:1 to generate the i-th sub-page.

[0199] In the case where the document after the i-1th round of cropping includes elements that intersect with the cropping line, and the elements that intersect with the cropping line are texts, since the height occupied by a line of text is relatively small, the content in the i-th subpage can be scaled 1:1 to generate the i-th subpage. The scaling ratio can also be determined based on the height corresponding to the content in the i-th subpage and the display height, so that the content in the i-th subpage is scaled 1:1 to generate the i-th subpage, and the height of the generated i-th subpage is the display height.

[0200] For the case where the document after the i-1th round of cropping includes elements intersecting with the cropping line, and the elements intersecting with the cropping line are pictures, the terminal device can determine the scaling ratio according to the height corresponding to the content in the i-th subpage and the display height, and then scale the content in the i-th subpage according to the scaling ratio to generate the i-th subpage, and the height of the generated i-th subpage is the display height. Among them, the scaling process performed on the content in the i-th subpage can be a 1:1 scaling process, that is, the width and height are scaled in equal proportion, or it can be a scaling process that only scales the height of the content in the i-th subpage, and the embodiment of the present application does not limit this.

[0201] For example, you can combine Fig. 9 To understand. Fig. 9 A schematic diagram of zooming in on a subpage containing picture elements provided in an embodiment of the present application, such as Fig. 9 As shown, the height corresponding to the content in the ith subpage is h1, and the display height is h. If h1 is greater than h, the content in the ith subpage is scaled, and the scaling ratio is h / h1 to obtain the ith subpage. Fig. 9 In the example, the content in the ith subpage is scaled 1:1, and the height of the ith subpage obtained after the scaling is the display height. In the case where h1 is smaller than h, the ith subpage can be obtained without scaling the content in the ith subpage.

[0202] For the case where the document after the i-1th round of cropping includes an element intersecting the cropping line, and the element intersecting the cropping line is a table, the terminal device can determine the scaling ratio according to the height corresponding to the content in the i-th subpage and the display height, thereby performing a 1:1 scaling process on the content in the i-th subpage to generate the i-th subpage, and the height of the generated i-th subpage is the display height. Fig.10 To understand.

[0203] Fig.10 A schematic diagram of zooming in on a subpage containing table elements provided in an embodiment of the present application, such as Fig.10As shown, the height corresponding to the content in the ith subpage is h2, and the display height is h. If h2 is greater than h, the content in the ith subpage is scaled, and the scaling ratio is h / h2 to obtain the ith subpage. If h2 is less than h, the content in the ith subpage does not need to be scaled to obtain the ith subpage.

[0204] After the first document is cropped to generate a plurality of orderly arranged sub-pages, the first document can be displayed on the terminal device according to the plurality of orderly arranged sub-pages. Fig.11 A schematic diagram of a page turning reading mode provided in an embodiment of the present application is shown in FIG. Fig.12 A schematic diagram of a left-right page turning reading mode provided in an embodiment of the present application is shown in FIG. Fig.11 and Fig.12 As shown, since the display width and display height of any subpage are adapted to the screen size of the terminal device, it can be applied to both the up-down page turning reading mode and the left-right page turning reading mode.

[0205] The layout document display device provided by the present application is described below. The layout document display device described below and the layout document display method described above can be referenced to each other.

[0206] Fig.13 The schematic diagram of the structure of the layout document display device provided in the embodiment of the present application is applied to a terminal device, such as Fig.13 As shown, the device comprises:

[0207] A determination module 131, configured to determine a display width and a display height corresponding to a first document according to a screen size of the terminal device, wherein the first document is a layout document;

[0208] A first processing module 132, configured to perform stream layout processing on the first document according to the display width to obtain a first document after stream layout;

[0209] The second processing module 133 is used to perform a cropping process on the first document after the stream layout according to the display height, and generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height;

[0210] The display module 134 is configured to display the first document on the terminal device according to the plurality of sequentially arranged sub-pages.

[0211] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0212] Executing a first operation, the first operation comprising: when the height of the document after the i-1th round of cropping is greater than the display height, cropping the document after the i-1th round of cropping according to the display height to generate an i-th sub-page and the document after the i-th round of cropping;

[0213] Here, the i is 1, 2, ... in sequence, and the document after the 0th round of cropping is the first document after the streaming typesetting.

[0214] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0215] Determining a cutting line corresponding to the document after the i-1th round of cutting according to the display height;

[0216] According to the positions of the elements in the document after the i-1th round of cropping, the relationship between the elements and the cropping line is determined; wherein the relationship between any element and the cropping line is one of: being located before the cropping line, intersecting the cropping line, and being located after the cropping line;

[0217] Determine the content in the i-th subpage and the content in the document after the i-th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements;

[0218] The i-th sub-page and the document after the i-th round of cropping are generated according to the content in the i-th sub-page and the content in the document after the i-th round of cropping.

[0219] In a possible implementation manner, the document after the (i-1)th round of cropping includes elements intersecting with the cropping line; and the second processing module 133 is specifically configured to:

[0220] If the element intersecting the cropping line is text, the element before the cropping line in the document after the (i-1)-th round of cropping is determined as the content in the i-th subpage, and the element intersecting the cropping line and the element after the cropping line are determined as the content in the document after the i-th round of cropping;

[0221] If the element intersecting the cropping line is a picture, then determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the position of the cropping line on the picture;

[0222] If the element intersecting the cropping line is a table, the content in the i-th subpage and the content in the document after the i-th round of cropping are determined according to the target table row where the cropping line is located on the table.

[0223] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0224] Determining a dividing line of the table according to the attribute information of the target table row;

[0225] The table is divided according to the dividing line to obtain a first sub-table and a second sub-table corresponding to the table;

[0226] Determine the elements before the cropping line in the document after the (i-1)th round of cropping, and the first subtable as the content in the i-th subpage;

[0227] The elements after the cropping line in the document after the (i-1)th round of cropping and the second subtable are determined as the content in the document after the (i)th round of cropping.

[0228] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0229] If the target table row does not include upper and lower merged cells and background common cells, the top table line of the target table row is determined as the dividing line;

[0230] If the target table row includes the upper and lower merged cells or the background common cells, then determine the associated table rows in the table that do not include the upper and lower merged cells and the background common cells; and determine the segmentation line according to the distance from the associated table row to the cropping line.

[0231] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0232] Determine the portion of the table before the dividing line as the first subtable;

[0233] determining a header of the second subtable according to at least one of attribute information of the header in the table, the type of the table, and historical user data;

[0234] The second sub-table is determined according to the table header of the second sub-table and the portion of the table after the dividing line.

[0235] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0236] Determine the distance from the top of the picture to the cropping line, and the distance from the bottom of the picture to the cropping line;

[0237] If the distance from the top of the image to the cropping line is greater than or equal to the distance from the bottom of the image to the cropping line, then the elements before the cropping line in the document after the (i-1)-th round of cropping are determined as the content in the i-th subpage, and the image and the elements after the cropping line are determined as the content in the document after the i-th round of cropping;

[0238] If the distance from the top of the image to the cropping line is less than the distance from the bottom of the image to the cropping line, the elements before the cropping line and the image in the document after the i-1th round of cropping are determined as the content of the i-th sub-page, and the elements after the cropping line are determined as the content of the document after the i-1th round of cropping.

[0239] In a possible implementation manner, the second processing module 133 is specifically configured to:

[0240] Scaling the content in the ith subpage according to the height corresponding to the content in the ith subpage and the display height to generate the ith subpage;

[0241] The document after the i-th round of cropping is generated according to the content in the document after the i-th round of cropping.

[0242] The layout document display device provided in the embodiment of the present application is used to execute the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0243] Fig.14 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.14 As shown, the electronic device may include: a processor 1410, a communication interface 1420, a memory 1430 and a communication bus 1440, wherein the processor 1410, the communication interface 1420 and the memory 1430 communicate with each other through the communication bus 1440. The processor 1410 may call the logic instructions in the memory 1430 to execute the layout document display method, which is applied to the terminal device, and the method includes: determining the display width and display height corresponding to the first document according to the screen size of the terminal device, the first document being a layout document; performing stream typesetting processing on the first document according to the display width to obtain the first document after stream typesetting; performing cropping processing on the first document after stream typesetting according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document, the width of any sub-page being the display width, and the height of any sub-page being the display height; and displaying the first document on the terminal device according to the plurality of orderly arranged sub-pages.

[0244] In addition, the logic instructions in the above-mentioned memory 1430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0245] On the other hand, the present application also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the layout document display method provided by the above-mentioned methods, which is applied to a terminal device. The method includes: determining the display width and display height corresponding to a first document according to the screen size of the terminal device, and the first document is a layout document; performing streaming layout processing on the first document according to the display width to obtain the first document after streaming layout; cropping the first document after streaming layout according to the display height to generate multiple ordered sub-pages corresponding to the first document, the width of any sub-page being the display width, and the height of any sub-page being the display height; and displaying the first document on the terminal device according to the multiple ordered sub-pages.

[0246] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the layout document display method provided by the above-mentioned methods, and is applied to a terminal device, the method comprising: determining a display width and a display height corresponding to a first document according to a screen size of the terminal device, the first document being a layout document; performing streaming layout processing on the first document according to the display width to obtain a first document after streaming layout; performing cropping processing on the first document after streaming layout according to the display height to generate a plurality of ordered sub-pages corresponding to the first document, the width of any sub-page being the display width, and the height of any sub-page being the display height; and displaying the first document on the terminal device according to the plurality of ordered sub-pages.

[0247] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0248] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0249] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A layout document display method, It is characterized in that Applied to a terminal device, the method comprises: Determining a display width and a display height corresponding to a first document according to a screen size of the terminal device, wherein the first document is a layout document; Performing a flow layout process on the first document according to the display width to obtain a first document after the flow layout; The first document after the flow typesetting is cropped according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height; The first document is displayed on the terminal device according to the plurality of sub-pages arranged in order.

2. The method according to claim 1, It is characterized in that The step of performing a cropping process on the first document after the flow typesetting according to the display height to generate a plurality of orderly arranged sub-pages corresponding to the first document includes: Executing a first operation, the first operation comprising: when the height of the document after the i-1th round of cropping is greater than the display height, cropping the document after the i-1th round of cropping according to the display height to generate an i-th sub-page and the document after the i-th round of cropping; Here, the i is 1, 2, ... in sequence, and the document after the 0th round of cropping is the first document after the streaming typesetting.

3. The method according to claim 2, It is characterized in that The step of performing cropping processing on the document after the i-1th round of cropping according to the display height to generate the i-th subpage and the document after the i-th round of cropping includes: Determining a cutting line corresponding to the document after the i-1th round of cutting according to the display height; According to the positions of the elements in the document after the i-1th round of cropping, the relationship between the elements and the cropping line is determined; wherein the relationship between any element and the cropping line is one of: being located before the cropping line, intersecting the cropping line, and being located after the cropping line; Determine the content of the i-th subpage and the content of the document after the i-th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements; The i-th sub-page and the document after the i-th round of cropping are generated according to the content in the i-th sub-page and the content in the document after the i-th round of cropping.

4. The method according to claim 3, It is characterized in that The document after the i-1th round of cropping includes elements intersecting with the cropping line; and determining the content in the i-th subpage and the content in the document after the i-1th round of cropping according to the relationship between each of the elements and the cropping line and the type of each of the elements, comprises: If the element intersecting the cropping line is text, the element before the cropping line in the document after the (i-1)-th round of cropping is determined as the content in the i-th subpage, and the element intersecting the cropping line and the element after the cropping line are determined as the content in the document after the i-th round of cropping; If the element intersecting the cropping line is a picture, then determining the content in the i-th subpage and the content in the document after the i-th round of cropping according to the position of the cropping line on the picture; If the element intersecting the cropping line is a table, the content in the i-th subpage and the content in the document after the i-th round of cropping are determined according to the target table row where the cropping line is located on the table.

5. The method according to claim 4, It is characterized in that The determining, according to the target table row where the cropping line is located on the table, the content in the i-th subpage and the content in the document after the i-th round of cropping includes: Determining a dividing line of the table according to the attribute information of the target table row; The table is divided according to the dividing line to obtain a first sub-table and a second sub-table corresponding to the table; Determine the elements before the cropping line in the document after the (i-1)th round of cropping, and the first subtable as the content in the i-th subpage; The elements after the cropping line in the document after the (i-1)th round of cropping and the second subtable are determined as the content in the document after the (i)th round of cropping.

6. The method according to claim 5, It is characterized in that The step of determining the partition line of the table according to the attribute information of the target table row includes: If the target table row does not include upper and lower merged cells and background common cells, the top table line of the target table row is determined as the dividing line; If the target table row includes the upper and lower merged cells or the background common cells, then determine the associated table rows in the table that do not include the upper and lower merged cells and the background common cells; and determine the segmentation line according to the distance from the associated table row to the cropping line.

7. The method according to claim 5, It is characterized in that The step of segmenting the table according to the segmentation line to obtain a first sub-table and a second sub-table corresponding to the table includes: Determine the portion of the table before the dividing line as the first subtable; determining a header of the second subtable according to attribute information of the header in the table, a type of the table, and at least one of historical user data; The second sub-table is determined according to the table header of the second sub-table and the portion of the table after the dividing line.

8. The method according to claim 4, It is characterized in that The determining, according to the position of the cropping line on the image, the content in the i-th subpage and the content in the document after the i-th round of cropping includes: Determine the distance from the top of the picture to the cropping line, and the distance from the bottom of the picture to the cropping line; If the distance from the top of the image to the cropping line is greater than or equal to the distance from the bottom of the image to the cropping line, then the elements before the cropping line in the document after the (i-1)-th round of cropping are determined as the content in the i-th subpage, and the image and the elements after the cropping line are determined as the content in the document after the i-th round of cropping; If the distance from the top of the image to the cropping line is less than the distance from the bottom of the image to the cropping line, the elements before the cropping line and the image in the document after the i-1th round of cropping are determined as the content of the i-th sub-page, and the elements after the cropping line are determined as the content of the document after the i-1th round of cropping.

9. The method according to any one of claims 3 to 8, It is characterized in that The step of generating the i-th sub-page and the document after the i-th round of cropping according to the content in the i-th sub-page and the content in the document after the i-th round of cropping includes: Scaling the content in the ith subpage according to the height corresponding to the content in the ith subpage and the display height to generate the ith subpage; The document after the i-th round of cropping is generated according to the content in the document after the i-th round of cropping.

10. A layout document display device, It is characterized in that Applied to a terminal device, the device comprises: A determination module, configured to determine a display width and a display height corresponding to a first document according to a screen size of the terminal device, wherein the first document is a layout document; A first processing module, configured to perform stream layout processing on the first document according to the display width to obtain a first document after stream layout; A second processing module is used to perform a cropping process on the first document after the stream layout according to the display height, to generate a plurality of orderly arranged sub-pages corresponding to the first document, wherein the width of any sub-page is the display width, and the height of any sub-page is the display height; A display module is configured to display the first document on the terminal device according to the plurality of orderly arranged sub-pages.