Document processing method and device, computer device, storage medium and program product
By using a unified rendering method and caching mechanism, the high development cost of server-side rendering for online documents with multiple views has been solved, resulting in cost reduction and improved loading speed.
Patent Information
- Application Number
- CN202210794646.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-07-07
AI Technical Summary
The development cost of server-side rendering of multiple views for online documents in existing technologies is high, resulting in low development efficiency.
This paper provides a document processing method that uses a unified rendering approach to process document views under different view types and utilizes cache space to store rendering files. The rendering files are generated and cached only during the first rendering, and are retrieved directly from the cache in subsequent renderings, thereby reducing repeated rendering operations.
It effectively reduces the development cost of server-side rendering of multi-view online documents and improves the first screen loading speed.
Smart Images

Figure CN117407618B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a document processing method, a document processing apparatus, a computer device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the rapid development of computer technology, Server-Side Rendering (SSR) is widely used in various rendering scenarios. SSR refers to a page processing technology where the server completes the HTML (Hypertext Markup Language) structure assembly of the page, sends it to the browser, and then binds its state and events to create a fully interactive page. When applied to online document rendering, SSR can effectively shorten the initial display time of online documents. As is well known, online documents often have diverse presentation formats, which leads to high development costs for server-side rendering in online documents. Therefore, how to reduce the development cost of server-side rendering in online documents has become a current research hotspot. Summary of the Invention
[0003] This application provides a document processing method, apparatus, computer equipment, storage medium, and program product, which can effectively reduce the development cost of multi-view server-side rendering in online documents.
[0004] On the one hand, embodiments of this application provide a document processing method, which includes:
[0005] Receive a document display request from a document client. The document display request is used to request the display of the document view of the target document under the target view type. The target document includes document views under one or more view types, and the target view type is one of one or more view types.
[0006] In response to a document display request, obtain the rendered file of the target document under the target view type; the document view of the target document under different view types corresponds to different rendered files, and the rendered files of the target document under various view types are rendered using the same rendering method;
[0007] The target document's rendered file under the target view type is sent to the document client, so that the document client can render the target document's document view under the target view type based on the received rendered file.
[0008] Accordingly, embodiments of this application provide a document processing apparatus, which includes:
[0009] The communication unit is used to receive document display requests from document clients. The document display requests are used to request the display of the document view of the target document under the target view type. The target document includes document views under one or more view types, and the target view type is one of one or more view types.
[0010] The processing unit is used to respond to a document display request and obtain the rendering file of the target document under the target view type. The document view of the target document under different view types corresponds to different rendering files. The rendering files of the target document under various view types are rendered using the same rendering method.
[0011] The communication unit is also used to send the rendered file of the target document under the target view type to the document client, so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0012] In one implementation, the rendered file for any view type is formed by concatenating the rendered file of the editing area and the rendered file of the toolbar under that view type; the rendered file of the editing area is stored in a cache space; the processing unit, when obtaining the rendered file of the target document under the target view type, specifically performs the following steps:
[0013] Based on the document display request, locate the corresponding editing area rendering file in the cache space;
[0014] If the target document's edit area rendering file under the target view type is successfully found in the cache space, then the edit area rendering file under the target view type is retrieved from the cache space.
[0015] Get the toolbar rendering file under the target view type;
[0016] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0017] In one implementation, when the processing unit obtains the rendered file of the target document under the target view type, it is also used to perform the following steps:
[0018] If the rendering file of the target document under the target view type is not found in the cache space, then the first screen document data of the target document under the target view type is obtained;
[0019] Render the first screen document data under the target view type to obtain the editing area rendering file under the target view type;
[0020] Get the toolbar rendering file under the target view type;
[0021] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0022] In one implementation, the document view under the target view type contains multiple document contents, and the first screen document data under the target view type includes the content data of multiple document contents; the processing unit, used to render the first screen document data under the target view type, specifically performs the following steps when obtaining the edit area rendering file under the target view type:
[0023] Obtain the component rendering structure, which includes multiple rendering components, each corresponding to a type of document content;
[0024] Each rendering component is invoked to render the content data of the corresponding type of document content, resulting in a rendered file for each document content.
[0025] The rendering files of each document content are spliced together according to the rendering layout corresponding to the component rendering structure to obtain the editing area rendering file under the target view type.
[0026] The target document's initial screen data under different view types is rendered using a component rendering structure.
[0027] In one implementation, the rendering layout is a tree structure formed by expanding the root node. The root node includes one or more layer nodes, the layer nodes include one or more group nodes, and the group nodes include one or more child nodes. Each child node corresponds to a rendering file of document content. The processing unit is used to concatenate the rendering files of each document content according to the rendering layout. When obtaining the editing area rendering file under the target view type, it specifically performs the following steps:
[0028] The rendering files of the document content corresponding to each child node included in the group node are concatenated to obtain the rendering file corresponding to the group node.
[0029] The rendering files corresponding to each group node included in the layer node are concatenated to obtain the rendering file corresponding to the layer node.
[0030] The rendering files corresponding to each layer node included in the root node are concatenated to obtain the rendering file corresponding to the root node.
[0031] The rendering file corresponding to the root node is used as the rendering file for the editing area of the target document under the target view type.
[0032] In one implementation, the rendering component includes an image component, and the document content includes images; the image content data includes image processing parameters; the processing unit, used to call each component to render the document content of the corresponding type, specifically performs the following steps when obtaining the rendered files of each document content:
[0033] The image component is invoked to render the image according to the processing parameters, resulting in the rendered image file.
[0034] The processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and translation parameters.
[0035] In one implementation, the rendering component includes a text component, the document content includes text, and the text content data includes the font parameters of the text; the processing unit, used to call each component to render the document content of the corresponding type, specifically performs the following steps when obtaining the rendered files of each document content:
[0036] Call the text component to perform word segmentation on the text;
[0037] Measure the width information of each word obtained from the word segmentation process;
[0038] The width of the text is determined based on the width information of each word segment;
[0039] The text is rendered according to the font parameters and width information of the text content to obtain the rendered text file.
[0040] In one implementation, the rendering component includes a polyline component, the document content includes a table, and the table content data includes the table's coordinate data and fill color data; the processing unit, used to call each component to render the document content of the corresponding type, specifically performs the following steps when obtaining the rendered files of each document content:
[0041] The line component is invoked to determine the coordinate data of the multiple lines that make up the table, based on the coordinate data of the table.
[0042] Based on the fill color data of the table, determine the fill color data for multiple lines;
[0043] Each polyline is rendered based on its coordinate data and fill color data to obtain a rendering file for each polyline.
[0044] Determine the table's rendering file based on the rendering files of each polyline.
[0045] In one implementation, the processing unit, before concatenating the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, is also configured to perform the following steps:
[0046] Perform dynamic condition detection on the toolbar rendering file;
[0047] If the detection result indicates that the toolbar rendering file has dynamic conditions, then the toolbar rendering file is updated based on the dynamic conditions to obtain the updated toolbar rendering file;
[0048] The processing unit, used to concatenate the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, specifically performs the following steps:
[0049] The updated toolbar rendering file and the editing area rendering file under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0050] In one implementation, the processing unit, when acquiring the first-screen document data of the target document under the target view type, specifically performs the following steps:
[0051] Retrieve complete document data for the target document under the target view type;
[0052] The complete document data is segmented according to the document data segmentation information to obtain the first screen document data of the target document under the target view type.
[0053] In one implementation, the rendering file for any view type is formed by concatenating the editing area rendering file and the toolbar rendering file for that view type; the editing area rendering files of the target document under various view types are stored in a cache space; the processing unit is also used to perform the following steps:
[0054] In response to editing operations on the target document in the document client, update the target document's edit area rendering file stored in the cache space under various view types.
[0055] In one implementation, the communication unit, when sending the rendered file of the target document under the target view type to the document client, specifically performs the following steps:
[0056] When a window adaptation requirement is detected in the document client, the window adaptation script file is retrieved.
[0057] The window adaptation script file and the target document's rendering file under the target view type are sent to the document client so that when the window shape of the document rendering window changes, the document client adapts to present the document view of the target document under the target view type in the document rendering window based on the window adaptation script file and the rendering file under the target view type.
[0058] Accordingly, embodiments of this application provide a computer device, which includes:
[0059] A processor is a tool for implementing computer programs.
[0060] A computer-readable storage medium storing a computer program adapted to be loaded by a processor and executed by the above-described document processing method.
[0061] Accordingly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed by a processor of a computer device, causes the computer device to perform the aforementioned document processing method.
[0062] Accordingly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the document processing method described above.
[0063] In this embodiment, when a document client needs to display the document view of a target document (i.e., an online document) under a target view type, it can obtain the rendering file of the target document under the target view type and send it to the document client, so that the document client can quickly present the document view of the target document under the target view type based on the received rendering file. The target document may include document views under one or more view types. The document views of the target document under different view types correspond to different rendering files. The rendering files of the target document under various view types are rendered using the same rendering method. That is to say, only one rendering method needs to be developed for server-side rendering of different document views of the target document, instead of developing different rendering methods for server-side rendering of different document views of the target document. This can effectively reduce the development cost of server-side rendering of multiple views in online documents. Attached Figure Description
[0064] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a schematic diagram illustrating multiple document views of an online document provided in an embodiment of this application;
[0066] Figure 2 This is a schematic diagram of the architecture of a document processing system provided in an embodiment of this application;
[0067] Figure 3 This is a flowchart illustrating a document processing method provided in an embodiment of this application;
[0068] Figure 4 This is a schematic diagram illustrating the composition of a document view provided in an embodiment of this application;
[0069] Figure 5 This is a schematic diagram of dynamic condition replacement of a toolbar provided in an embodiment of this application;
[0070] Figure 6 This is a flowchart illustrating another document processing method provided in an embodiment of this application;
[0071] Figure 7 This is a schematic diagram of a server-side rendering architecture provided in an embodiment of this application;
[0072] Figure 8 This is a schematic diagram of a rendering layout provided in an embodiment of this application;
[0073] Figure 9 This is a schematic diagram of an image rendering effect provided in an embodiment of this application;
[0074] Figure 10 This is a schematic diagram of a text segmentation result provided in an embodiment of this application;
[0075] Figure 11 This is a schematic diagram of the processing logic flow of a document server provided in an embodiment of this application;
[0076] Figure 12 This is a schematic diagram of the structure of a document processing device provided in an embodiment of this application;
[0077] Figure 13 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0078] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0079] To better understand the document processing solution provided in the embodiments of this application, the key terms involved in the embodiments of this application will be introduced first:
[0080] (1) Online documents. Online documents refer to files generated after editing document content online in a document client. The document content can include, but is not limited to, the following: text, images, lines, and links, etc. Online editing can be understood as the document content generated by any editing operation in an online document will be synchronized to the cloud (i.e., server-side) for storage. Online documents support collaborative editing by multiple (i.e., two or more) document editing objects. Collaborative editing of online documents by multiple document editing objects can be understood as multiple document editing objects being able to edit the same online document, and any document editing object can not only view the document content it edited, but also the document content edited by other document editing objects.
[0081] The online document can be any of the following: an online Word document (an online text document), an online Excel document (an online spreadsheet document), or an online PowerPoint document (a presentation document). The online document can include document views under one or more view types, all rendered from the same source data. In other words, the document views under one or more view types are different presentation formats of the same source data. Specifically, when the online document is an online Excel document, it can be a Smart Sheet document. A Smart Sheet document, also known as a multidimensional data table, is a database-like spreadsheet that allows control over the data format of each column through fields, treating each row as a data record, providing a well-organized data structure. Furthermore, a Smart Sheet document can convert the same source data into different view types to meet the needs of different scenarios; for example… Figure 1 The document view of the smart table is shown in four view types. 101 in the first row and first column is the document view of the smart table in the table view type. 102 in the first row and second column is the document view of the smart table in the Kanban view type. 103 in the second row and first column is the document view of the smart table in the Gantt view type. 104 in the second row and second column is the document view of the smart table in the catalog view type.
[0082] A document client is a program that provides document processing services to document editors, in contrast to a document server. Document clients can be browsers, applications, and SPAs (Single Page Web Applications). An SPA is an application with only one web page; it loads a single HTML page and dynamically updates that page as the user interacts with the application. A document server is a program that serves the document client; the device on which the document server runs is usually called a document server.
[0083] (2) SSR (Server-Side Rendering). For online documents, server-side rendering refers to the process where the document server renders the document views of various view types in the online document and sends the rendered files to the document client for presentation. For online documents, CSR (Client-Side Rendering) refers to the process where the document client downloads resource files, renders the document views of various view types in the online document, and binds states and events to them. Compared with CSR, SSR has better SEO (Search Engine Optimization) and faster first-screen loading speed. SEO is a method of obtaining a higher ranking in search engine results by optimizing website content.
[0084] Based on the aforementioned descriptions of key terms, this application proposes a document processing scheme. This scheme develops a rendering method that supports server-side rendering of online documents under different view types. In other words, the document server uses a common rendering method to render the document views of online documents under different view types, eliminating the need to develop different rendering methods for each view type. This effectively reduces the development cost of server-side rendering of multiple views for online documents. Furthermore, this document processing scheme supports rendering caching. The rendered files are stored in a cache space. When a document view of a requested online document has already been rendered, the document server can directly retrieve the corresponding rendering file from the cache space and send it to the document client. The document client can then quickly present the corresponding document view based on the received rendering file, significantly improving the initial loading speed of online documents. Furthermore, in this document processing solution, the document server uses DOM (Document Object Model) rendering (a server-side rendering mode) and / or SVG (Scalable Vector Graphics) rendering (another server-side rendering mode), which can support the rendering of various types of document content. This allows the document view rendered by the server to accurately reproduce the document view obtained by the document client through Canvas rendering (a client-side rendering mode).
[0085] The following is combined Figure 2 The document processing system provided in the embodiments of this application will be described. Figure 2 The document processing system shown may include a document server 201 and a terminal device 202. This embodiment does not limit the number of terminal devices 202; there may be one or more terminal devices 202. The document server 201 and the terminal devices 202 can establish a direct communication connection via wired communication or an indirect communication connection via wireless communication. This embodiment does not limit the specific connection.
[0086] (1) Terminal device 202. The terminal device may be a smartphone, tablet computer, laptop computer, desktop computer, smart voice interaction device, smartwatch, vehicle terminal, smart home appliance, aircraft, wearable device, etc., but is not limited to these.
[0087] The terminal device has a document client installed. This client can generate a document display request in response to document display operations performed by the document editing object, and then send this request to the document server via the terminal device. The document display request requests the display of a document view of a target document under a specific view type; the target document is an online document. After receiving the rendering file for the corresponding view type from the document server via the terminal device, the document client can present the requested document view based on the received rendering file.
[0088] (2) Document server 201. The document server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This application embodiment does not limit this.
[0089] The document server runs a document server program. After receiving a document display request from a document client via a terminal device, the document server program can directly retrieve the corresponding rendering file from the cache if the document view of the requested target document under a certain view type has already been rendered, and send the retrieved rendering file to the document client. If the document view of the requested target document under a certain view type has not been rendered, the document server program can retrieve the document data under the corresponding view type, render the document data according to the developed general rendering method, and send the rendered file to the document client.
[0090] like Figure 2 As shown, the document client requests to display the document view of the target document in table view type. The document server sends the rendered file of the target document in table view type to the document client. The document client presents the document view of the target document in table view type based on the rendered file of the target document in table view type. The document view of the target document in Kanban view type, Gantt view type, and catalog view type is similar to the document view of the target document in table view type, and will not be described in detail here.
[0091] The document processing system provided in this application significantly reduces the development cost of multi-view server-side rendering of target documents on the document server side. The document client not only supports presenting rich view types of target documents but also greatly shortens the initial display time of various view types on the document client. It is understood that the document processing system described in this application embodiment is for the purpose of more clearly illustrating the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment. Those skilled in the art will recognize that with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.
[0092] The following is combined Figures 3-11 The document processing scheme provided in the embodiments of this application will be described in detail.
[0093] This application provides a document processing method, which mainly describes how to obtain the rendering file corresponding to the document view of the target document requested by the document client under the target view type, how to update the rendering file of the target document under each view type after the target document is edited, and how to adaptively display the document view window. This document processing method can be executed by a computer device, which can be the document server 201 in the aforementioned document processing system. Figure 3 As shown, the document processing method may include the following steps S301-S303:
[0094] S301, Receive a document display request from the document client.
[0095] The document server can receive document display requests from document clients. These requests can be used to request the display of a document view of a target document under a target view type. The target document can include document views under one or more view types. A target view type is one of one or more view types. Here, "document view" refers to the presentation format of the target document. Different view types refer to different presentation formats of the target document, and the emphasis of document views under different view types is different. For example... Figure 1 The 101 shown (i.e., the document view under the table view type) emphasizes overall composition. Figure 1 The focus of view shown in 102 (i.e., the document view under the Kanban view type) is grouping. Figure 1 The 103 shown (i.e., the document view under the Gantt view type) focuses on key time points and time progress, etc.; the target document belongs to a document collection, which may include one or more documents, and the target document is one of the one or more documents.
[0096] S302, in response to a document display request, retrieve the rendered file of the target document under the target view type.
[0097] Before introducing step S302, let's first introduce the components of the document view, such as... Figure 4 As shown, taking the document view under the table view type as an example, the document view can include, but is not limited to, any one or more of the following: Title Bar 401, Toolbar (which may include the top toolbar 402 and the bottom toolbar 403), table announcement 404, editor 405, etc.; where:
[0098] Title bar 401 can be used to display the title name 4011 of the document collection to which the target document belongs (e.g., Figure 4 The top toolbar 402 includes a "table" view, and operation options 4012 for the document editing object, such as a "share" option to share the document collection, the first option to the left of the "share" option to set operation permissions for the document collection, the second option to the left of the "share" option to set a watermark for the document collection, and the third option to the left of the "share" option to provide functional options for the document collection (such as save function options, viewing revision history of the document collection, and viewing browsing history of document records, etc.). The bottom toolbar 403 can be used to switch between different documents in the document collection, and may also include a document creation option 4031 for creating new documents in the document collection. The top toolbar 402 may include a view type switching option 4021 for switching between different view types, and document operation options 4022 (such as "add a row" to add a row to the document, "group" to set grouping conditions for documents, "filter" to set filtering conditions for documents, "hide columns" to set hidden columns, "announcement" to show or hide table announcements, etc.). Announcement 404 can be used to present notification information about a published document. Editor 405 can be used to provide an area for editing specific document content.
[0099] Accordingly, the rendering file for a document view under any view type can consist of one or more of the following: title bar rendering file, toolbar rendering file, table / announcement rendering file, and editor rendering file; wherein, the title bar rendering file is a file obtained by rendering the document data corresponding to the title bar, and the document client can display the title bar by parsing the title bar rendering file; the toolbar rendering file is a file obtained by rendering the document data corresponding to the toolbar, and the document client can display the toolbar by parsing the toolbar rendering file; the table / announcement and the editor can be collectively referred to as the editing area, and the table / announcement rendering file and the editor rendering file can be collectively referred to as the editing area rendering file, the editing area rendering file is obtained by rendering the document data corresponding to the editing area (i.e., the first screen document data), and the document client can display the editing area by parsing the editing area rendering file. It's important to note that while the title bars for different document collections are similar, there may be differences in the title names. A generic title bar rendering file can be generated by rendering the document data corresponding to the title bar. The title names in this generic title bar rendering file are the default titles. For document collections where the title names have been edited, the edited title names can be used to replace the title portion in the generic title bar rendering file to obtain the corresponding title bar rendering file. Similarly, the toolbars in document views of the same view type are also similar. A generic toolbar rendering file for that view type can be generated by rendering the document data corresponding to the toolbars within the same view type. The table announcements and editor can be collectively referred to as the editing area. The document content in the editing area of document views under different view types is usually different and needs to be rendered separately to obtain an editing area rendering file. This rendered editing area rendering file can be stored in a cache space, such as a Redis cache, which is a high-performance key-value database.
[0100] In step S302, after receiving a document display request from a document client, the document server can respond to the document display request by obtaining the rendering file of the target document under the target view type. The document view of the target document under various view types corresponds to different rendering files, and the rendering files of the target document under various view types can be rendered using the same rendering method.
[0101] When the document view includes a toolbar and an editing area, in response to a document display request, retrieving the rendered file of the target document under the target view type may include: searching for the corresponding editing area rendered file in the cache space based on the document display request; if the rendered file of the target document under the target view type is successfully found in the cache space, then retrieving the rendered file of the editing area under the target view type from the cache space; if the rendered file of the target document under the target view type is not found in the cache space, then retrieving the first screen document data of the target document under the target view type; rendering the first screen document data under the target view type to obtain the rendered file of the editing area under the target view type, and storing the rendered file of the editing area under the target view type in the cache. In the cache space, so that it can be directly retrieved from the cache space when the next request is made; retrieve the toolbar rendering file under the target view type; perform concatenation processing on the editing area rendering file and the toolbar rendering file under the target view type to obtain the rendering file of the target document under the target view type. Here, the concatenation processing mentioned here can refer to combining the editing area rendering file and the toolbar rendering file in a certain order. The order mentioned here can refer to the presentation order of the editing area and the toolbar in the document view. For example, the document editing object pays more attention to the editing area in the document view than the toolbar, so the presentation order of the editing area can be before the toolbar. That is to say, the combination order of the editing area rendering file is before the combination order of the toolbar rendering file.
[0102] When the document view includes a title bar, toolbar, and editing area, in response to a document display request, retrieving the rendered file of the target document under the target view type may include: searching for the corresponding editing area rendered file in the cache space based on the document display request; if the edit area rendered file of the target document under the target view type is successfully found in the cache space, then retrieving the edit area rendered file of the target view type from the cache space; if the rendered file of the target document under the target view type is not found in the cache space, then retrieving the first screen document data of the target document under the target view type; rendering the first screen document data under the target view type to obtain the edit area rendered file of the target view type. The rendering file of the editing area under the target view type can be stored in the cache so that it can be retrieved directly from the cache when it is requested to be displayed again. The rendering file of the toolbar and the rendering file of the title bar under the target view type are retrieved. The rendering files of the editing area, the toolbar, and the title bar under the target view type are concatenated to obtain the rendering file of the target document under the target view type. Similarly, the concatenation process mentioned here can refer to combining the rendering files of the editing area, the toolbar, and the title bar in a certain order. The order mentioned here can refer to the presentation order of the editing area, the toolbar, and the title bar in the document view.
[0103] As mentioned above, the cache space is a key-value database. This means that the edit area rendering file is stored in the cache space as key-value pairs. The keys in each key-value pair are the document collection identifier (padID), document identifier (sheetID), and view type identifier (viewID), and the values are the edit area rendering files. Therefore, searching for the corresponding edit area rendering file in the cache space based on a document display request can include the following:
[0104] In one implementation, the document display request may include a document set identifier of the document set to which the target document belongs. The document identifier of the target document and the view type identifier of the target view type can be obtained based on this document set identifier. In this case, the document set to which the target document belongs is the document set requested for display by the document editing object, and the target document is the default display document in the document set. For example, the default display document could be the first document created in the document set, the last document created in the document set, etc. Alternatively, the target document could be the last document opened in the document set before it was last closed, and the target view type could be the default display view type in the target document. For example, the default display view type could be the first view type created in the target document, the last view type created in the target document, or the last view type opened in the target document before it was last closed, such as when the document editing object requests to open the document set. Then, the rendering file for the editing area of the target document under the target view type can be found in the cache space based on the document set identifier of the document set to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type.
[0105] In another implementation, the document display request may include a document set identifier (VRI) of the document set to which the target document belongs, and a document identifier of the target document. The view type identifier of the target view type can be obtained based on these VRIs. In this case, the document set to which the target document belongs is the document set requested for display by the document editing object, the target document is the document requested for display by the document editing object within that document set, and the target view type is the default view type displayed in the target document. Alternatively, the target view type can be the last view type opened in the target document before it was closed, such as when the document editing object requests to open the target document within the document set. Then, the rendering file for the editing area of the target document under the target view type can be found in the cache space based on the VRI, the document identifier, and the view type identifier.
[0106] In another implementation, the document display request may include a document collection identifier of the document collection to which the target document belongs, a document identifier of the target document, and a view type identifier of the target view type. In this case, the document collection to which the target document belongs is the document collection to which the document editing object requests display, the target document is the document to which the document editing object in the document collection requests display, and the target view type is the view type to which the document editing object in the target document requests display, such as when the document editing object requests to open the document view of the target document in the document collection under the target view type. Then, the editing area rendering file of the target document under the target view type can be found in the cache space based on the document collection identifier of the document collection to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type.
[0107] As mentioned above, the toolbar rendering files differ across view types. The method for obtaining the toolbar rendering file is similar to that for obtaining the editing area rendering file; it can be obtained based on the view type identifier of the target view type. After obtaining the toolbar rendering file for the target view type, dynamic condition checks can be performed. If the check indicates the existence of dynamic conditions, the toolbar rendering file can be updated based on these conditions to obtain the updated toolbar rendering file. If the check indicates the absence of dynamic conditions, the toolbar rendering file can remain unchanged. Dynamic conditions refer to settings associated with the document content in the editing area of the document view, such as the aforementioned grouping conditions, filtering conditions, hiding conditions, table announcement settings, etc. Figure 5 The top toolbar 501 shown is the general toolbar for the table view type. Top toolbar 502 is the toolbar after dynamically replacing the conditions of top toolbar 501. The dynamic condition for replacement is the grouping condition. In this way, it is not necessary to render a toolbar rendering file for each document view. Instead, a single toolbar rendering file is used for the same document view type. When the toolbar rendering file has dynamic conditions, only the dynamic conditions of the toolbar rendering file with dynamic conditions need to be simply replaced. This saves rendering resources on the document server and greatly improves the rendering speed of the document server.
[0108] As discussed above, the title bar rendering file is universal across all document collections. For document collections with edited title content, only the title name needs to be replaced in the title bar rendering file; in other words, the title name in the title bar rendering file is replaced. This approach avoids rendering a separate title bar rendering file for each document collection; instead, a single title bar rendering file is used across all document collections. When the title bar rendering file needs title replacement, only a simple title replacement is required. This saves rendering resources on the document server and significantly improves its rendering speed.
[0109] Therefore, when the document view includes a toolbar and an editing area, concatenating the editing area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type can include either of the following two cases: First, if the toolbar rendering file has dynamic conditions, then the toolbar rendering file and the editing area rendering file under the target view type, after being updated with dynamic conditions, can be concatenated to obtain the target document's rendering file under the target view type; Second, if the toolbar rendering file does not have dynamic conditions, then the toolbar rendering file and the editing area rendering file under the target view type can be directly concatenated to obtain the target document's rendering file under the target view type.
[0110] When the document view includes a title bar, toolbar, and editing area, the rendering files of the editing area, toolbar, and title bar under the target view type are concatenated to obtain the target document's rendering file under the target view type. This can include any of the following four cases: First, if the toolbar rendering file does not have dynamic conditions and the title bar rendering file does not require title replacement, then the rendering files of the editing area, toolbar, and title bar under the target view type can be directly concatenated to obtain the target document's rendering file under the target view type. Second, if the toolbar rendering file does not have dynamic conditions and the title bar rendering file requires title replacement, then the rendering files of the editing area, toolbar, and title bar under the target view type can be concatenated to obtain the target document's rendering file under the target view type. In the first case, if the toolbar rendering file has dynamic conditions and the title bar rendering file does not need title replacement, then the editing area rendering file, the toolbar rendering file updated with dynamic conditions, and the title bar rendering file in the target view type can be concatenated to obtain the target document's rendering file in the target view type. In the second case, if the toolbar rendering file has dynamic conditions and the title bar rendering file needs title replacement, then the editing area rendering file, the toolbar rendering file updated with dynamic conditions, and the title bar rendering file with title replacement can be concatenated to obtain the target document's rendering file in the target view type.
[0111] S303, send the rendered file of the target document under the target view type to the document client so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0112] After obtaining the rendered file of the target document under the target view type, the rendered file of the target document under the target view type can be sent to the document client so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0113] When a window adaptation requirement is detected in the document client, a window adaptation script file can be obtained. Then, the window adaptation script file and the rendering file of the target document under the target view type can be sent to the document client. This allows the document client to adapt the document view of the target document under the target view type in the document rendering window when the window shape of the document rendering window changes, based on the window adaptation script file and the rendering file under the target view type.
[0114] It should be noted that the rendering file mentioned in the embodiments of this application can be a DOM string. The document client can directly render the corresponding document view by parsing the DOM string without secondary rendering, which effectively shortens the first screen rendering time of the document client.
[0115] It should also be noted that the document client obtains the rendered file from the document server to present the document view because server-side rendering is faster than client-side rendering. This shortens the initial display time of the document client and improves the user experience for document editing objects. However, the document view presented by the document client based on DOM strings is static and non-interactive, meaning it cannot be manipulated by the document editing object. In this case, the document client also needs to download the corresponding resource files and script files for client-side rendering. This is to obtain an interactive document view. Furthermore, after the document client renders the interactive document view, the non-interactive static document view can be removed from the document client to release the content occupied by the static document view in the document client. For example, when a document editing object triggers the display of the document view of the target document under the target view type in the document client, the document client requests the server to obtain the server-rendered rendering file of the target document under the target view type, and presents the document view of the target document under the target view type to the document editing object based on the obtained rendering file. At this time, the presented document view is a static and non-interactive document view. The document server also needs to download the corresponding resource files and script files from the document server for client rendering, and present the client-rendered document view to the document editing object. At this time, the presented document view is an interactive document view, and after the client renders the document view, the document view presented based on the server-rendered rendering file is removed.
[0116] In addition, when the document view of the target document is edited under a certain view type, the document view of the target document under various view types needs to be updated synchronously. The document server can respond to the editing operation on the target document in the document client and update the rendering files of the editing area of the target document under various view types stored in the cache space. The update method can include any of the following:
[0117] (1) Full update method. When the document view of the target document under a certain view type is updated, taking the document view of the target document under the target view type as an example, the document server can obtain the first screen document data corresponding to the updated document view of the target document under the target view type, and then compare the first screen document data corresponding to the updated document view with the first screen document data corresponding to the document data before the update; if the first screen document data corresponding to the updated document view is different from the first screen document data corresponding to the document data before the update, the updated first screen document data can be rendered to obtain the updated editing area rendering file under the target view type, and then the updated editing area rendering file under the target view type can be used to replace the editing area rendering file before the update stored in the cache space; if the first screen document data corresponding to the updated document view is the same as the first screen document data corresponding to the document data before the update, the editing area rendering file before the update stored in the cache space can be retained.
[0118] (2) Differential update method. The difference between differential update and full update is as follows: If the first screen document data corresponding to the updated document view is different from the first screen document data corresponding to the document data before the update, the difference document data between the first screen document data before the update and the first screen document data after the update can be determined, the difference document data is rendered to obtain the difference rendering file, and then the difference rendering file can be used to update the editing area rendering file under the target view type stored in the cache space before the update to obtain the editing area rendering file under the target view type after the update; if the first screen document data corresponding to the updated document view is the same as the first screen document data corresponding to the document data before the update, the editing area rendering file under the target view type stored in the cache space before the update can be retained.
[0119] After the target document is edited, the edit area rendering file stored in the cache is updated. This allows the document to be opened again without waiting for the edited document to be rendered; the edit area rendering file can be retrieved directly from the cache, effectively shortening the initial display time of the document on the client side. Furthermore, differential updates render less document data compared to full updates, resulting in faster update speeds.
[0120] In this embodiment, only one rendering method needs to be developed for server-side rendering of different document views of the target document, instead of developing different rendering methods for different document views. This effectively reduces the development cost of server-side rendering of multiple views in online documents. Furthermore, the rendering file obtained by server-side rendering in this embodiment is a DOM string. Compared to the solution of obtaining a data structure through server-side rendering, the document client can directly present the corresponding document view by parsing the DOM string without secondary rendering. Data structures, on the other hand, require secondary rendering by the document client for initial display. This embodiment effectively shortens the initial display time of the document client. The DOM string in this application can work with an adaptive script file to adaptively display the document view as the document view window changes. Compared to the solution of directly obtaining an image of the document view through server-side rendering, where the image deforms with changes in the document view window, this embodiment is well-suited for document display scenarios with adaptive window requirements.
[0121] exist Figure 3 Based on the document processing method provided in the illustrated embodiments, this application provides a document processing method that mainly describes the document data rendering process and document data fragmentation. This document processing method can be executed by a computer device, which can be the document server 201 in the aforementioned document processing system. Figure 6 As shown, the document processing method may include the following steps S601-S607:
[0122] S601 receives a document display request from the document client.
[0123] The execution process of step S601 in this embodiment is the same as described above. Figure 3 The execution process of step S301 in the illustrated embodiment is the same; for details, please refer to the above. Figure 3 The description of step S301 in the illustrated embodiment will not be repeated here.
[0124] S602, based on the document display request, searches for the corresponding editing area rendering file in the cache space.
[0125] S603, if the target document's edit area rendering file under the target view type is successfully found in the cache space, then the edit area rendering file under the target view type is obtained from the cache space.
[0126] The execution process of steps S602 and S603 in this embodiment is the same as described above. Figure 3 The execution process of the relevant content in the illustrated embodiments is the same; for details, please refer to the above. Figure 3 The descriptions of the relevant content in the illustrated embodiments will not be repeated here.
[0127] S604 If the rendering file of the target document under the target view type is not found in the cache space, the first screen document data of the target document under the target view type is obtained, the first screen document data under the target view type is rendered, and the editing area rendering file under the target view type is obtained.
[0128] A key objective of this application is to improve the first-screen rendering time of the document client. The first screen refers to the content that is first presented in the document client. Therefore, when rendering, the document server does not need to render the entire document data, but can render the first-screen document data (also known as the first piece of document data). The first-screen document data refers to the document data corresponding to the document content that is first presented in the document client in the editing area of the document view. The first-screen document data is obtained by data fragmentation processing of the complete document data corresponding to the editing area of the document view. Specifically, obtaining the initial document data of a target document under the target view type can include: obtaining the complete document data of the target document under the target view type, and then performing data segmentation processing on the complete document data according to the document data segmentation information to obtain the initial document data of the target document under the target view type; wherein, the document data segmentation information can include data segmentation start information and data segmentation end information, or the document data segmentation information can include data segmentation start information and data segmentation length information. The document data segmentation information can be a default setting, or the document data segmentation information can be determined based on the document content presented in the editing area of the document view before the document view under the target view type was last closed; through data segmentation, the initial display time of the document client can be greatly shortened.
[0129] After obtaining the initial screen document data of the target document under the target view type, the initial screen document data of the target document under the target view type can be rendered to obtain the editing area rendering file of the target document under the target view type. This will be discussed in conjunction with... Figure 7 First, let's introduce the server-side rendering architecture and server-side rendering process of the document server:
[0130] The server-side rendering architecture of the document server can be described as follows: In the document server, each view type corresponds to a different rendering layer. That is to say, the document server can include a rendering layer corresponding to each view type. For example, the table view type corresponds to the table view rendering layer, and the Kanban view type corresponds to the Kanban view rendering layer. Each view type uses a common component rendering structure (DOM Widget structure) for its rendering layer. This common component rendering structure can include multiple rendering components (Widgets), each corresponding to a type of document content. Rendering components are used to render the corresponding type of document content. For example, the component rendering structure can include image components, rectangle components, polyline components, text components, and link components, etc. Image components can be used to render images (Image), rectangle components can be used to render rectangles (Rectangle), polyline components can be used to render polylines (Line), text components can be used to render text (Text), and link components can be used to render paths (Path). Each rendering component can use the same rendering mode; for example, all rendering components can use SVG rendering. Alternatively, each rendering component can use different rendering modes; for example, image and rectangle components can use DOM rendering, while polyline, text, and link components can use SVG rendering. Based on the above description of the server-side rendering architecture, each view type uses a common component rendering structure for its rendering layer. In other words, different view types use the same component rendering structure for server-side rendering. This way, only one component rendering structure needs to be developed, and there is no need to develop different component rendering structures for each view type. This can greatly reduce the development cost of multi-view server-side rendering on the document server.
[0131] The server-side rendering process of the document server can be described as follows: Taking the document view of the target document under the target view type as an example, after the document server obtains the first screen document data of the target document under the target view type, it can initiate a call request to the rendering cloud function, pass the first screen document data to the rendering cloud function. After the cloud function obtains the first screen document data, it can create a runtime environment (JSDOM (JavaScript (a programming language) DOM) runtime environment) and pass the first screen document data to the runtime environment. Then, the cloud function can call the rendering layer corresponding to the target view type. The rendering layer corresponding to the target view type can load the component rendering structure (DOMWidget structure) in the rendering engine (DOM rendering engine) to render the first screen document data, and obtain the editing area rendering file of the target document under the target view type.
[0132] Among them, rendering cloud functions are a type of cloud function, which is a function that runs in the cloud (server). In terms of physical design, a cloud function can consist of multiple files and occupy a certain amount of computing resources such as CPU (Central Processing Unit) and memory. Each cloud function is completely independent and can be deployed in different regions. Developers do not need to purchase or build servers. They only need to write function code and deploy it to the cloud for the client to call. At the same time, cloud functions can also call each other.
[0133] The document view under the target view type can contain multiple document contents. The first screen document data under the target view type can include the content data of multiple document contents. The process of the component rendering structure rendering the first screen document data can be described as follows: Each rendering component can be called to render the content data of the corresponding type of document content, resulting in rendering files for each document content. Then, the rendering files of each document content can be concatenated according to the rendering layout corresponding to the component rendering structure (also known as the rendering layout corresponding to the DOM rendering engine) to obtain the editing area rendering file under the target view type. As can be seen from the above, different view types use a common component rendering structure for server-side rendering. In other words, the first screen document data of the target document under different view types can all be rendered using a common component rendering structure.
[0134] This combination Figure 8This section introduces the rendering layout corresponding to the component rendering structure. For details, please refer to the following: The rendering layout corresponding to the component rendering structure can be a tree structure formed by expanding the root node (div.Stage node). The root node can include one or more layer nodes (div.Layer nodes), layer nodes can include one or more group nodes (div.Group nodes), and group nodes can include one or more child nodes. Each child node corresponds to a rendering file of document content. For example, the image child node (div.Image node) corresponds to the image rendering file, the rectangle child node (div.Rectangle node) corresponds to the rectangle rendering file, and so on. Line child nodes (div.Line node) correspond to the rendering file of the polyline, text child nodes (div.Text node) correspond to the rendering file of the text, link child nodes (div.Path node) correspond to the rendering file of the link, and so on. The rendering files of the document content corresponding to each child node within a group node can be concatenated to obtain the rendering file corresponding to the group node; the rendering files of each group node within a layer node can be concatenated to obtain the rendering file corresponding to the layer node; the rendering files of each layer node within a root node can be concatenated to obtain the rendering file corresponding to the root node. The rendering file corresponding to the root node can then be used as the rendering file for the editing area of the target document in the target view type.
[0135] The following section focuses on the rendering process of text content such as images, text, and polylines:
[0136] (1) Image rendering process. The rendering mode used when rendering images is DOM rendering. The rendering component can include an image component, the document content can include images, and the image content data can include image processing parameters (background-image). The image rendering process can be described as follows: The image component can be called to render the image content according to the processing parameters to obtain the rendered image file. The processing parameters include one or more of the following: scaling parameters, cropping parameters, rotation parameters, and translation parameters. The scaling parameters can include the image scaling ratio, which can be determined based on the image size and the size of the image display area. For example, it can be determined based on the width information of the image display area and the image... The scaling ratio is determined by the width information of the image, ensuring that the width of the scaled image is the same as the width of the image display area. Alternatively, the scaling ratio can be determined based on the length information of the image display area and the length information of the image, ensuring that the length of the scaled image is the same as the length of the image display area. Cropping parameters can include the cropping direction and the cropping length along that direction. The cropping direction can include the X-axis (length direction) and the Y-axis (width direction). Rotation parameters can include the rotation reference information and rotation angle information. Movement parameters can include the movement direction and the movement distance along that direction. The movement direction can include the X-axis (length direction) and the Y-axis (width direction). Figure 9 The image rendering effect is shown when image processing parameters include scaling and cropping parameters.
[0137] (2) Text rendering process. The first challenge in the server-side text rendering process is restoring the text font size. For example, this application supports a minimum font size of 10px (pixels), but document clients limit the minimum font size to 12px. Therefore, this embodiment uses SVG rendering to ensure consistency in font size between the server-side rendered text and the document client-side Canvas-rendered text. The second challenge is measuring the text width, as it differs from the client-side rendering method. Inaccurate text width measurement leads to inaccurate calculation of line breaks, resulting in noticeable jitter and deviation. Therefore, this embodiment proposes segmenting the text and measuring the width of each segment using Skia-Canvas (a width information measurement method). The width information of each segment is then accumulated to determine the final text width. This effectively avoids the impact of inaccurate character kerning (character spacing) measurement on text width measurement. Here, character kerning specifically refers to the spacing between two characters; different letter combinations have different spacing, such as... Figure 10An example of text word segmentation is shown. The text "我Hope is what keeps life going.[]" is segmented into word segments "我", "Hope", "is", "what", "keeps", "life", "going", and ".[]"; moreover, embodiments of the present application also support caching the width information of the measured word segments, so that when the relevant word segments are measured again, the cached width information can be directly used, avoiding repeated measurement and improving text rendering efficiency; in addition, for emoji (pictograph) emojis that cannot be accurately measured, embodiments of the present application propose that an emoji can be determined as a character with the same width as a Chinese character. That is to say, only the width information of one Chinese character needs to be measured to obtain the width information of the emoji.
[0138] The rendering component may include a text component. The document content may include text. The content data of the text may include the font parameters of the text; the rendering process of the text may include the following: the text component may be called to perform word segmentation on the text content, measure the width information of each word segment obtained by the word segmentation, and then the width information of the text content may be determined according to the width information of each word segment, and the text may be rendered according to the font parameters of the text content and the width information of the text content to obtain the rendering file of the text; among them, the font parameters may include, but are not limited to, any one or more of the following: text font information, text font size information, and text color information.
[0139] (3) The rendering process of the polyline. The border of the table background may be composed of multiple polylines. The rendering of the border of the table background can be decomposed into the rendering of multiple polylines that make up the border of the table background. The DOM rendering method does not support polyline drawing. Therefore, the rendering mode used by embodiments of the present application for rendering polylines is SVG rendering; the rendering component may include a polyline component. The document content may include a table. The content data of the table may include the coordinate data and fill color data of the table; the rendering process of the table, that is, the rendering process of the polyline, can be seen as follows: call the polyline component to determine the coordinate data of multiple polylines that make up the table based on the coordinate data of the table, and then, based on the fill color data of the table, determine the fill color data of multiple polylines. Each polyline can be rendered respectively according to the coordinate data and fill color data of each polyline to obtain the rendering file of each polyline. Then, according to the rendering files of each polyline, the rendering file of the table can be determined. Among them, after determining the coordinate data and fill color data of multiple polylines that make up the table, an SVG container can be created, and the coordinate data and fill color data of each polyline can be set in the SVG container to render each polyline to obtain the rendering file of each polyline.
[0140] It should be noted that the rendering methods for the title bar and toolbar are similar to those for the editing area. This application focuses on the rendering method for the editing area; the rendering methods for the title bar and toolbar can be found in the detailed description of the editing area's rendering method, and will not be repeated here. During the rendering of the various document contents that make up the document view, a common component rendering structure (DOM Widget structure) is used. This DOM Widget structure, combined with DOM rendering and SVG rendering, can accurately reproduce the document view rendered by Canvas in the document client on the document server. In addition, this application's embodiments can also support the document server to fully implement the document client's Canvas rendering using SVG rendering at a lower level. This solution is more versatile, but it is extremely difficult to implement, requires a huge amount of development work, and has relatively low accuracy.
[0141] S605, retrieve the toolbar rendering file under the target view type;
[0142] S606, perform concatenation processing on the editing area rendering file and the toolbar rendering file under the target view type to obtain the rendering file of the target document under the target view type.
[0143] The execution process of steps S605 and S606 in this embodiment is the same as described above. Figure 3 The execution process of the relevant content in the illustrated embodiments is the same; for details, please refer to the above. Figure 3 The descriptions of the relevant content in the illustrated embodiments will not be repeated here.
[0144] S607, send the rendered file of the target document under the target view type to the document client so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0145] In this embodiment, the execution process of step S607 is the same as described above. Figure 3 The execution process of step S303 in the illustrated embodiment is the same; for details, please refer to the above. Figure 3 The description of step S303 in the illustrated embodiment will not be repeated here.
[0146] This application supports data fragmentation. Through data fragmentation, the document server does not need to render the complete document data; it only needs to render the initial screen document data obtained from the data fragmentation process. This improves the rendering efficiency of the document server and effectively shortens the initial screen display time on the document client. Furthermore, in this application embodiment, the rendering files under different view types use the same rendering method. This can be understood as the rendering files under different view types being obtained by concatenating the toolbar rendering file and the editing area rendering file (or the title bar rendering file, toolbar rendering file, and editing area rendering file). Moreover, the editing area rendering files under different view types use a common component rendering structure for rendering. This not only reduces the development cost of multi-view server-side rendering but also effectively improves the efficiency of multi-view server-side rendering.
[0147] As mentioned above, a document server can be a server cluster or a distributed system composed of multiple physical servers. In one implementation, the document server may include a gateway service (BFF, Backend for Frontend), a rendering server, a resource server (DWS, Data Warehouse Service), and a middleware server. The gateway service can be proxy service software integrated into the rendering server, or a proxy service interface, etc. The following section will combine... Figure 11 This section describes the data interaction logic between the gateway service (BFF), the rendering server, the resource server (DWS), and the middleware server during server-side rendering. For example... Figure 11 As shown, the document processing method may include the following steps S1101-S1116:
[0148] S1101, the gateway service receives a document display request from the document client.
[0149] S1102, the gateway service generates a view information retrieval request based on the document display request, and sends the generated view information retrieval request to the rendering server.
[0150] As described above, a document display request may include the document set identifier of the document set to which the target document belongs, or it may include the document set identifier of the document set to which the target document belongs and the document identifier of the target document, or it may include the document set identifier of the document set to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type. The gateway service generates a view information retrieval request based on the document display request. Specifically, the gateway service generates a view information retrieval request based on the various identifiers contained in the document display request. That is, the view information retrieval request may include the document set identifier of the document set to which the target document belongs, or it may include the document set identifier of the document set to which the target document belongs and the document identifier of the target document, or it may include the document set identifier of the document set to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type.
[0151] S1103, the rendering server parses the view information retrieval request and obtains the view type identifier of the target view type.
[0152] When the view information retrieval request does not contain the type identifier (viewID) of the target view type, the rendering server can obtain the view type identifier of the target view type based on the document set identifier of the document set to which the target document belongs in the parsed view information retrieval request, or the document set identifier of the document set to which the target document belongs and the document identifier of the target document in the parsed view information retrieval request. When the view information retrieval request contains the type identifier of the target view type, the rendering server can directly parse the view information retrieval request to obtain the type identifier of the target view type.
[0153] S1104, the rendering server requests the view information of the document view under the target view type from the middleware server based on the view type identifier of the target view type.
[0154] The rendering server can send a further request to the middleware server based on the view type identifier of the target view type to obtain the view information (viewinfo) of the document view of the target document under the target view type. The view information may include the dynamic conditions corresponding to the document view of the target document under the target view type, the title name of the document collection to which the target document belongs, and other content.
[0155] S1105, the rendering server sends the view information of the document view of the target document under the target view type to the gateway service.
[0156] S1106, The gateway service sends the view information of the document view of the target document under the target view type to the resource server.
[0157] S1107, the resource server returns the toolbar rendering file of the target view type to the gateway service based on the view information of the document view of the target document under the target view type.
[0158] It should be noted that when deploying to the production environment, the pipeline can run and generate toolbar rendering files for each view type, and store these files on the resource server. Similarly, when the document view also includes a title bar, the pipeline can run and generate a title bar rendering file when deploying to the production environment, and store this file on the resource server.
[0159] The resource server can obtain the toolbar rendering file for the target view type based on the view information of the document view of the target document under the target view type. If the view information contains dynamic conditions of the document view of the target document under the target view type, the toolbar rendering file under the target view type can be updated according to the dynamic conditions to obtain an updated toolbar rendering file. Then, the updated toolbar rendering file is sent to the gateway service as the toolbar rendering file for the target view type. Similarly, when the document view also includes a title bar, the resource server can also obtain the title bar rendering file. If the view information contains the title name of the document collection to which the target document belongs, the title bar rendering file can be replaced based on the title name to obtain a replaced title bar rendering file. Then, the replaced title bar rendering file can be sent to the gateway service.
[0160] S1108, the gateway service sends a request to the rendering server to obtain the rendering file for the editing area.
[0161] S1109, The rendering server obtains the editing area rendering file corresponding to the document view of the target document under the target view type based on the request to obtain the editing area rendering file.
[0162] The request to obtain the editing area rendering file can include the document set identifier of the document set to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type. The rendering server can query the cache space for the editing area rendering file under the target view type based on the document set identifier of the document set to which the target document belongs, the document identifier of the target document, and the view type identifier of the target view type. If the editing area rendering file under the target view type is successfully found in the cache space, it can be obtained directly from the cache space. If the editing area rendering file under the target view type is not successfully found in the cache space, the server can obtain the first screen document data corresponding to the document view of the target document under the target view type, and render the first screen document data to obtain the editing area rendering file under the target view type.
[0163] S1110, the rendering server returns the edit area rendering file under the target view type to the gateway service.
[0164] S1111, the gateway service concatenates the edit area rendering file and the toolbar rendering file under the target view type to obtain the rendering file under the target view type.
[0165] When the document view also includes a title bar, the gateway service can concatenate the title bar rendering file, the editing area rendering file under the target view type, and the toolbar rendering file under the target view type to obtain the rendering file under the target view type.
[0166] S1112, the gateway service sends the rendered file of the target document under the target view type to the document client, so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0167] S1113, When the target document is edited, the middleware server receives the editing upstream data sent by the document client.
[0168] Editing upstream data can include edited document data and edited dynamic conditions. The middleware server can update the dynamic conditions stored in the middleware server according to the edited dynamic conditions so that the updated dynamic conditions can be directly returned when requested again. The middleware server can also obtain the updated first screen document data from the edited document data.
[0169] S1114, the middleware server sends the updated first-screen document data to the rendering server.
[0170] S1115, the rendering server requests the view type identifier of the target document under each view type from the middleware server.
[0171] S1116, The rendering server updates the editing area rendering files of the target document stored in the cache space under each view type based on the updated first screen document data and the view type identifier of the target document under each view type.
[0172] In this embodiment, the gateway service acts as an intermediary service between the document client and the rendering server, resource server, and middleware server. The rendering server, as the main execution device for server-side rendering, is responsible for generating rendering files for various view types. The resource server is used to store resource files during the document rendering process, such as toolbar rendering files, title bar rendering files, etc. The middleware server is used to manage view information. Through the cooperation between the gateway service, rendering server, resource server, and middleware server, the first-screen presentation efficiency of the document client can be greatly improved.
[0173] The methods of the embodiments of this application have been described in detail above. In order to facilitate better implementation of the above solutions of the embodiments of this application, the apparatus of the embodiments of this application is provided below.
[0174] Please see Figure 12 , Figure 12 This is a schematic diagram of the structure of a document processing device provided in an embodiment of this application. The document processing device can be installed in the computer equipment provided in the embodiment of this application, and the computer equipment can be the document server mentioned in the above method embodiment. Figure 12 The document processing apparatus shown may be a computer program (including program code) running on a computer device, which can be used to execute... Figure 3 , Figure 6 or Figure 11 Some or all of the steps in the method embodiments shown. Please refer to [link / reference]. Figure 12 The document processing apparatus may include the following units:
[0175] The communication unit 1201 is used to receive a document display request from a document client. The document display request is used to request the display of a document view of a target document under a target view type. The target document includes document views under one or more view types, and the target view type is one of one or more view types.
[0176] Processing unit 1202 is used to respond to a document display request and obtain the rendering file of the target document under the target view type; the document view of the target document under different view types corresponds to different rendering files, and the rendering files of the target document under various view types are rendered using the same rendering method;
[0177] The communication unit 1201 is also used to send the rendered file of the target document under the target view type to the document client, so that the document client can render the document view of the target document under the target view type based on the received rendered file.
[0178] In one implementation, the rendered file for any view type is formed by concatenating the rendered file of the editing area and the rendered file of the toolbar under that view type; the rendered file of the editing area is stored in a cache space; the processing unit 1202, when obtaining the rendered file of the target document under the target view type, specifically performs the following steps:
[0179] Based on the document display request, locate the corresponding editing area rendering file in the cache space;
[0180] If the target document's edit area rendering file under the target view type is successfully found in the cache space, then the edit area rendering file under the target view type is retrieved from the cache space.
[0181] Get the toolbar rendering file under the target view type;
[0182] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0183] In one implementation, when processing unit 1202 obtains the rendered file of the target document under the target view type, it is also used to perform the following steps:
[0184] If the rendering file of the target document under the target view type is not found in the cache space, then the first screen document data of the target document under the target view type is obtained;
[0185] Render the first screen document data under the target view type to obtain the editing area rendering file under the target view type;
[0186] Get the toolbar rendering file under the target view type;
[0187] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0188] In one implementation, the document view under the target view type contains multiple document contents, and the first screen document data under the target view type includes the content data of multiple document contents; the processing unit 1202 is used to render the first screen document data under the target view type to obtain the editing area rendering file under the target view type, specifically to perform the following steps:
[0189] Obtain the component rendering structure, which includes multiple rendering components, each corresponding to a type of document content;
[0190] Each rendering component is invoked to render the content data of the corresponding type of document content, resulting in a rendered file for each document content.
[0191] The rendering files of each document content are spliced together according to the rendering layout corresponding to the component rendering structure to obtain the editing area rendering file under the target view type.
[0192] The target document's initial screen data under different view types is rendered using a component rendering structure.
[0193] In one implementation, the rendering layout is a tree structure formed by expanding the root node. The root node includes one or more layer nodes, the layer nodes include one or more group nodes, and the group nodes include one or more child nodes. Each child node corresponds to a rendering file of document content. The processing unit 1202 is used to concatenate the rendering files of each document content according to the rendering layout. When obtaining the editing area rendering file under the target view type, it specifically performs the following steps:
[0194] The rendering files of the document content corresponding to each child node included in the group node are concatenated to obtain the rendering file corresponding to the group node.
[0195] The rendering files corresponding to each group node included in the layer node are concatenated to obtain the rendering file corresponding to the layer node.
[0196] The rendering files corresponding to each layer node included in the root node are concatenated to obtain the rendering file corresponding to the root node.
[0197] The rendering file corresponding to the root node is used as the rendering file for the editing area of the target document under the target view type.
[0198] In one implementation, the rendering component includes an image component, and the document content includes images; the image content data includes image processing parameters; the processing unit 1202 is used to call each component to render the document content of the corresponding type, and when obtaining the rendered files of each document content, it is specifically used to perform the following steps:
[0199] The image component is invoked to render the image according to the processing parameters, resulting in the rendered image file.
[0200] The processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and translation parameters.
[0201] In one implementation, the rendering component includes a text component, the document content includes text, and the text content data includes the font parameters of the text; the processing unit 1202 is used to call each component to render the document content of the corresponding type, and when obtaining the rendered file of each document content, it is specifically used to perform the following steps:
[0202] Call the text component to perform word segmentation on the text;
[0203] Measure the width information of each word obtained from the word segmentation process;
[0204] The width of the text is determined based on the width information of each word segment;
[0205] The text is rendered according to the font parameters and width information of the text content to obtain the rendered text file.
[0206] In one implementation, the rendering component includes a polyline component, the document content includes a table, and the table content data includes the table's coordinate data and fill color data; the processing unit 1202 is used to call each component to render the document content of the corresponding type, and when obtaining the rendered files of each document content, it is specifically used to perform the following steps:
[0207] The line component is invoked to determine the coordinate data of the multiple lines that make up the table, based on the coordinate data of the table.
[0208] Based on the fill color data of the table, determine the fill color data for multiple lines;
[0209] Each polyline is rendered based on its coordinate data and fill color data to obtain a rendering file for each polyline.
[0210] Determine the table's rendering file based on the rendering files of each polyline.
[0211] In one implementation, before the processing unit 1202 concatenates the editing area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, it also performs the following steps:
[0212] Perform dynamic condition detection on the toolbar rendering file;
[0213] If the detection result indicates that the toolbar rendering file has dynamic conditions, then the toolbar rendering file is updated based on the dynamic conditions to obtain the updated toolbar rendering file;
[0214] Processing unit 1202 is used to concatenate the editing area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type. Specifically, it performs the following steps:
[0215] The updated toolbar rendering file and the editing area rendering file under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0216] In one implementation, when processing unit 1202 obtains the first-screen document data of the target document under the target view type, it specifically performs the following steps:
[0217] Retrieve complete document data for the target document under the target view type;
[0218] The complete document data is segmented according to the document data segmentation information to obtain the first screen document data of the target document under the target view type.
[0219] In one implementation, the rendering file for any view type is formed by concatenating the editing area rendering file and the toolbar rendering file for that view type; the editing area rendering files of the target document under various view types are stored in a cache space; the processing unit 1202 is further configured to perform the following steps:
[0220] In response to editing operations on the target document in the document client, update the target document's edit area rendering file stored in the cache space under various view types.
[0221] In one implementation, when the communication unit 1201 sends the rendered file of the target document under the target view type to the document client, it specifically performs the following steps:
[0222] When a window adaptation requirement is detected in the document client, the window adaptation script file is retrieved.
[0223] The window adaptation script file and the target document's rendering file under the target view type are sent to the document client so that when the window shape of the document rendering window changes, the document client adapts to present the document view of the target document under the target view type in the document rendering window based on the window adaptation script file and the rendering file under the target view type.
[0224] According to another embodiment of this application, Figure 12 The various units in the document processing apparatus shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the document processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0225] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 3 , Figure 6 or Figure 11The computer program (including program code) for each step involved in some or all of the methods shown, to construct such... Figure 12 The document processing apparatus shown herein, and the document processing method for implementing the embodiments of this application, are described. A computer program may be recorded on, for example, a computer-readable storage medium, loaded onto the aforementioned computing device via the computer-readable storage medium, and executed therein.
[0226] In this embodiment, when a document client needs to display the document view of a target document (i.e., an online document) under a target view type, it can obtain the rendering file of the target document under the target view type and send it to the document client, so that the document client can quickly present the document view of the target document under the target view type based on the received rendering file. The target document may include document views under one or more view types, and the document views of the target document under various view types correspond to different rendering files. The rendering files of the target document under various view types are rendered using the same rendering method. That is to say, only one rendering method needs to be developed for server-side rendering of different document views of the target document, instead of developing different rendering methods for server-side rendering of different document views of the target document. This can effectively reduce the development cost of server-side rendering of multiple views in online documents.
[0227] Based on the above methods and apparatus embodiments, this application provides a computer device, which may be the aforementioned document server. Please refer to... Figure 13 , Figure 13 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 13 The computer device shown includes at least a processor 1301, an input interface 1302, an output interface 1303, and a computer-readable storage medium 1304. The processor 1301, input interface 1302, output interface 1303, and computer-readable storage medium 1304 can be connected via a bus or other means.
[0228] The input interface 1302 can be used to receive document display requests from the document client, receive document editing operations from the document client, etc.; the output interface 1302 can be used to output rendered files, window adaptation script files, etc. to the document client.
[0229] The computer-readable storage medium 1304 can be stored in the memory of a computer device. The computer-readable storage medium 1304 is used to store computer programs, including computer instructions. The processor 1301 is used to execute the program instructions stored in the computer-readable storage medium 1304. The processor 1301 (or CPU (Central Processing Unit)) is the computing and control core of the computer device, suitable for implementing one or more computer instructions, specifically suitable for loading and executing one or more computer instructions to achieve corresponding method flows or corresponding functions.
[0230] This application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both built-in storage media in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the operating system of the computer device. Furthermore, the storage space also stores one or more computer instructions suitable for loading and execution by a processor. These computer instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0231] In some embodiments, the processor 1301 may load and execute one or more computer instructions stored in the computer-readable storage medium 1304 to implement the aforementioned related... Figure 3 , Figure 6 or Figure 11 The corresponding steps of the document processing method shown are as follows. In a specific implementation, the computer instructions in the computer-readable storage medium 1304 are loaded by the processor 1301 and executed as follows:
[0232] Receive a document display request from a document client. The document display request is used to request the display of the document view of the target document under the target view type. The target document includes document views under one or more view types, and the target view type is one of one or more view types.
[0233] In response to a document display request, obtain the rendered file of the target document under the target view type; the document view of the target document under different view types corresponds to different rendered files, and the rendered files of the target document under various view types are rendered using the same rendering method;
[0234] The target document's rendered file under the target view type is sent to the document client, so that the document client can render the target document's document view under the target view type based on the received rendered file.
[0235] In one implementation, the rendered file for any view type is formed by concatenating the rendered file for the editing area and the rendered file for the toolbar under that view type; the rendered file for the editing area is stored in a cache space; when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to obtain the rendered file of the target document under the target view type, they are specifically used to perform the following steps:
[0236] Based on the document display request, locate the corresponding editing area rendering file in the cache space;
[0237] If the target document's edit area rendering file under the target view type is successfully found in the cache space, then the edit area rendering file under the target view type is retrieved from the cache space.
[0238] Get the toolbar rendering file under the target view type;
[0239] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0240] In one implementation, when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to obtain the rendered file of the target document under the target view type, they are also used to perform the following steps:
[0241] If the rendering file of the target document under the target view type is not found in the cache space, then the first screen document data of the target document under the target view type is obtained;
[0242] Render the first screen document data under the target view type to obtain the editing area rendering file under the target view type;
[0243] Get the toolbar rendering file under the target view type;
[0244] The rendering files of the editing area and the toolbar under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0245] In one implementation, the document view under the target view type contains multiple document contents, and the first screen document data under the target view type includes the content data of multiple document contents; when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to render the first screen document data under the target view type and obtain the editing area rendering file under the target view type, the following steps are specifically performed:
[0246] Obtain the component rendering structure, which includes multiple rendering components, each corresponding to a type of document content;
[0247] Each rendering component is invoked to render the content data of the corresponding type of document content, resulting in a rendered file for each document content.
[0248] The rendering files of each document content are spliced together according to the rendering layout corresponding to the component rendering structure to obtain the editing area rendering file under the target view type.
[0249] The target document's initial screen data under different view types is rendered using a component rendering structure.
[0250] In one implementation, the rendering layout is a tree structure formed by expanding the root node. The root node includes one or more layer nodes, the layer nodes include one or more group nodes, and the group nodes include one or more child nodes. Each child node corresponds to a rendering file of document content. When the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to concatenate the rendering files of each document content according to the rendering layout to obtain the editing area rendering file under the target view type, the following steps are specifically performed:
[0251] The rendering files of the document content corresponding to each child node included in the group node are concatenated to obtain the rendering file corresponding to the group node.
[0252] The rendering files corresponding to each group node included in the layer node are concatenated to obtain the rendering file corresponding to the layer node.
[0253] The rendering files corresponding to each layer node included in the root node are concatenated to obtain the rendering file corresponding to the root node.
[0254] The rendering file corresponding to the root node is used as the rendering file for the editing area of the target document under the target view type.
[0255] In one implementation, the rendering component includes an image component, and the document content includes images; the image content data includes image processing parameters; when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to render the document content of the corresponding type and obtain the rendered files of each document content, the following steps are specifically performed:
[0256] The image component is invoked to render the image according to the processing parameters, resulting in the rendered image file.
[0257] The processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and translation parameters.
[0258] In one implementation, the rendering component includes a text component, the document content includes text, and the text content data includes the font parameters of the text; when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to render the document content of the corresponding type and obtain the rendered files of each document content, the following steps are specifically performed:
[0259] Call the text component to perform word segmentation on the text;
[0260] Measure the width information of each word obtained from the word segmentation process;
[0261] The width of the text is determined based on the width information of each word segment;
[0262] The text is rendered according to the font parameters and width information of the text content to obtain the rendered text file.
[0263] In one implementation, the rendering component includes a polyline component, the document content includes a table, and the table's content data includes the table's coordinate data and fill color data; when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to render the document content of the corresponding type, and to obtain the rendered files of each document content, the following steps are specifically performed:
[0264] The line component is invoked to determine the coordinate data of the multiple lines that make up the table, based on the coordinate data of the table.
[0265] Based on the fill color data of the table, determine the fill color data for multiple lines;
[0266] Each polyline is rendered based on its coordinate data and fill color data to obtain a rendering file for each polyline.
[0267] Determine the table's rendering file based on the rendering files of each polyline.
[0268] In one implementation, before the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to perform the concatenation process between the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, the instructions are also used to perform the following steps:
[0269] Perform dynamic condition detection on the toolbar rendering file;
[0270] If the detection result indicates that the toolbar rendering file has dynamic conditions, then the toolbar rendering file is updated based on the dynamic conditions to obtain the updated toolbar rendering file;
[0271] When the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to perform the concatenation process of the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, the instructions specifically perform the following steps:
[0272] The updated toolbar rendering file and the editing area rendering file under the target view type are combined to obtain the rendering file of the target document under the target view type.
[0273] In one implementation, when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to obtain the first screen document data of the target document under the target view type, they are specifically used to perform the following steps:
[0274] Retrieve complete document data for the target document under the target view type;
[0275] The complete document data is segmented according to the document data segmentation information to obtain the first screen document data of the target document under the target view type.
[0276] In one implementation, the rendering file for any view type is formed by concatenating the editing area rendering file and the toolbar rendering file for that view type; the editing area rendering files of the target document under various view types are stored in a cache space; the computer instructions in the computer-readable storage medium 1304 are loaded by the processor 1301 and are also used to perform the following steps:
[0277] In response to editing operations on the target document in the document client, update the target document's edit area rendering file stored in the cache space under various view types.
[0278] In one implementation, when the computer instructions in the computer-readable storage medium 1304 are loaded and executed by the processor 1301 to send the rendered file of the target document under the target view type to the document client, they are specifically used to perform the following steps:
[0279] When a window adaptation requirement is detected in the document client, the window adaptation script file is retrieved.
[0280] The window adaptation script file and the target document's rendering file under the target view type are sent to the document client so that when the window shape of the document rendering window changes, the document client adapts to present the document view of the target document under the target view type in the document rendering window based on the window adaptation script file and the rendering file under the target view type.
[0281] In this embodiment, when a document client needs to display the document view of a target document (i.e., an online document) under a target view type, it can obtain the rendering file of the target document under the target view type and send it to the document client, so that the document client can quickly present the document view of the target document under the target view type based on the received rendering file. The target document may include document views under one or more view types, and the document views of the target document under various view types correspond to different rendering files. The rendering files of the target document under various view types are rendered using the same rendering method. That is to say, only one rendering method needs to be developed for server-side rendering of different document views of the target document, instead of developing different rendering methods for server-side rendering of different document views of the target document. This can effectively reduce the development cost of server-side rendering of multiple views in online documents.
[0282] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the document processing methods provided in the various alternative embodiments described above.
[0283] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A document processing method, characterized in that, The method includes: Receive a document display request from a document client, the document display request being used to request the display of a document view of a target document under a target view type; the target document includes document views under one or more view types, the target view type being one of the one or more view types; In response to the document display request, the system obtains the editing area rendering file of the target document under the target view type, obtains the general toolbar rendering file under the target view type, and concatenates the editing area rendering file and the toolbar rendering file under the target view type to obtain the rendering file of the target document under the target view type. The editing area rendering file under the target view type is obtained by rendering the first screen document data of the target document under the target view type. The first screen document data of the target document under different view types is rendered using the same component rendering structure, and different rendering components in the component rendering structure are used to render different types of document content. The target document's rendered file under the target view type is sent to the document client, so that the document client can render the target document's document view under the target view type based on the received rendered file.
2. The method as described in claim 1, characterized in that, The rendered edit area file is stored in the cache space; The step of obtaining the edit area rendering file of the target document under the target view type includes: Based on the document display request, the corresponding editing area rendering file is located in the cache space; If the target document's edit area rendering file under the target view type is successfully found in the cache space, then the edit area rendering file under the target view type is obtained from the cache space.
3. The method as described in claim 2, characterized in that, The step of obtaining the edit area rendering file of the target document under the target view type further includes: If the target document's rendering file for the target view type is not found in the cache space, then the first screen document data of the target document for the target view type is obtained. The first screen document data under the target view type is rendered to obtain the editing area rendering file under the target view type.
4. The method as described in claim 3, characterized in that, The document view under the target view type contains multiple document contents, and the first screen document data under the target view type includes the content data of the multiple document contents; The process of rendering the first screen document data under the target view type to obtain the editing area rendering file under the target view type includes: Obtain the component rendering structure, which includes multiple rendering components, each of which corresponds to a type of document content; Each rendering component is invoked to render the content data of the corresponding type of document content, resulting in a rendered file for each document content. The rendering files of each document content are spliced together according to the rendering layout corresponding to the component rendering structure to obtain the editing area rendering file under the target view type; The target document's first-screen document data under different view types is rendered using the component rendering structure.
5. The method as described in claim 4, characterized in that, The rendering layout is a tree structure formed by expanding a root node. The root node includes one or more layer nodes, the layer nodes include one or more group nodes, and the group nodes include one or more child nodes. Each child node corresponds to a rendering file of document content. The rendering files of each document content are concatenated according to the rendering layout corresponding to the component rendering structure to obtain the editing area rendering file under the target view type, including: The rendering files of the document content corresponding to each child node included in the group node are concatenated to obtain the rendering file corresponding to the group node. The rendering files corresponding to each group node included in the layer node are concatenated to obtain the rendering file corresponding to the layer node; The rendering files corresponding to each layer node included in the root node are concatenated to obtain the rendering file corresponding to the root node. The rendering file corresponding to the root node is used as the rendering file of the editing area of the target document under the target view type.
6. The method as described in claim 4, characterized in that, The rendering component includes an image component, and the document content includes images; the content data of the images includes the image processing parameters. The process of rendering the content data of the corresponding document type by calling each rendering component to obtain the rendering files of each document content includes: The image component is invoked to render the image according to the processing parameters to obtain the rendered image file; The processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and movement parameters.
7. The method as described in claim 4, characterized in that, The rendering component includes a text component, the document content includes text, and the text content data includes the font parameters of the text; the step of calling each rendering component to render the content data of the corresponding type of document content to obtain rendering files for each document content includes: The text component is invoked to perform word segmentation on the text. Measure the width information of each word obtained from the word segmentation process; The width information of the text is determined based on the width information of each word segment; The text is rendered according to the font parameters and width information of the text content to obtain the rendered text file.
8. The method as described in claim 4, characterized in that, The rendering component includes a polyline component, the document content includes a table, and the table content data includes the table's coordinate data and fill color data; the step of calling each rendering component to render the content data of the corresponding type of document content to obtain rendering files for each document content includes: The line component is invoked to determine the coordinate data of the multiple lines that make up the table based on the coordinate data of the table; Based on the fill color data of the table, determine the fill color data of the multiple polylines; Each polyline is rendered based on its coordinate data and fill color data to obtain the rendering file for each polyline. The rendering file of the table is determined based on the rendering files of each polyline.
9. The method as described in claim 1, characterized in that, Before concatenating the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type, the method further includes: Perform dynamic condition detection on the toolbar rendering file; If the detection result of the dynamic condition detection indicates that the toolbar rendering file has dynamic conditions, then the toolbar rendering file is updated based on the dynamic conditions to obtain the updated toolbar rendering file. The process of concatenating the edit area rendering file and the toolbar rendering file under the target view type to obtain the target document's rendering file under the target view type includes: The updated toolbar rendering file and the editing area rendering file under the target view type are combined to obtain the rendering file of the target document under the target view type.
10. The method as described in claim 3, characterized in that, The step of obtaining the first screen document data of the target document under the target view type includes: Obtain the complete document data of the target document under the target view type; The complete document data is segmented according to the document data segmentation information to obtain the first screen document data of the target document under the target view type.
11. The method as described in claim 1, characterized in that, The rendered file for any view type is formed by combining the rendered file for the editing area and the rendered file for the toolbar under that view type; the rendered files for the editing area of the target document under various view types are stored in the cache space; The method further includes: In response to an editing operation on the target document in the document client, update the edit area rendering files of the target document stored in the cache space under various view types.
12. The method as described in claim 1, characterized in that, Sending the rendered file of the target document under the target view type to the document client includes: When a window adaptation requirement is detected in the document client, the window adaptation script file is obtained; The window adaptation script file and the rendering file of the target document under the target view type are sent to the document client so that when the window shape of the document rendering window changes, the document client adaptively renders the document view of the target document under the target view type in the document rendering window based on the window adaptation script file and the rendering file under the target view type.
13. A document processing apparatus, characterized in that, The document processing device includes: A communication unit is configured to receive a document display request from a document client, the document display request being used to request the display of a document view of a target document under a target view type; the target document includes document views under one or more view types, and the target view type is one of the one or more view types; The processing unit is configured to, in response to the document display request, acquire the editing area rendering file of the target document under the target view type, acquire the general toolbar rendering file under the target view type, and concatenate the editing area rendering file and the toolbar rendering file under the target view type to obtain the rendering file of the target document under the target view type; the editing area rendering file under the target view type is obtained by rendering the first screen document data of the target document under the target view type; the first screen document data of the target document under different view types is rendered using the same component rendering structure, and different rendering components in the component rendering structure are used to render different types of document content; The communication unit is further configured to send the rendered file of the target document under the target view type to the document client, so that the document client can present the document view of the target document under the target view type based on the received rendered file.
14. A computer device, characterized in that, The computer device includes: A processor is a tool for implementing computer programs. A computer-readable storage medium storing a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1-12.
16. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a processor, implement the document processing method as described in any one of claims 1-12.
Citation Information
Patent Citations
Client view drawing method and device
CN110020307A
Page processing method and device, computer device and storage medium
CN110442811A
Webpage rendering architecture and method
CN114254223A