A preview method and device based on dynamic area Excel content

By finding or generating Excel content pictures on demand when previewing Excel files on the web side, and combining displays, the problem of poor Excel content preview effect in the prior art is solved, and the adaptability and user experience of preview are improved.

CN119106669BActive Publication Date: 2025-06-06GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411136207.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-06-06
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

When previewing Excel files on the web side, the prior art can easily lead to content being cropped and paging, display incoherent, and loading time for a long time, affecting the user experience.

Method used

By obtaining the user's preview area, we judge whether the database has generated Excel content images, and if they exist, they will be displayed directly; otherwise, we will find the matching Excel cell data, render and split, generate several matching Excel content images, and save them in the database, and finally display these pictures in the preview area.

Benefits of technology

It significantly alleviates the rendering pressure on the server, avoids the problem of Excel content being cropped and paging, improves the web-side preview adaptability to Excel, shortens loading time, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106669B_ABST
    Figure CN119106669B_ABST
Patent Text Reader

Abstract

The present invention relates to a preview method based on dynamic area Excel content, comprising: S1: obtaining user request information of a previewed area to be generated; S2: judging whether a database has a generated Excel content picture according to the user request information of the previewed area to be generated: if yes, obtaining the generated Excel content picture, and executing step S5; if not, searching according to the previewed area to be generated to obtain matching Excel cell data; S4: performing rendering and splitting according to the matching Excel cell data, generating a plurality of matching Excel content pictures, and saving them in a database; S5: sorting and combining the plurality of matching Excel content pictures, and displaying them in the previewed area to be generated. The preview method based on dynamic area Excel content of the present invention generates matching Excel content pictures by searching a database cache on demand or performing rendering and splitting on demand, so as to significantly alleviate the rendering pressure of a server end and improve the adaptability of a Web end to Excel preview.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Web technology and document processing technology, and in particular to a preview method, device, electronic equipment and computer storage medium based on dynamic area Excel content. Background Art

[0002] Today, the Internet is becoming more and more popular, especially the use scenarios of the Web are becoming more and more extensive. Existing technologies already exist to upload various types of documents to the Web and allow users to preview and view the content of the documents through the Web, so as to get rid of the limitation that documents can only be previewed locally, thereby improving work efficiency and team collaboration capabilities.

[0003] When implementing a web preview of an Excel file, the Excel file is generally converted to a PDF file and the PDF file is stored on a server, so that the user can view the Excel content by previewing the PDF file on the web. However, the PDF format has a fixed width requirement. When the Excel content is converted to PDF, it often causes the Excel content to be cropped and paginated, resulting in an incoherent display of the Excel content and a poor preview effect. For details, please refer to Figure 1 .

[0004] Based on this, the prior art directly reads each cell data in the Excel file, including attributes such as format, color, font, etc., and stores it in an array, and then returns the array to the Web end (front end), so that the Web end calculates and renders an HTML table according to the cell data corresponding to the array ( ), to achieve the effect of previewing Excel on the Web. However, each time the user previews on the Web, the client needs to re-render the data, especially when there is a large amount of Excel content, which easily leads to a long loading time for the user, seriously affecting the user experience. Therefore, the Excel content display on the Web in the prior art has the problems of poor applicability and waste of computing resources. Summary of the invention

[0005] Based on this, the object of the present invention is to provide a preview method based on dynamic area Excel content.

[0006] A preview method based on dynamic area Excel content includes the following steps:

[0007] S1: Obtaining user request information of the previewed area to be generated;

[0008] S2: judging whether there is a generated Excel content picture in the database according to the user request information of the previewed area to be generated: if so, obtaining the generated Excel content picture and executing step S5; if not, executing step S3;

[0009] S3: Search according to the previewed area to be generated to obtain matching Excel cell data;

[0010] S4: Render and split according to the matched Excel cell data, generate several matched Excel content images, and save them in the database;

[0011] S5: sorting and combining a plurality of matching Excel content pictures, and displaying them in the preview area to be generated.

[0012] The preview method based on dynamic area Excel content described in the present invention generates a matching Excel content image by searching the database cache or rendering on demand, so as to significantly alleviate the rendering pressure of the server, and at the same time avoid the instantaneous pressure of the server becoming larger, which interferes with the execution of other services of the server. In addition, the present invention displays the previewed area to be generated by rendering splitting and combining display, so as to avoid the Excel content being cropped, paging, etc., and improve the adaptability of the Web end to Excel preview.

[0013] Furthermore, the step S2 includes the following sub-steps:

[0014] According to the position and size of the area to be generated, obtain the coordinates of the upper left corner of the area to be generated Area 左上角 and the lower right corner coordinates Area 右下角 , specifically satisfying the following expression:

[0015] Area 左上角 =(ΔW, ΔH)

[0016] Area 右下角 =(ΔW+W,ΔH+H)

[0017] Wherein, ΔW and ΔH represent the position of the current scroll bar of the area to be generated on the horizontal axis and the vertical axis, and W and H represent the width and height of the area to be generated;

[0018] Find out whether there is a generated Excel content image in the database that intersects with the area to be generated. If so, obtain the corresponding generated Excel content image; wherein the generated Excel content image Image satisfies the following conditions:

[0019] (ΔW≤(x 1 ,x 2)≤ΔW+W+c)and(ΔH≤(y 1 ,y 2 )≤ΔH+H+c)

[0020] In the formula, x 1 and 1 Represents the coordinates of the upper left corner of the generated Excel content image, x 2 and 2 Represents the coordinates of the lower right corner of the generated Excel content image, where c is a custom constant.

[0021] The present invention enables the system to pass (ΔW≤(x 1 ,x 2 )≤ΔW+W) and (ΔH≤(y 1 ,y 2 )≤ΔH+H) determines whether the generated Excel content image is at the intersection coordinates of the area to be generated, thereby realizing the indexing of the generated content image and directly displaying the generated Excel content image without repeated rendering, thereby improving the response speed of the system.

[0022] Furthermore, the step S4 includes the following sub-steps:

[0023] By rendering the matched Excel cell data, table data is obtained, and the table data is converted into a picture to obtain a complete Excel content picture;

[0024] According to the preset image storage size, a sliding window is used to crop the complete Excel content image to obtain several sub-images. The specific expression is:

[0025] The width and height of the complete Excel content image are W and H respectively;

[0026] The width and height of the sliding window are Δw and Δh respectively;

[0027] but:

[0028] Images = {Window (i,j) |1≤i≤m,1≤j≤n}

[0029] In the formula, Images is a collection of several sub-images, Window (i,j) The sub-image corresponding to the i-th row and j-th column of the complete Excel content image has a Window (i,j) Satisfies the following expression:

[0030] Window (i,j) =Image(x∈[α,α+Δw],y∈[β,β+Δh])

[0031] Where x∈[α,α+Δw] and y∈[β,β+Δh] represent the coordinate intervals of the horizontal and vertical pixels of the current sub-image, α and β represent the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, and n and m represent the number of times the sliding window is cropped in the horizontal and vertical directions, respectively. n satisfies the following expression:

[0032]

[0033] In the formula, Indicates rounding up calculation;

[0034] Assign corresponding serial numbers to several sub-images to obtain several matching Excel content images.

[0035] The present invention crops the complete Excel content image through a sliding window, effectively ensuring that no content is missed during the cropping process, and can effectively handle the cropping requirements of different display areas, such as: potential dynamic column widths, merged cells, and inconsistent chart embedding in Excel content, thereby ensuring integrity and splicing consistency.

[0036] Furthermore, the sliding window is an adaptive sliding window, and the Window also satisfies the following expression:

[0037] Window (i,n) =Image(x∈[α,W],y∈[β,β+Δh]),1≤i <m

[0038] Window (m,j) =Image(x∈[α,α+Δw],t∈[β,H]),1≤j <n

[0039] Window (m,n) =Image(x∈[α,W],y∈[β,H])

[0040] Where Image(·) is the pixel coordinate interval of the current sub-image in the horizontal and vertical directions, α and β are the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, n and m are the number of times the sliding window is cropped in the horizontal and vertical directions, Δw and Δh are the width and height of the sliding window, and W and H are the width and height of the complete Excel content image.

[0041] The present invention introduces an adaptive sliding window to ensure that when the horizontal and vertical edge ends of the complete Excel content picture are cropped, the sliding window can be adjusted according to actual needs and does not exceed the cropping range, thereby effectively avoiding the generation of edge blanks.

[0042] A preview device based on dynamic area Excel content, comprising a request information acquisition unit, an image cache judgment unit, an Excel cell data search unit, a picture rendering unit and a combined picture display unit;

[0043] The request information acquisition unit is used to acquire user request information of the previewed area to be generated;

[0044] The image cache judgment unit is used to judge whether there is a generated Excel content image in the database according to the user request information of the previewed area to be generated: if yes, obtain the generated Excel content image and call the combined image display unit; if no, call the Excel cell data search unit;

[0045] The Excel cell data search unit is used to search according to the previewed area to be generated to obtain matching Excel cell data;

[0046] The image rendering unit is used to perform rendering and splitting according to the matching Excel cell data, generate a number of matching Excel content images, and save them in the database;

[0047] The combined picture display unit is used to sort and combine a number of matching Excel content pictures and display them in the preview area to be generated.

[0048] Furthermore, the image cache determination unit is used to perform the following steps:

[0049] According to the position and size of the area to be generated, obtain the coordinates of the upper left corner of the area to be generated Area 左上角 and the lower right corner coordinates Area 右下角 , specifically satisfying the following expression:

[0050] Area 左上角 =(ΔW, ΔH)

[0051] Area 右下角 =(ΔW+W,ΔH+H)

[0052] Wherein, ΔW and ΔH represent the position of the current scroll bar of the area to be generated on the horizontal axis and the vertical axis, and W and H represent the width and height of the area to be generated;

[0053] Find out whether there is a generated Excel content image in the database that intersects with the area to be generated. If so, obtain the corresponding generated Excel content image; wherein the generated Excel content image Image satisfies the following conditions:

[0054] (ΔW≤(x 1 ,x2 )≤ΔW+W+c)and(ΔH≤(y 1 ,y 2 )≤ΔH+H+c)

[0055] In the formula, x 1 and 1 Represents the coordinates of the upper left corner of the generated Excel content image, x 2 and 2 Represents the coordinates of the lower right corner of the generated Excel content image, where c is a custom constant.

[0056] Furthermore, the image rendering unit is used to perform the following steps:

[0057] By rendering the matched Excel cell data, table data is obtained, and the table data is converted into a picture to obtain a complete Excel content picture;

[0058] According to the preset image storage size, a sliding window is used to crop the complete Excel content image to obtain several sub-images. The specific expression is:

[0059] The width and height of the complete Excel content image are W and H respectively;

[0060] The width and height of the sliding window are Δw and Δh respectively;

[0061] but:

[0062] Images = {Window (i,j) |1≤i≤m,1≤j≤n}

[0063] In the formula, Images is a collection of several sub-images, Window (i,j) The sub-image corresponding to the i-th row and j-th column of the complete Excel content image has a Window (i,j) Satisfies the following expression:

[0064] Window (i,j) =Image(x∈[α,α+Δw],y∈[β,β+Δh])

[0065] Where x∈[α,α+Δw] and y∈[β,β+Δh] represent the coordinate intervals of the horizontal and vertical pixels of the current sub-image, α and β represent the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, and n and m represent the number of times the sliding window is cropped in the horizontal and vertical directions, respectively. n satisfies the following expression:

[0066]

[0067] In the formula, Indicates rounding up calculation;

[0068] Assign corresponding serial numbers to several sub-images to obtain several matching Excel content images.

[0069] Furthermore, the sliding window is an adaptive sliding window, and the Window also satisfies the following expression:

[0070] Window (i,n) =Image(x∈[α,W],y∈[β,β+Δh]),1≤i <m

[0071] Window (m,j) =Image(x∈[α,α+Δw],y∈[β,H]),1≤j <n

[0072] Window (m,n) =Image(x∈[α,W],y∈[β,H])

[0073] Where Image(·) is the pixel coordinate interval of the current sub-image in the horizontal and vertical directions, α and β are the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, n and m are the number of times the sliding window is cropped in the horizontal and vertical directions, Δw and Δh are the width and height of the sliding window, and W and H are the width and height of the complete Excel content image.

[0074] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 A simple example diagram of converting Excel content to PDF;

[0076] Figure 2 This is a schematic diagram of the structure of the preview device based on the dynamic area Excel content of the present invention;

[0077] Figure 3 This is a schematic flow chart of a preview method based on dynamic area Excel content according to the present invention;

[0078] Figure 4 A simple example diagram of the process of rendering and splitting Excel cell data;

[0079] Figure 5 This is a simple example diagram showing blank areas on the edges after merging Excel content images.

[0080] Figure 6This is a simple example diagram of a merged Excel content picture with no edge blank area. DETAILED DESCRIPTION

[0081] In order to solve the problems of poor applicability and waste of computing resources in the display of Excel content on the Web side in the prior art, the present invention obtains the preview area of ​​the user, and searches the database for the generated Excel content image according to the preview area: if it exists, the matching Excel content image is directly combined and displayed to the user for preview; if not, the Excel cell data matching the preview area is searched, and the rendering and splitting are performed according to the Excel cell data to generate several matching Excel content images, which are saved in the database, and the matching Excel content images are combined and displayed to the preview area. Accordingly, the present invention improves the applicability of displaying Excel content on the Web side by searching the database cache on demand or rendering and generating matching Excel content images on demand, while avoiding the pressure of instant rendering calculation and waste of computing resources.

[0082] Based on the above design, the present invention proposes a preview method based on dynamic area Excel content, and based on this method, proposes a preview device based on dynamic area Excel content.

[0083] Please also see Figure 2 and Figure 3 , Figure 2 This is a schematic diagram of the structure of the preview device based on the dynamic area Excel content of the present invention, Figure 3 The present invention is a flowchart of a preview method based on dynamic area Excel content.

[0084] The preview device based on dynamic area Excel content includes a request information acquisition unit 1, an image cache determination unit 2, an Excel cell data search unit 3, a picture rendering unit 4 and a combined picture display unit 5.

[0085] The request information acquisition unit 1 is used to execute step S1: acquiring user request information of the previewed area to be generated.

[0086] Specifically, the preview area to be generated is that the user opens the preview page on the Web end (client, browser, etc.) and obtains the user's current viewport position and size to determine the area to be generated. The viewport position can be represented by the position of the scroll bar, and the size can be represented by the width and height of the container in the browser page, for example Elements, the specific expressions are as follows:

[0087] Set the current viewport size to width W and height H;

[0088] Assume that the current scroll bar positions on the horizontal and vertical axes are ΔW and ΔH respectively;

[0089] The previewed area to be generated is:

[0090] Area=[(W+ΔW),(H+ΔH)]

[0091] The specific position of the scroll bar can be obtained by monitoring the "Scroll" event, and the area to be generated is represented by a container containing content, and the container is used to carry and display the generated content area.

[0092] The image cache judgment unit 2 is used to execute step S2: according to the user request information of the previewed area to be generated, determine whether there is a generated Excel content picture in the database: if so, obtain the generated Excel content picture and call the combined image display unit 5; if not, call the Excel cell data search unit 3.

[0093] Specifically, according to the position and size of the area to be generated, the coordinates of the upper left corner and the lower right corner of the area to be generated are obtained, and specifically satisfy the following expression:

[0094] Area 左上角 =(ΔW, ΔH)

[0095] Area 右下角 =(ΔW+W,ΔH+H)

[0096] Wherein, ΔW and ΔH represent the position of the current scroll bar of the area to be generated on the horizontal axis and the vertical axis, and W and H represent the width and height of the area to be generated.

[0097] Find out whether there is a generated Excel content image in the database that intersects with the area to be generated. If so, obtain the corresponding generated Excel content image. The generated Excel content image Image satisfies the following conditions:

[0098] (ΔW≤(x 1 ,x 2 )≤ΔW+W+c)and(ΔH≤(y 1 ,y 2 )≤ΔH+H+c)

[0099] In the formula, x 1 and 1 Represents the coordinates of the upper left corner of the generated Excel content image, x 2 and 2 Represents the coordinates of the lower right corner of the generated Excel content image; c is a custom constant used to preload the Excel content image at the edge of the area to be generated.

[0100] The present invention introduces centralized cache management, that is, when a new user requests a preview area that is the same or similar to the generated Excel content image, the system can use (ΔW≤(x 1 ,x 2 )≤ΔW+W+c) and (ΔH≤(y 1 ,y 2 )≤ΔH+H+c) determines whether the generated Excel content picture is at the intersection coordinates of the area to be generated, thereby realizing the indexing of the generated content picture and directly displaying the generated Excel content picture without repeated rendering, thereby improving the response speed of the system. Wherein, the coordinates of the generated Excel content picture adopt a global coordinate system, and by defining a global coordinate system when generating the picture for the first time, the efficiency of subsequent indexing and searching of the generated Excel content picture is improved.

[0101] The Excel cell data search unit is used to execute step S3: search according to the previewed area to be generated to obtain matching Excel cell data.

[0102] Specifically, the Excel cell data in the database that is in the area to be generated and for which the Excel content picture has not been generated is obtained, and is cached to the array to be rendered, and the array to be rendered is used as the matching Excel cell data.

[0103] The Excel cell data includes attributes such as content, font, color, width, height, and border, which are obtained by reading the content of each page of the uploaded Excel file using libraries such as PHPEXCEL. Based on this, multiple attributes are read for rendering to achieve a rendered table that is consistent with the Excel source file in visual effect, thereby reproducing the display effect of the original Excel file.

[0104] The present invention ensures the security of the original Excel cell data by storing the data to be rendered in a cached manner, and the cached data can be cleared immediately after rendering, avoiding direct operation and storage with the original data, thereby ensuring the isolation and independence of the data. In addition, the cache mechanism can also improve the efficiency of rendering, reduce the overhead of multiple database accesses, and thus optimize the system performance of the server.

[0105] See also Figure 4 , Figure 4 A diagram showing a simple process example for rendering and splitting Excel cell data.

[0106] The image rendering unit 4 is used to execute step S4: perform rendering and splitting according to the matching Excel cell data, generate a number of matching Excel content images, and save them in the database.

[0107] Specifically, the matching Excel cell data is rendered to obtain table data, and the table data is converted into a picture to obtain a complete Excel content picture.

[0108] According to the preset image storage size, a sliding window is used to crop the complete Excel content image to obtain several sub-images. For details, please refer to the following expression:

[0109] Assume the width and height of the complete Excel content image are W and H respectively;

[0110] Assume the width and height of the sliding window are Δw and Δh respectively;

[0111] but:

[0112]

[0113] In the formula, Images is a collection of several sub-images, Window (i,j) The sub-image corresponding to the i-th row and j-th column of the complete Excel content image has a Window (i,j) Satisfies the following expression:

[0114] Window (i,j) =Image(x∈[α,α+Δw],y∈[β,β+Δh])

[0115] Where x∈[α,α+Δw] and y∈[β,β+Δh] represent the coordinate intervals of the horizontal and vertical pixels of the current sub-image, α and β represent the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, and n and m represent the number of times the sliding window is cropped in the horizontal and vertical directions, respectively. n satisfies the following expression:

[0116]

[0117] In the formula, It means rounding up, therefore, the total number of subgraphs is: n×m.

[0118] Next, corresponding serial numbers are assigned to several sub-images to obtain several matching Excel content images.

[0119] Among them, the serial numbers assigned to several sub-graphs can be combined with i and j as well as n and m of the currently generated sub-graph to accumulate the original serial numbers, but since the Excel content may include a single page, multiple pages or multiple independent tables on the same page, etc., the naming and allocation of its serial numbers are not specifically limited by the present invention, and it is only ensured that its several sub-graphs can be merged into a complete sub-graph according to the serial numbers. At the same time, the sub-graphs with serial numbers can be recorded using a global coordinate system so that subsequent systems can index or search for corresponding sub-graphs through the global coordinate system. However, since the setting method of the global coordinates can define different global coordinate systems according to different Excel contents, such as multiple pages of content in a single file, segmented content of a single page, etc., the present invention does not specifically limit the setting method of its global coordinate system.

[0120] The present invention renders Excel pictures dynamically, that is, only when a request for a preview area appears and the Excel content picture corresponding to the preview area does not exist in the database, the Excel cell data stored in the database is rendered, so as to prevent the concurrent calculation of the server side caused by the rendering of the entire Excel content when there is a large amount of data in the Excel file, and its computing resources are seriously occupied. At the same time, by saving the rendered content in the form of pictures, unnecessary rendering calculations are avoided.

[0121] In addition, since the preview area to be generated generally does not exceed the size of the user's display screen, by setting a fixed image storage size as the size of the sliding window, the complete Excel content image can be cropped to effectively ensure that no content is missed during the cropping process. At the same time, it can effectively handle the cropping requirements of different display areas, such as: potential dynamic column widths, merged cells, and chart embedding inconsistencies in Excel content, thereby ensuring integrity and splicing consistency.

[0122] Furthermore, the sliding window is an adaptive sliding window, and the Window also satisfies the following expression:

[0123] Window (i,n) =Image(x∈[α,W],y∈[β,β+Δh]),1≤i <m

[0124] Window (m,j) =Image(x∈[α,α+Δw],y∈[β,H]),1≤j <n

[0125] Window (m,n) =Image(x∈[α,W],y∈[β,H])

[0126] Where Image(·) is the pixel coordinate interval of the current sub-image in the horizontal and vertical directions, α and β are the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, b and m are the number of times the sliding window is cropped in the horizontal and vertical directions, Δw and Δh are the width and height of the sliding window, and W and H are the width and height of the complete Excel content image.

[0127] Since Excel content often has complex situations such as dynamic column width, merged cells or inconsistent embedded charts, when cropping a complete Excel content image through a fixed-size cropping window, it is easy to cause blank areas on the edges of the cropped sub-image (the sub-image at the end), resulting in discontinuity when splicing Excel content images from different generated batches, which seriously affects the user's viewing experience. For details, please refer to Figure 5 Accordingly, the present invention introduces an adaptive sliding window to ensure that when the horizontal and vertical edge ends of the complete Excel content image are cropped, the sliding window can be adjusted according to actual needs and does not exceed the cropping range, thereby effectively avoiding the generation of edge blanks. For details, please refer to Figure 6 , ensuring the continuity and integrity of the spliced ​​images.

[0128] The combined picture display unit 5 is used to execute step S5: sorting and combining a plurality of matching Excel content pictures, and displaying them in the preview area to be generated.

[0129] According to the serial numbers of the plurality of matched Excel contents, they are sorted and spliced, and the previewed area to be generated, that is, the spliced ​​picture, is displayed in a container for the user to preview the Excel contents.

[0130] The container of the present invention serves as a bearing area for Excel content, and each individually generated image fragment is spliced ​​and displayed in the container according to its position in the table, that is, the serial number. Accordingly, when the user performs a unified zoom operation on the container itself, it is effectively avoided that the image fragments cropped by each Excel are out of sync or distorted when zooming, thereby ensuring the visual consistency of the table content during the zooming process, improving the browsing experience of the user at different zoom levels, and preventing unnecessary dislocation or breakage of the Excel content during the zooming process.

[0131] Compared with the prior art, the present invention obtains the user's preview area and queries whether there is a rendered Excel content image in the current preview area: if so, the corresponding Excel content image is directly displayed; if not, the Excel cell data required by the current preview area is rendered and split to generate the corresponding Excel content image, so as to greatly reduce unnecessary computing overhead, fully reduce the operating pressure of the server, and ensure the response speed of the Web end displaying Excel content. In addition, by introducing sliding windows and adaptive processing and cropping, the complete Excel content image is accurately cropped, and when facing complex table structures such as dynamic column widths, merged cells and embedded charts in Excel, the phenomenon of edge blanks and discontinuous splicing is effectively avoided, thereby improving the integrity and display effect of the splicing.

[0132] Based on the same inventive concept, the present application also provides an electronic device, which may be a terminal device such as a server, a desktop computing device or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the preview method based on the dynamic area Excel content of the embodiment of the present invention; and the memory is used to store a computer program executable by the processor.

[0133] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the embodiment of the aforementioned preview method based on dynamic area Excel content, the computer-readable storage medium stores a computer program thereon, and when the program is executed by a processor, the steps of the preview method based on dynamic area Excel content recorded in any of the above embodiments are implemented.

[0134] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0135] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, and the present invention is also intended to include these modifications and modifications.

Claims

1. A preview method based on dynamic area Excel content, characterized in that: The following steps are involved: S1: Obtaining user request information of the previewed area to be generated; S2: According to the user request information of the previewed area to be generated, determine whether there is a generated Excel content picture in the database: if so, obtain the generated Excel content picture and execute step S5; if not, execute step S3; wherein, step S2 includes the following sub-steps: According to the position and size of the area to be generated, obtain the coordinates of the upper left corner of the area to be generated Area 左上角 and the lower right corner coordinates Area 右下角 , specifically satisfying the following expression: Area 左上角 =(ΔW,ΔH) Area 右下角 =(ΔW+W,ΔH+H) Wherein, ΔW and ΔH represent the position of the current scroll bar of the area to be generated on the horizontal axis and the vertical axis, and W and H represent the width and height of the area to be generated; Find out whether there is a generated Excel content image in the database that intersects with the area to be generated. If so, obtain the corresponding generated Excel content image; wherein the generated Excel content image Image satisfies the following conditions: (ΔW≤(x1,x2)≤ΔW+W+c)and(ΔH≤(y1,y2)≤ΔH+H+c) In the formula, x1 and y1 represent the coordinates of the upper left corner of the generated Excel content image, x2 and y2 represent the coordinates of the lower right corner of the generated Excel content image, and c is a custom constant; S3: Search according to the previewed area to be generated to obtain matching Excel cell data; S4: Render and split according to the matching Excel cell data, generate a number of matching Excel content images, and save them in the database; wherein, step S4 includes the following sub-steps: By rendering the matched Excel cell data, table data is obtained, and the table data is converted into a picture to obtain a complete Excel content picture; According to the preset image storage size, a sliding window is used to crop the complete Excel content image to obtain several sub-images. The specific expression is: The width and height of the complete Excel content image are W and H respectively; The width and height of the sliding window are Δw and Δh respectively; but: Images={Window (i,j) |1≤i≤m,1≤j≤n} In the formula, Images is a collection of several sub-images, Window (i,j) The sub-image corresponding to the i-th row and j-th column of the complete Excel content image has a Window (i,j) Satisfies the following expression: Window (i,j) =Image(x∈[α,α+Δw],y∈[β,β+Δh]) Where x∈[α,α+Δw] and y∈[β,β+Δh] represent the coordinate intervals of the horizontal and vertical pixels of the current sub-image, α and β represent the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, and n and m represent the number of times the sliding window is cropped in the horizontal and vertical directions, respectively. n satisfies the following expression: In the formula, Indicates rounding up calculation; Assign corresponding serial numbers to several sub-images to obtain several matching Excel content images; S5: sorting and combining a plurality of matching Excel content pictures, and displaying them in the preview area to be generated.

2. The preview method based on dynamic area Excel content according to claim 1, characterized in that: The sliding window is an adaptive sliding window, and the Window also satisfies the following expression: Window (i,n) =Image(x∈[α,W],y∈[β,β+Δh]),1≤i <m Window (m,j) =Image(x∈[α,α+Δw],y∈[β,H]),1≤j <n Window (m,n) =Image(x∈[α,W],y∈[β,H]) Where Image(·) is the pixel coordinate interval of the current sub-image in the horizontal and vertical directions, α and β are the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, n and m are the number of times the sliding window is cropped in the horizontal and vertical directions, Δw and Δh are the width and height of the sliding window, and W and H are the width and height of the complete Excel content image.

3. A preview device based on dynamic area Excel content, characterized in that: It includes a request information acquisition unit, an image cache judgment unit, an Excel cell data search unit, a picture rendering unit and a combined picture display unit; The request information acquisition unit is used to acquire user request information of the previewed area to be generated; The image cache judgment unit is used to judge whether there is a generated Excel content picture in the database according to the user request information of the previewed area to be generated: if yes, obtain the generated Excel content picture and call the combined picture display unit; if no, call the Excel cell data search unit; wherein the image cache judgment unit is also used to perform the following sub-steps: According to the position and size of the area to be generated, obtain the coordinates of the upper left corner of the area to be generated Area 左上角 and the lower right corner coordinates Area 右下角 , specifically satisfying the following expression: Area 左上角 =(ΔW,ΔH) Area 右下角 =(ΔW+W,ΔH+H) Wherein, ΔW and ΔH represent the position of the current scroll bar of the area to be generated on the horizontal axis and the vertical axis, and W and H represent the width and height of the area to be generated; Find out whether there is a generated Excel content image in the database that intersects with the area to be generated. If so, obtain the corresponding generated Excel content image; wherein the generated Excel content image Image satisfies the following conditions: (ΔW≤(x1,x2)≤ΔW+W+c)and(ΔH≤(y1,y2)≤ΔH+H+c) In the formula, x1 and y1 represent the coordinates of the upper left corner of the generated Excel content image, x2 and y2 represent the coordinates of the lower right corner of the generated Excel content image, and c is a custom constant; The Excel cell data search unit is used to search according to the previewed area to be generated to obtain matching Excel cell data; The image rendering unit is used to perform rendering and splitting according to the matching Excel cell data, generate a number of matching Excel content images, and save them into a database; wherein the image rendering unit is also used to perform the following sub-steps: By rendering the matched Excel cell data, table data is obtained, and the table data is converted into a picture to obtain a complete Excel content picture; According to the preset image storage size, a sliding window is used to crop the complete Excel content image to obtain several sub-images. The specific expression is: The width and height of the complete Excel content image are W and H respectively; The width and height of the sliding window are Δw and Δh respectively; but: Images={Window (i,j) |1≤i≤m,1≤j≤n} In the formula, Images is a collection of several sub-images, Window (i,j) The sub-image corresponding to the i-th row and j-th column of the complete Excel content image has a Window (i,j) Satisfies the following expression: Window (i,j) =Image(x∈[α,α+Δw],y∈[β,β+Δh]) Where x∈[α,α+Δw] and y∈[β,β+Δh] represent the coordinate intervals of the horizontal and vertical pixels of the current sub-image, α and β represent the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, and n and m represent the number of times the sliding window is cropped in the horizontal and vertical directions, respectively. n satisfies the following expression: In the formula, Indicates rounding up calculation; Assign corresponding serial numbers to several sub-images to obtain several matching Excel content images; The combined picture display unit is used to sort and combine a number of matching Excel content pictures and display them in the preview area to be generated.

4. The preview device based on dynamic area Excel content according to claim 3, characterized in that: The sliding window is an adaptive sliding window, and the Window also satisfies the following expression: Window (i,n) =Image(x∈[α,W],y∈[β,β+Δh]),1≤i <m Window (m,j) =Image(x∈[α,α+Δw],y∈[β,H]),1≤j <n Window (m,n) =Image(x∈[α,W],y∈[β,H]) Where Image(·) is the pixel coordinate interval of the current sub-image in the horizontal and vertical directions, α and β are the horizontal moving distance (j-1)×Δw and vertical moving distance (i-1)×Δh of the current sliding window, n and m are the number of times the sliding window is cropped in the horizontal and vertical directions, Δw and Δh are the width and height of the sliding window, and W and H are the width and height of the complete Excel content image.

5. 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 computer program, the preview method based on dynamic area Excel content as described in any one of claims 1 to 2 is implemented.

6. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer executable instructions are used for a preview method based on dynamic area Excel content as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Vector data dynamic visualization method and system

    CN118069767A