CN117407618A - Document processing method, device, computer equipment, storage medium and program product - Google Patents
Document processing method, device, computer equipment, storage medium and program product Download PDFInfo
- Publication number
- CN117407618A CN117407618A CN202210794646.6A CN202210794646A CN117407618A CN 117407618 A CN117407618 A CN 117407618A CN 202210794646 A CN202210794646 A CN 202210794646A CN 117407618 A CN117407618 A CN 117407618A
- Authority
- CN
- China
- Prior art keywords
- document
- rendering
- target
- under
- view type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F16/986—Document structures and storage, e.g. HTML extensions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
Abstract
The embodiment of the application provides a document processing method, a document processing device, computer equipment, a storage medium and a program product. The method comprises the following steps: receiving a document display request of a document client, wherein the document display request is used for requesting to display a document view of a target document under a target view type; the target document includes a document view under one or more view types; responding to a document display request, and acquiring a rendering file of a target document under a target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode; and sending the rendering 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 rendering file. By adopting the embodiment of the application, the development cost of multi-view server rendering in the online document can be effectively reduced.
Description
Technical Field
The present 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
With the rapid development of computer technology, SSR (Server-Side Rendering) is widely applied to various Rendering scenes, and SSR refers to a process of completing the page processing technology of HTML (Hyper Text Markup Language ) structure splicing of a page by a Server, sending the page processing technology to a browser, and then binding a state and an event for the browser to become a fully interactable page. When the SSR is applied to the rendering scene of the online document, the first screen rendering time of the online document can be effectively shortened, and the rendering forms of the online document are rich and various, so that the development cost of the rendering of the server side in the online document is high, and therefore, how to reduce the development cost of the rendering of the server side in the online document becomes a current research hotspot.
Disclosure of Invention
The embodiment of the application provides a document processing method, a document processing device, computer equipment, a storage medium and a program product, which can effectively reduce the development cost of multi-view server rendering in an online document.
In one aspect, an embodiment of the present application provides a document processing method, including:
receiving a document display request from a document client, wherein the document display request is used for requesting to display a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
responding to a document display request, and acquiring a rendering file of a target document under a target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
and sending the rendering 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 rendering file.
Accordingly, an embodiment of the present application provides a document processing apparatus, including:
a communication unit configured to receive a document display request from a document client, the document display request being for requesting display of a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
The processing unit is used for responding to the document display request and acquiring a rendering file of the target document under the target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
and the communication unit is also used for sending the rendering 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 rendering file.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; the editing area rendering file obtained by rendering is stored in a cache space; the processing unit is used for acquiring the rendering file of the target document under the target view type, and is specifically used for executing the following steps:
searching a corresponding editing area rendering file in a cache space based on a document display request;
if the editing area rendering file of the target document under the target view type is successfully searched in the cache space, acquiring the editing area rendering file under the target view type from the cache space;
Acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, the processing unit is configured to, when acquiring a rendering file of the target document under the target view type, further perform the following steps:
if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type;
acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, a document view under a target view type contains a plurality of document contents, and first screen document data under the target view type includes content data of the plurality of document contents; the processing unit is used for rendering the first screen document data under the target view type, and when the editing area rendering file under the target view type is obtained, the processing unit is specifically used for executing the following steps:
Acquiring a component rendering structure, wherein the component rendering structure comprises a plurality of rendering components, and each rendering component corresponds to one type of document content;
respectively calling each rendering component to render the content data of the document content of the corresponding type to obtain rendering files of the document content;
splicing the rendering files of the document contents according to the rendering layout corresponding to the component rendering structure to obtain an editing area rendering file under the target view type;
the first screen document data of the target document under different view types are rendered by adopting a component rendering structure.
In one implementation, the rendering layout is a tree structure formed by expanding a root node, the root node comprises one or more layer nodes, the layer nodes comprise one or more grouping nodes, the grouping nodes comprise one or more child nodes, and one child node corresponds to a rendering file of document content; the processing unit is used for performing splicing processing on the rendering files of the document contents according to the rendering layout, and when the editing area rendering file under the target view type is obtained, the processing unit is specifically used for executing the following steps:
splicing the rendering files of the document content corresponding to each child node included in the grouping node to obtain the rendering files corresponding to the grouping node;
Splicing rendering files corresponding to each grouping node included in the layer node to obtain rendering files corresponding to the layer node;
splicing rendering files corresponding to each layer node included by the root node to obtain rendering files corresponding to the root node;
and using the rendering file corresponding to the root node as an editing area rendering file of the target document under the target view type.
In one implementation, the rendering component includes a picture component, and the document content includes a picture; the content data of the picture comprises processing parameters of the picture; the processing unit is used for respectively calling each component to render the document content of the corresponding type, and is particularly used for executing the following steps when rendering files of the document content are obtained:
invoking a picture component to render the picture according to the processing parameters to obtain a rendering file of the picture;
wherein the processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and movement parameters.
In one implementation, the rendering component includes a text component, the document content includes text, and the content data of the text includes font parameters of the text; the processing unit is used for respectively calling each component to render the document content of the corresponding type, and is particularly used for executing the following steps when rendering files of the document content are obtained:
Calling a text component to perform word segmentation processing on the text;
measuring width information of each word segmentation obtained by word segmentation processing;
determining width information of the text according to the width information of each word;
and rendering the text according to the font parameters of the text content and the width information of the text content to obtain a rendering file of the text.
In one implementation, the rendering component includes a polyline component, the document content includes a table, and the content data of the table includes coordinate data and fill color data of the table; the processing unit is used for respectively calling each component to render the document content of the corresponding type, and is particularly used for executing the following steps when rendering files of the document content are obtained:
invoking a broken line component to determine coordinate data of a plurality of broken lines forming the table based on the coordinate data of the table;
determining fill color data for the plurality of polylines based on the fill color data of the form;
rendering each broken line according to the coordinate data and the filling color data of each broken line to obtain a rendering file of each broken line;
and determining the rendering file of the table according to the rendering file of each folding line.
In one implementation, the processing unit is configured to perform a stitching process on the editing area rendering file under the target view type and the toolbar rendering file under the target view type, and before obtaining the rendering file of the target document under the target view type, the processing unit is further configured to perform the following steps:
Detecting dynamic conditions of the toolbar rendering file;
if the detection result indicates that the dynamic condition exists in the toolbar rendering file, updating the toolbar rendering file based on the dynamic condition to obtain an updated toolbar rendering file;
the processing unit is used for performing splicing processing on 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 of the target document under the target view type, and is specifically used for executing the following steps:
and splicing the updated toolbar rendering file and the editing area rendering file under the target view type to obtain the rendering file of the target document under the target view type.
In one implementation, the processing unit is configured to, when acquiring first-screen document data of the target document under the target view type, specifically perform the following steps:
acquiring complete document data of a target document under a target view type;
and performing data slicing processing on the complete document data according to the document data slicing information to obtain the first screen document data of the target document under the target view type.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; editing zone rendering files of the target document under various view types are stored in a cache space; the processing unit is further used for executing the following steps:
And in response to the editing operation for the target document in the document client, updating the editing region rendering file of the target document stored in the cache space under various view types.
In one implementation, the communication unit is configured to, when sending the rendering file of the target document under the target view type to the document client, specifically perform the following steps:
when detecting that the window self-adaptation requirement exists on the document client, acquiring a window self-adaptation script file;
and sending the rendering files of the window self-adaptive script file and the target document under the target view type to the document client so that the document client can adaptively present the document view of the target document under the target view type in the document presentation window of the document client based on the rendering files of the window self-adaptive script file and the target view type when the window shape of the document presentation window changes.
Accordingly, embodiments of the present application provide a computer device comprising:
a processor adapted to implement a computer program;
a computer readable storage medium storing a computer program adapted to be loaded by a processor and to perform the document processing method described above.
Accordingly, embodiments of the present 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 execute the above-described document processing method.
Accordingly, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the document processing method described above.
In the embodiment of the application, when the document client has a requirement of displaying the document view of the target document (i.e. the online document) under the target view type, the rendering file of the target document under the target view type can be acquired, and the rendering file of the target document under the target view type is sent 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 can comprise one or more document views under different view types, the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode, that is, only one set of rendering modes need to be developed to render different document views of the target document at the server side, and different rendering modes do not need to be developed for different document views of the target document at the server side, so that the development cost of multi-view server side rendering in the online document can be effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic illustration of a plurality of document views of an intermediate online document provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a document processing system according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of a document processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of the composition of a document view provided by an embodiment of the present application;
FIG. 5 is a dynamic condition replacement schematic diagram of a toolbar provided by an embodiment of the present application;
FIG. 6 is a flow chart of another document processing method provided in an embodiment of the present application;
fig. 7 is a schematic diagram of a server rendering architecture according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a rendering layout provided by an embodiment of the present application;
Fig. 9 is a schematic diagram of a picture rendering effect provided in an embodiment of the present application;
FIG. 10 is a schematic diagram of a text word segmentation result provided in an embodiment of the present application;
FIG. 11 is a schematic flow chart of processing logic of a document server according to an embodiment of the present application;
FIG. 12 is a schematic view of a document processing apparatus according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
In order to more clearly understand the document processing scheme provided in the embodiments of the present application, key terms related to the embodiments of the present application are described herein:
(1) An online document. An online document refers to a file generated after online editing of document content in a document client, which may include, but is not limited to, the following: text, pictures, lines, links, etc.; the online editing can be understood that the document content generated by any editing operation in the online document is synchronized to the cloud (i.e., server) for storage; the online document supports the collaborative editing of a plurality of (i.e., two or more) document editing objects, and the collaborative editing of the online document by the plurality of document editing objects can be understood that the plurality of document editing objects can edit the same online document, and any document editing object can view the document contents edited by other document editing objects besides the document contents edited by itself.
The online document can be any one of an online Word document (an online text document), an online Excel document (an online form document), an online PPT document (a presentation document) and the like; an online document may include a document view under one or more view types that are rendered from homologous data, that is, the document view under one or more view types is a different presentation of the homologous data. Particularly, when the online document is an online Excel document, the online Excel document can be a Smart Sheet document, the Smart Sheet document can also be called a multidimensional data Sheet, and is a database-type electronic table, the data format of each column can be controlled through a field, each row is used as a data record, a row-column structured data structure is provided, and the Smart Sheet document can convert homologous data into different view types, so that the requirements of different scenes are met; for example, FIG. 1 shows a document view of a smart form under four view types, 101 shown in the first row and first column is a document view of a smart form under a form view type, 102 shown in the second row and first column is a document view of a smart form under a billboard view type, 103 shown in the second row and first column is a document view of a smart form under a Gantt view type, and 104 shown in the second row and second column is a document view of a smart form under a album view type.
A document client refers to a program corresponding to a document service end and providing a document processing service for a document editing object, for example, the document client may be a browser, an application program, an SPA (Single Page Web Application, single page Web application program) or the like, and the SPA refers to an application program having only one Web page, and is a Web application program that loads a single HTML page and dynamically updates the page when a user interacts with the application program. The document server refers to a program that serves a document client, and a device that the document server operates on is often referred to as a document server.
(2) SSR (Server-Side Rendering), server Rendering. For an online document, the rendering of the server refers to the process that the document server renders the document view under each view type in the online document and sends the rendered rendering file to the document client for rendering. For online documents, CSR (Client-Side Rendering) refers to the process of downloading a resource file at a document Client, rendering a document view under each view type in the online document, and binding states and events for the document view. SSR has a more friendly SEO (Search Engine Optimization ) and faster head screen loading speed than CSR, which is a way to obtain the natural search result ranking of a search engine by optimizing web site content.
Based on the related description of the key terms, the embodiment of the application provides a document processing scheme, and the document processing scheme develops a set of rendering modes which can support the service end to render the document views of the online document under different view types, that is, the document views of the online document under different view types are rendered by the document service end by adopting a general rendering mode, and different rendering modes do not need to be developed for the document views under each view type, so that the development cost of rendering of the online document multi-view service end can be effectively reduced. In addition, the document processing scheme supports rendering caching, rendering files obtained by rendering are stored in a cache space, when a certain document view of an online document requested to be displayed is rendered, a document server can directly acquire the rendering file corresponding to the document view from the cache space and send the rendering file to a document client, so that the document client can quickly present the corresponding document view based on the received rendering file, and the first screen loading speed of the online document is greatly improved. In addition, in the document processing scheme, the document server side can support the rendering of various types of document contents through DOM (Document Object Model ) rendering (a rendering mode of a server side) and/or SVG (Scalable Vector Graphics, extensible vector graphics) rendering (a rendering mode of another server side), so that a document view obtained by the rendering of the server side can accurately restore a document view obtained by a document client side through Canvas rendering (a rendering mode of the client side).
The document processing system provided in the embodiment of the present application is described below with reference to fig. 2. The document processing system shown in fig. 2 may include a document server 201 and a terminal device 202, which is not limited in the embodiment of the present application, and the number of terminal devices 202 may be one or more, and a direct communication connection may be established between the document server 201 and the terminal device 202 by means of wired communication, or an indirect communication connection may be established by means of wireless communication, which is not limited in the embodiment of the present application. Wherein:
(1) Terminal device 202. The terminal device may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, an intelligent voice interaction device, a smart watch, a vehicle-mounted terminal, an intelligent home appliance, an aircraft, a wearable device, and the like.
The terminal device is provided with a document client, the document client can respond to the document display operation of the document editing object to generate a document display request, and the document display request is sent to the document server through the terminal device, wherein the document display request is used for requesting to display the document view of the target document under a certain view type, and the target document is an online document. After receiving the rendering file under the corresponding view type sent by the document server through the terminal equipment, the document client can present the document view displayed by the request based on the received rendering file.
(2) The document server 201. The document server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing 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 ), basic cloud computing services such as big data and an artificial intelligent platform, which is not limited in the embodiments of the present application.
The document server is operated with a document server, after receiving a document display request sent by a document client through a terminal device by the document server, if a document view of a target document requested to be displayed is rendered under a certain view type, the document server can directly acquire a rendering file corresponding to the corresponding view type from a cache space and send the acquired rendering file to the document client; if the document view of the target document in a certain view type is not rendered, the document server side can acquire the document data in the corresponding view type, render the document data according to a developed general rendering mode, and send a rendering file obtained by rendering to the document client side.
As shown in fig. 2, the document client requests to display a document view of the target document in the table view type, the document server sends a rendering file of the target document in the table view type to the document client, and the document client presents a document view of the target document in the table view type based on the rendering file of the target document in the table view type, a document view of the target document in the billboard view type, a document view of the target document in the Gantt view type, and a document view of the target document in the album view type, which are similar to those of the target document in the table view type, and will not be described herein.
According to the document processing system provided by the embodiment of the application, the development cost of rendering the target document by the document server for the multi-view server is greatly reduced, the document client can support the abundant view types of the rendering target document, and the first screen rendering time of various view types in the document client is greatly shortened. It may be understood that, the document processing system described in the embodiments of the present application is for more clearly describing the technical solution of the embodiments of the present application, and does not constitute a limitation on the technical solution provided in the embodiments of the present application, and those skilled in the art can know that, with the evolution of the system architecture and the appearance of a new service scenario, the technical solution provided in the embodiments of the present application is equally applicable to similar technical problems.
The document processing scheme provided in the embodiment of the present application is described in detail below with reference to fig. 3 to 11.
The embodiment of the application provides a document processing method, which mainly introduces a mode of acquiring a rendering file corresponding to a document view of a target document requested to be displayed by a document client under a target view type, updates the rendering file of the target document under each view type after the target document is edited, and performs window self-adaptive display and the like on the document view. The document processing method may be performed by a computer device, which may be the document server 201 in the document processing system described above. As shown in fig. 3, the document processing method may include the following steps S301 to S303:
s301, receiving a document display request from a document client.
The document server may receive a document display request from a document client, the document display request may be used to request to display a document view of a target document under a target view type, the target document may include a document view under one or more view types, the target view type is one of the one or more view types, wherein the document view refers to a presentation form of the target document, the document view under a different view type refers to a different presentation form of the target document, an emphasis presented by the document view under a different view type is different, for example, an emphasis presented by 101 (i.e., a document view under a table view type) shown in fig. 1 is an overall emphasis, an emphasis presented by 102 (i.e., a document view under a billboard view type) shown in fig. 1 is a grouping, an emphasis presented by 103 (i.e., a document view under a gantt view type) shown in fig. 1 is an emphasis presented by a key time point and a time progress, and so on; the target document belongs to a document collection, one or more documents can be included in the document collection, and the target document is one of the one or more documents.
S302, responding to a document display request, and acquiring a rendering file of a target document under a target view type.
Before the introduction step S302, the composition of the document view is described herein, and as shown in fig. 4, the document view under the form view type is taken as an example, and the document view may include, but is not limited to, any one or more of the following: title bar 401, toolBar (ToolBar) (which may include top ToolBar 402 and bottom ToolBar 403), table bulletin 404, editor 405, etc.; wherein:
the title bar 401 may be used to present the title 4011 of the document collection to which the target document belongs (e.g., a "table" as shown in fig. 4), and to provide the document editing object with an operation option 4012 of the document collection to which the target document belongs (e.g., a "share" option may be used to share the document collection, a first left option of the "share" option may be used to set the operation authority of the document collection, a second left option of the "share" option may be used to set the watermark of the document collection, a third left option of the "share" option may be used to provide a function option of the document collection (e.g., a function option to store a revision record of the document collection, a function option to view a browse record of the document record, etc.)). The bottom toolbar 403 may be used to switch different documents in a document collection, and the bottom toolbar 403 may also include a document creation option 4031 for creating a document in the document collection. The top toolbar 402 may include a view type switch option 4021 for switching different view types, and an operation option 4022 for the document (e.g., an "add line" may be used to add a line record for the document, a "group" option may be used to set grouping conditions for the document, a "filter" option may be used to set filtering conditions for the document, a "hide column" option may be used to set hidden columns, an "bulletin" option may be used to set display or not display table bulletins, etc.). The table bulletin 404 may be used to present published notification information about the document. The editor 405 may be used to provide an area for editing specific document content.
Accordingly, the rendering file corresponding to the document view under either view type may be composed of any one or more of the following: a title bar rendering file, a toolbar rendering file, a table bulletin rendering file, and an editor rendering file; the title bar rendering file is a file obtained by rendering the document data corresponding to the title bar, and the title bar can be presented by the document client through analyzing 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 present the toolbar by analyzing the toolbar rendering file; the table bulletin and the editor can be collectively called an editing area, the table bulletin rendering file and the editor rendering file can be collectively called an editing area rendering file, the editing area rendering file is obtained by rendering the document data (namely, the first screen document data) corresponding to the editing area, and the document client can present the editing area by analyzing the editing area rendering file. It should be noted that, the title bars corresponding to different document sets are similar, there may be differences in title names, the document data corresponding to the title bars may be rendered to obtain a general title bar rendering file, the title name in the general title bar rendering file is a default title name, and for the document set edited with the title name, the edited title name may be used to replace the title part in the general title bar rendering file, so that the corresponding title bar rendering file may be obtained; similar to the title bar, the toolbar of the document view under the same view type is similar, and the document data corresponding to the toolbar under the same view type can be rendered to obtain a universal toolbar rendering file under the view type. The table bulletin and the editor can be collectively called an editing area, the document content in the editing area of the document view under different view types is usually different, the rendering is required to be carried out independently, the rendering is carried out to obtain an editing area rendering file, the rendering obtained editing area rendering file can be stored in a buffer space, the buffer space can be a Redis buffer, for example, and the Redis buffer is a high-performance key-value database.
In step S302, after receiving the document display request from the document client, the document server may respond to the document display request to obtain a rendering file of the target document under the target view type, where the document views of the target document under the various view types correspond to different rendering files, and the rendering files of the target document under the various view types may be rendered by using the same rendering method.
When the document view includes a toolbar and an editing area, obtaining a rendering file of the target document under the target view type in response to the document display request may include: searching a corresponding editing area rendering file in a cache space based on a document display request; if the editing area rendering file of the target document under the target view type is successfully searched in the cache space, acquiring the editing area rendering file under the target view type from the cache space; if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type, wherein the editing area rendering file under the target view type obtained by rendering can be stored in a cache space so as to be directly acquired from the cache space when display is requested next time; acquiring a toolbar rendering file under a target view type; the editing area rendering file under the target view type and the toolbar rendering file under the target view type are spliced to obtain the rendering file of the target document under the target view type, wherein the splicing processing mentioned here may refer to that the editing area rendering file and the toolbar rendering file are combined according to a certain sequence, the sequence mentioned here may refer to the presentation sequence of the editing area and the toolbar in the document view, for example, the attention of the document editing object to the editing area in the document view is higher than that of the toolbar, and the presentation sequence of the editing area may precede the toolbar, that is, the combination sequence of the editing area rendering file is located before the combination sequence of the toolbar rendering file.
When the document view includes a title bar, a toolbar, and an editing area, obtaining a rendering file of the target document under the target view type in response to the document display request may include: searching a corresponding editing area rendering file in a cache space based on a document display request; if the editing area rendering file of the target document under the target view type is successfully searched in the cache space, acquiring the editing area rendering file under the target view type from the cache space; if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type, wherein the editing area rendering file under the target view type obtained by rendering can be stored in a cache space so as to be directly acquired from the cache space when display is requested next time; acquiring a toolbar rendering file under a target view type and acquiring a title bar rendering file; splicing the editing area rendering file under the target view type, the toolbar rendering file under the target view type and the title bar rendering file to obtain the rendering file of the target document under the target view type, and similarly, the splicing process mentioned herein may refer to combining the editing area rendering file, the toolbar rendering file and the title bar rendering file in a certain order, and the order mentioned herein may refer to the presentation order of the editing area, the toolbar and the toolbar in the document view.
As can be seen from the foregoing, the cache space is a key-value database, that is, the edit section rendering file is stored in the cache space in a key-value pair, the keys in the key-value pair are a document set identifier (padID), a document identifier (usetid), and a view type identifier (viewID), and the values in the key-value pair are the edit section rendering file. Based on this, searching for the corresponding edit section rendering file in the cache space based on the document display request may include the following:
in one implementation, the document display request may include a document set identifier of a document set to which the target document belongs, and the document identifier of the target document may be obtained based on the document set identifier of the document set to which the target document belongs, and the view type identifier of the target view type, where the document set to which the target document belongs is a document set to which the document editing object requests to be displayed, the target document is a default display document in the document set, for example, the default display document is a first document created in the document set, a last document created in the document set, or the like, or the target document is a last open document in the document set before the document set is closed last time, the view type of the target view is a view type displayed by default, for example, the view type displayed by default is a view type created first in the target document, a view type created last in the target document last time, or the target view type is a view type opened last in the target document before the target document is closed last time, for example, when the document editing object requests to open the document set. Then, the editing area rendering file of the target document under the target view type can be searched in the cache space based on the document set identification of the document set to which the target document belongs, the document identification of the target document and the view type identification of the target view type.
In another implementation, the document display request may include a document set identifier of a document set to which the target document belongs and a document identifier of the target document, and the view type identifier of the target view type may be obtained based on the document set identifier of the document set to which the target document belongs and the document identifier of the target document, in which case the document set to which the target document belongs is a document set for which the document editing object requests to be displayed, the target document is a document for which the document editing object requests to be displayed in the document set, the target view type is a view type for which a default display in the target document is displayed, or the target view type is a view type for which a last opening in the target document was before the target document was closed last time, for example, when the document editing object requests to open the target document in the document set. Then, the editing area rendering file of the target document under the target view type can be searched in the cache space based on the document set identification of the document set to which the target document belongs, the document identification of the target document and the view type identification of the target view type.
In another implementation, the document display request may include a document set identifier of a document set to which the target document belongs, a document identifier of the target document, and a view type identifier of a target view type, in which case the document set to which the target document belongs is a document set to which the document editing object requests display, the target document is a document to which the document editing object requests display in the document set, and the target view type is a view type to which the document editing object requests display in the target document, such as when the document editing object requests opening a document view of the target document in the document set under the target view type. Then, the editing area rendering file of the target document under the target view type can be searched in the cache space based on the document set identification of the document set to which the target document belongs, the document identification of the target document and the view type identification of the target view type.
From the foregoing, it can be seen that the toolbar rendering files under different view types are different, and the toolbar rendering files are obtained in a similar manner to the editing area rendering files, so that the toolbar rendering files under the target view type can be obtained based on the view type identifier of the target view type. After the toolbar rendering file under the target view type is obtained, dynamic condition detection can be carried out on the toolbar rendering file, if the detection result indicates that the toolbar rendering file has dynamic conditions, the toolbar rendering file can be updated based on the dynamic conditions, and the updated toolbar rendering file is obtained; if the detection result indicates that the toolbar rendering file does not have a dynamic condition, the toolbar rendering file can be kept unchanged. Wherein the dynamic condition refers to a setting condition associated with document contents in an editing area in a document view, for example, the aforementioned grouping condition, screening condition, hiding condition, table announcement setting condition, and the like; the top toolbar 501 shown in fig. 5 is a toolbar under a general table view type, and the top toolbar 502 is a toolbar after dynamic condition substitution is performed on the top toolbar 501, and the replaced dynamic condition is a grouping condition. In this way, a toolbar rendering file is not required to be rendered for each document view, but a toolbar rendering file is generally used for the same document view type, and when dynamic conditions exist in the toolbar rendering file, only the toolbar rendering file with the dynamic conditions is required to be simply replaced, so that on one hand, the rendering resources of a document server are saved, and on the other hand, the rendering speed of the document server is greatly improved.
As is clear from the foregoing, the title bar rendering files of all the document sets are common to the title bar, and for the document sets for which the title contents are edited, only the title name of the title bar rendering file needs to be replaced, in other words, the title name of the title bar rendering file needs to be replaced. In this way, a title bar rendering file is not required to be rendered for each document set, but is generally used for all the document sets, and when the title bar rendering file needs to be subjected to title replacement, only the title bar rendering file needs to be subjected to simple title replacement, so that on one hand, the rendering resources of the document server are saved, and on the other hand, the rendering speed of the document server is greatly improved.
Therefore, when the document view includes a toolbar and an editing area, the editing area rendering file under the target view type and the toolbar rendering file under the target view type are spliced to obtain the rendering file of the target document under the target view type, which may include any one of the following two cases: in the first case, if the toolbar rendering file has a dynamic condition, the toolbar rendering file under the target view type after being updated by the dynamic condition and the editing area rendering file under the target view type can be spliced to obtain the rendering file of the target document under the target view type; in the second case, if the toolbar rendering file does not have a dynamic condition, the toolbar rendering file under the target view type and the editing area rendering file under the target view type can be directly spliced to obtain the rendering file of the target document under the target view type.
When the document view includes a title bar, a toolbar and an editing area, the editing area rendering file under the target view type, the toolbar rendering file under the target view type and the title bar rendering file are spliced to obtain a rendering file of the target document under the target view type, which may include any one of the following four cases: in the first case, if the toolbar rendering file does not have a dynamic condition and the title bar rendering file does not need to be subjected to title replacement, the editing area rendering file under the target view type, the toolbar rendering file under the target view type and the title bar rendering file can be directly subjected to splicing processing to obtain the rendering file of the target document under the target view type; in the second case, if the toolbar rendering file does not have a dynamic condition and the title bar rendering file needs to be subjected to title replacement, splicing the editing area rendering file under the target view type, the toolbar rendering file under the target view type and the title bar rendering file subjected to title replacement to obtain a rendering file of the target document under the target view type; in the third case, if the toolbar rendering file has a dynamic condition and the title bar rendering file does not need to be subjected to title replacement, splicing the editing area rendering file under the target view type, the toolbar rendering file under the target view type after the dynamic condition is updated and the title bar rendering file to obtain the rendering file of the target document under the target view type; in the fourth case, if the toolbar rendering file has a dynamic condition and the title bar rendering file needs to be subjected to title replacement, the editing area rendering file under the target view type, the toolbar rendering file under the target view type after being updated by the dynamic condition, and the title bar rendering file after being subjected to title replacement can be subjected to splicing processing, so that the rendering file of the target document under the target view type is obtained.
S303, sending the rendering 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 rendering file.
After the rendering file of the target document under the target view type is acquired, the rendering file of the target document under the target view type can be sent 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 rendering file.
When the window self-adaptation requirement of the document client is detected, a window self-adaptation script file can be obtained, and then the rendering file of the window self-adaptation script file and the target document under the target view type is sent to the document client, so that when the window shape of the document client in the document presentation window changes, the document view of the target document under the target view type is self-adaptively presented in the document presentation window of the document client based on the window self-adaptation script file and the rendering file under the target view type.
It should be noted that, the rendering file mentioned in the embodiment of the present application may be a DOM string, and the document client may directly present the corresponding document view by parsing the DOM string, so that secondary rendering is not required, and thus the first screen presentation time of the document client is effectively shortened.
It should be noted that, the document client obtains the rendering file rendered by the document server to render the document view, because the rendering speed of the server is faster than the rendering speed of the client, the first screen rendering time of the document client can be shortened, and the document using experience of the document editing object is improved, however, the document view rendered by the document client based on the DOM character string is static and can not be interacted, that is, the document editing object can not be operated, in this case, the document client also needs to download the resource file and the script file corresponding to the document view to render the client, which is to obtain the interactable document view, and after the document client renders the interactable document view, the static document view which can not be interacted in the document client can be removed, so as to release the content occupied by the static document view in the document client. For example, when the document editing object triggers and displays a document view of a target document in a target view type in the document client, the document client requests to obtain a rendering file of the target document rendered by the server in the target view type from the document server, and presents the document view of the target document in the target view type to the document editing object based on the obtained rendering file, the document view presented at the moment is a static non-interactable document view, the document server also needs to download a corresponding resource file and script file from the document server to perform client rendering, and presents the document view obtained by client rendering to the document editing object, the document view presented at the moment is an interactable document view, and after the document view is rendered by the client, the document view presented based on the rendering file rendered by the server is removed.
In addition, when the document view of the target document under a certain view type is edited, the document view of the target document under various view types needs to be synchronously updated, the document server may respond to the editing operation for the target document in the document client, update the editing area rendering file of the target document stored in the cache space under various view types, and the updating manner may include any one of the following:
(1) The update mode of the full-volume update. Taking a document view of a target document under a certain view type as an example, a document server side can acquire first screen document data corresponding to the updated document view of the target document under the target view type, and then can compare the first screen document data corresponding to the updated document view with first screen document data corresponding to the document data before updating; if the first screen document data corresponding to the updated document view and the first screen document data corresponding to the document data before the update are different, the updated first screen document data can be rendered to obtain an updated editing region rendering file under the target view type, and then the updated editing region rendering file under the target view type can be adopted to replace the editing region rendering file stored in the cache space before the update under the target view type; 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 under the target view type stored in the buffer space can be reserved.
(2) Update mode of delta update. The difference between the differential update method and the full update method is: if the first screen document data corresponding to the updated document view and the first screen document data corresponding to the first screen document data before updating are different, the difference document data between the first screen document data before updating and the first screen document data after updating can be determined, the difference document data is rendered to obtain a difference rendering file, and then the difference rendering file can be adopted to update the editing area rendering file before updating under the target view type stored in the cache space to obtain the editing area rendering file after updating under the target view type; 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 under the target view type stored in the buffer space can be reserved.
After the target document is edited, the editing area rendering file stored in the cache space is updated, so that the next time the document is requested to be opened, the time for rendering the edited document is not required to be waited, the editing area rendering file can be directly obtained from the cache space, and the first screen rendering time of the document client can be effectively shortened. In addition, the updating mode of the difference updating is smaller in rendered document data and faster in updating speed compared with the updating mode of the full updating.
In the embodiment of the application, only one set of rendering modes are required to be developed to perform server rendering on different document views of the target document, and different rendering modes are not required to be developed for different document views of the target document to perform server rendering, so that the development cost of multi-view server rendering in an online document can be effectively reduced. In addition, the rendering file rendered by the server side is a DOM character string, and compared with a scheme that the server side renders a data structure, the document client side can directly present a corresponding document view by analyzing the DOM character string, secondary rendering is not needed, and the data structure can be presented by the first screen only after the document client side carries out the secondary rendering, so that the first screen presentation time of the document client side can be effectively shortened; when the document presentation window of the document client side is changed, the DOM character string in the application can be matched with the self-adaptive script file, the document view is displayed in a self-adaptive mode along with the change of the document presentation window, and compared with a scheme that a picture of the document view is directly obtained by rendering of the server side, the picture can be deformed along with the change of the document presentation window, that is, the embodiment of the application can be well applied to a document display scene with window self-adaptive requirements.
On the basis of the document processing method provided by the embodiment shown in fig. 3, the embodiment of the application provides a document processing method, and the document processing method mainly introduces the rendering process of document data, data slicing of the document data and other contents. The document processing method may be performed by a computer device, which may be the document server 201 in the document processing system described above. As shown in fig. 6, the document processing method may include the following steps S601 to S607:
s601, receiving a document display request from a document client.
The execution process of step S601 in the embodiment of the present application is the same as the execution process of step S301 in the embodiment of fig. 3, and the specific execution process can be referred to the description of step S301 in the embodiment of fig. 3, which is not repeated here.
S602, searching a corresponding editing area rendering file in the cache space based on the document display request.
S603, if the editing area rendering file of the target document under the target view type is successfully found in the cache space, the editing area rendering file under the target view type is obtained from the cache space.
The execution process of step S602 and step S603 in the embodiment of the present application is the same as the execution process of the related content in the embodiment shown in fig. 3, and the specific execution process can refer to the description of the related content in the embodiment shown in fig. 3, which is not repeated here.
S604, if the rendering file of the target document under the target view type is not found in the cache space, acquiring first screen document data of the target document under the target view type, and rendering the first screen document data under the target view type to obtain an editing area rendering file under the target view type.
The main task of the embodiment of the application is to promote the first screen presentation time of the document client, wherein the first screen refers to the content which is presented first in the document client, so that the document server does not need to render the whole document data when rendering, the first screen document data (also called as first piece of document data) can be rendered, the first screen document data refers to the document data corresponding to the document content which is presented first in the document client in the editing area of the document view, and the first screen document data is obtained by performing data slicing processing on the whole document data corresponding to the editing area of the document view. Specifically, acquiring first-screen document data of the target document under the target view type may include: the method comprises the steps that complete document data of a target document under a target view type can be obtained, then data slicing processing can be carried out on the complete document data according to document data slicing information, and first screen document data of the target document under the target view type is obtained; the document data slicing information may include data slicing start point information and data slicing end point information, or the document data slicing information may include data slicing start point information and data slicing length information, and the document data slicing information may be set by default, or the document data slicing information may be determined according to document content presented in an editing area of a document view before a document view under a last closing target view type; the first screen presentation time of the document client can be greatly shortened through data slicing.
After the first screen document data of the target document under the target view type is obtained, the first screen document data of the target document under the target view type can be rendered, and an editing area rendering file of the target document under the target view type is obtained. The server rendering architecture and the server rendering flow of the document server will be described with reference to fig. 7:
the server rendering architecture of the document server may be described as follows: each view type in the document service corresponds to a different rendering layer, that is, the document service may include a rendering layer corresponding to each view type, for example, a table view type corresponds to a table view rendering layer, and a billboard view type corresponds to a billboard view rendering layer. The rendering layer corresponding to each view type is provided with a set of general component rendering structure (DOM Widget structure), the general component rendering structure can comprise a plurality of rendering components (widgets), each rendering component corresponds to one type of document content, the rendering components are used for rendering the corresponding type of document content, for example, the component rendering structure can comprise a picture component, a Rectangle component, a fold Line component, a Text component, a link component and the like, the picture component can be used for rendering pictures (Image), the Rectangle component can be used for rendering rectangles (rectangles), the fold Line component can be used for rendering fold lines (lines), the Text component can be used for rendering texts (Text), and the link component can be used for rendering links (Paths); the rendering components can adopt the same rendering mode, for example, the rendering modes adopted by the rendering components are all SVG rendering; alternatively, each rendering component may employ a different rendering mode, for example, the rendering mode employed by the picture component and the rectangle component is DOV rendering, and the rendering mode employed by the polyline component, the text component, and the link component is SVG rendering. Through the related description about the service end rendering architecture, the rendering layer corresponding to each view type is provided with a set of component rendering structure in common, that is, the service end rendering is carried out by using a set of component rendering structure in common with different view types, so that only one set of component rendering structure is required to be developed, and different component rendering structures are not required to be developed for each view type, and thus the development cost of the document service end for carrying out multi-view service end rendering can be greatly reduced.
The server rendering flow of the document server can be described as follows: taking a document view of a target document under a target view type as an example, a document server can initiate a call request of a rendering cloud function after acquiring first screen document data of the target document under the target view type, the first screen document data is transmitted to the rendering cloud function, and after the cloud function takes the first screen document data, an operating environment (JSOM (JavaScript (one programming language) DOM) operating environment) can be created and the first screen document data is transmitted to the operating environment; then, the cloud function can call a rendering layer corresponding to the target view type, and the rendering layer corresponding to the target view type can load a component rendering structure (DOM Widget structure) in a rendering engine (DOM rendering engine) to render the first-screen document data to obtain an editing area rendering file of the target document under the target view type.
The cloud function is a cloud function, namely, the cloud function runs on a cloud end (a server side), and on the physical design, one cloud function can be composed of a plurality of files, occupies a certain amount of computing resources such as CPU (Central Processing Unit ) memory and the like, is completely independent, can be deployed in different areas respectively, and can be called at a client side only by writing function codes and deploying the function codes to the cloud end without purchasing and building a server by a developer.
The document view under the target view type may contain a plurality of document contents, the first screen document data under the target view type may include content data of the plurality of document contents, and the process of rendering the first screen document data by the component rendering structure may be specifically referred to as the following: each rendering component can be called to render content data of the corresponding type of document content to obtain rendering files of the document content, and then the rendering files of the document content can be spliced according to rendering layouts corresponding to the component rendering structures (also called as rendering layouts corresponding to DOM rendering engines) to obtain editing area rendering files under the target view type; from the foregoing, it can be seen that the service end rendering is performed by using a common set of component rendering structures with different view types, that is, the first screen document data of the target document under different view types may be rendered by using a common set of component rendering structures.
The description of the rendering layout corresponding to the component rendering structure is presented in conjunction with fig. 8, and the rendering layout corresponding to the component rendering structure can be specifically referred to as follows: the rendering layout corresponding to the component rendering structure may be a tree structure formed by expanding a root node (div.stage node), the root node may include one or more layer nodes (div.layer nodes), the layer nodes may include one or more grouping nodes (div.group nodes), the grouping nodes may include one or more sub-nodes, one sub-node corresponds to a rendering file of document content, for example, a rendering file of a picture corresponding to a picture sub-node (div.image node), a rectangular sub-node (div.rectangle node) corresponds to a rendering file of a rectangle, a polyline sub-node (div.line node) corresponds to a rendering file of a polyline, a text sub-node (div.text node) corresponds to a rendering file of a text, a link sub-node (div.path node) corresponds to a rendering file of a link, and so on; the rendering files of the document content corresponding to each child node included in the grouping node can be spliced to obtain rendering files corresponding to the grouping node, the rendering files corresponding to each grouping node included in the layer node are spliced to obtain rendering files corresponding to the layer node, the rendering files corresponding to each layer node included in the root node are spliced to obtain rendering files corresponding to the root node, and then the rendering files corresponding to the root node are used as editing area rendering files of the target document under the target view type.
The rendering process of the text contents such as pictures, texts, broken lines and the like is mainly described as follows:
(1) And (5) a picture rendering process. The rendering mode adopted when the picture is rendered is DOM rendering, the rendering component can comprise a picture component, the document content can comprise the picture, and the content data of the picture content can comprise a processing parameter (background-image) of the picture; the rendering process of the picture can be seen as follows: the picture component can be called to render the picture content according to the processing parameters, and a rendering file of the picture content is obtained; wherein the processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and movement parameters; the scaling parameter may include a scaling of the picture, which may be determined according to a size of the picture and a size of the picture presentation area, for example, the scaling may be determined according to width information of the picture presentation area and width information of the picture so that a width of the picture after the scaling process is the same as a width of the picture presentation area, or the scaling may be determined according to length information of the picture presentation area and length information of the picture so that a length of the picture after the scaling process is the same as a length of the picture presentation area; the cropping parameters may include a cropping direction of the picture and a cropping length in the cropping direction, and the cropping direction may include an X-axis direction (i.e., a length direction) and a Y-axis direction (a width direction); the rotation parameters may include rotation reference information and rotation angle information of the picture; the movement parameter information may include a movement direction of the picture and movement distance information in the movement direction, and the movement direction may include an X-axis direction (i.e., a length direction) and a Y-axis direction (a width direction). Fig. 9 shows the rendering effect of the picture after rendering the picture when the processing parameters of the picture include a scaling parameter and a cropping parameter.
(2) And (3) a text rendering process. For the server-side rendering process of the text, the first difficulty is that the font size of the text is restored, for example, the minimum font size of the text supported by the application can reach 10px (pixels), but the minimum font size of the text can be limited by the document client, so that the rendering mode adopted when the embodiment of the application renders the text is SVG rendering, and the consistency of the font sizes of the text rendered by the server-side and the text rendered by the document client by Canvas can be ensured. The second difficulty is that the measurement of the text width is performed, because the measurement mode of the text width is different from that of the client rendering, the text width measurement is inaccurate, the calculation of the whole text line-feed position is inaccurate, obvious jitter and deviation appear, therefore, the embodiment of the application proposes word segmentation processing on the text, the width information of each word is measured through a Skia-Canvas (a width information measurement method), the width information of each word is accumulated to finally determine the width information of the text, so that the influence of inaccuracy of character (character spacing) measurement on the text width measurement can be effectively avoided, the character (character) can be specifically the spacing between two subtitles, the spacing between different letter combinations is different, as an example of text word segmentation is shown in fig. 10, and the text "i Hope is what keeps life going" [ "is divided into words" i "," Hope "," is "," what "," keys "," life "," going "and"; in addition, the embodiment of the application also supports caching of the measured width information of the segmented words, so that the cached width information can be directly adopted when the related segmented words are measured again, repeated measurement is avoided, and the text rendering efficiency is improved; in addition, for the emoji (pictograph) expression symbol which cannot be accurately measured, the embodiment of the application proposes that one emoji expression symbol can be determined as a character with the same width as a Chinese character, that is, the width information of the emoji expression symbol can be measured only by measuring the width information of one Chinese character.
The rendering component may include a text component, the document content may include text, and the content data of the text may include font parameters of the text; the text rendering process may include the following: the text component can be called to perform word segmentation processing on the text content, width information of each word obtained through the word segmentation processing is measured, then the width information of the text content can be determined according to the width information of each word, and the text is rendered according to font parameters of the text content and the width information of the text content, so that a rendering file of the text is obtained; 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.
(3) Rendering of polylines. The frame of the table background can be formed by a plurality of folding lines, the rendering of the frame of the table background can be decomposed into the rendering of the plurality of folding lines forming the frame of the table background, and the DOM rendering mode does not support folding line drawing, so that the rendering mode adopted when the folding lines are rendered is SVG rendering; the rendering component may include a polyline component, the document content may include a table, and the table's content data may include the table's coordinate data and fill color data; the rendering process of the table, i.e. the rendering process of the polyline, can be seen as follows: the method comprises the steps of calling a fold line component to determine coordinate data of a plurality of fold lines forming a table based on the coordinate data of the table, then determining the filling color data of the plurality of fold lines based on the filling color data of the table, rendering each fold line according to the coordinate data and the filling color data of each fold line to obtain rendering files of each fold line, and then determining the rendering files of the table according to the rendering files of each fold line, wherein after the coordinate data and the filling color data of the plurality of fold lines forming the table are determined, an SVG container can be created, and the coordinate data and the filling color data of each fold line are set in the SVG container to render each fold line to obtain the rendering files of each fold line.
It should be noted that, the rendering modes of the title bar and the toolbar are similar to the rendering modes of the editing area, and the application focuses on describing the rendering modes of the editing area, and the rendering modes of the title bar and the toolbar can refer to the specific description about the rendering modes of the editing area, which is not repeated here. In the process of rendering each document content forming the document view, the document view obtained by Canvas rendering in the document client can be accurately restored at the document server by combining a DOM rendering mode and an SVG rendering mode through a set of universal component rendering structure (DOM Widget structure). In addition, the embodiment of the application can also support the document server to completely realize Canvas rendering of the document client by SVG rendering at a lower layer, and the scheme has stronger general purpose, but has extremely high realization difficulty, huge development quantity and lower restoration accuracy.
S605, acquiring a toolbar rendering file under a target view type;
s606, splicing 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 of the target document under the target view type.
The execution process of step S605 and step S606 in the embodiment of the present application is the same as the execution process of the related content in the embodiment shown in fig. 3, and the specific execution process can refer to the description of the related content in the embodiment shown in fig. 3, which is not repeated here.
S607, the rendering file of the target document under the target view type is sent to the document client, so that the document client presents the document view of the target document under the target view type based on the received rendering file.
In this embodiment, the execution process of step S607 is the same as the execution process of step S303 in the embodiment shown in fig. 3, and the specific execution process can be referred to the description of step S303 in the embodiment shown in fig. 3, which is not repeated here.
According to the embodiment of the application, the data slicing is supported, the document server does not need to render complete document data, and only the first screen document data obtained through the data slicing processing is rendered, so that the rendering efficiency of the document server can be improved, and the first screen rendering time of the document client is effectively shortened. In addition, in the embodiment of the application, the rendering files under different view types adopt the same rendering mode, and it can be understood that the rendering files under different view types are obtained by splicing the toolbar rendering file and the editing area rendering file (or the title bar rendering file, the toolbar rendering file and the editing area rendering file), and the editing area rendering file under different view types is rendered by using a set of component rendering structure, so that the development cost of multi-view server rendering can be reduced, and the efficiency of multi-view server rendering can be effectively improved.
From the foregoing, it is appreciated that the document server may be a server cluster or a distributed system formed by a plurality of physical servers, and in one implementation, the document server may include a gateway service BFF (Backend for Frontend, serving the front end, and the back end), a rendering server, a resource server DWS (Data WareHouse Service, a data warehouse service), and a middle server, where the gateway service may be proxy service software integrated on the rendering server, or a proxy service interface, and so on. The following describes, with reference to fig. 11, the gateway service BFF, the rendering server, the resource server DWS, and the data interaction logic between the middle server when the document server performs service-side rendering. As shown in fig. 11, the document processing method may include the following steps S1101 to S1116:
s1101, the gateway service receives a document display request from the document client.
S1102, the gateway service generates a view information acquisition request according to the document display request and sends the generated view information acquisition request to the rendering server.
As can be seen from the foregoing, the document display request may include a document set identifier of a document set to which the target document belongs, or may include a document set identifier of a document set to which the target document belongs and a document identifier of the target document, or may include a document set identifier of a document set to which the target document belongs, a document identifier of the target document, and a view type identifier of the target view type; the gateway service generates a view information acquisition request according to the document display request, which specifically may mean that the gateway service generates a view information acquisition request according to each identifier included in the document display request, that is, the view information acquisition request may include a document set identifier of a document set to which the target document belongs, or may include a document set identifier of a document set to which the target document belongs and a document identifier of the target document, or may include a document set identifier of a document set to which the target document belongs, a document identifier of the target document, and a view type identifier of the target view type.
S1103, the rendering server analyzes the view information acquisition request to obtain the view type identifier of the target view type.
When the view information acquisition request does not include a type identifier (view id) of the target view type, the rendering server may acquire 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 acquisition 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 acquisition request; when the view information acquisition request contains the type identifier of the target view type, the rendering server may directly parse the view information acquisition request to obtain the type identifier of the target view type.
S1104, the rendering server requests the middle server to acquire view information of a document view of the target document under the target view type according to the view type identification of the target view type.
The rendering server may further send a request to the middle server according to the view type identifier of the target view type, where the request may obtain view information (viewinfo) of a document view of the target document under the target view type, and the view information may include contents such as a dynamic condition corresponding to the document view of the target document under the target view type, a title name of a document set to which the target document belongs, and the like.
S1105, the rendering server sends the acquired view information of the document view of the target document under the target view type to the gateway service.
S1106, the gateway service transmits view information of the document view of the target document under the target view type to the resource server.
S1107, the resource server returns a toolbar rendering file under the target view type to the gateway service according to the view information of the document view of the target document under the target view type.
It should be noted that, when the production environment is released, the pipeline may run to generate toolbar rendering files under each view type, and store the toolbar rendering files under each view type into the resource server; similarly, when a title bar is also included in the document view, the pipeline may run to generate a title bar rendering file and store the title bar rendering file to the resource server when the production environment is published.
The resource server can acquire a toolbar rendering file under the target view type according to view information of a document view under the target view type, if the view information contains dynamic conditions of the document view 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, and then the updated toolbar rendering file is used as the toolbar rendering file under the target view type to be sent to the gateway service. Similarly, when the document view further includes a title bar, the resource server may further obtain a title bar rendering file, and if the view information includes a title name of a document set to which the target document belongs, the title bar rendering file may be replaced based on the title name, so as to obtain a replaced title bar rendering file, and then the replaced title bar rendering file may be sent to the gateway service.
S1108, the gateway service sends an acquisition request of the edit section rendering file to the rendering server.
S1109, the rendering server acquires the editing area rendering file corresponding to the document view of the target document under the target view type according to the acquisition request of the editing area rendering file.
The obtaining request of the edit section rendering file may include a document set identifier of a document set to which the target document belongs, a document identifier of the target document, and a view type identifier of the target view type, and the rendering server may query the edit section rendering file under the target view type in the buffer 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, if the edit section rendering file under the target view type is successfully queried in the buffer space, the edit section rendering file under the target view type may be directly obtained from the buffer space, and if the edit section rendering file under the target view type is unsuccessfully queried in the buffer space, first screen document data corresponding to the document view of the target document under the target view type may be obtained, and render the first screen document data to obtain the edit section rendering file under the target view type.
S1110, the rendering server returns the editing area rendering file under the target view type to the gateway service.
S1111, the gateway service performs splicing processing on the editing region 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.
When the document view further includes a title bar, the gateway service may perform a splicing process on 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.
S1112, the gateway service sends the rendering file of the target document under the target view type to the document client, so that the document client presents the document view of the target document under the target view type based on the received rendering file.
S1113, when the target document is edited, the middle server receives the editing uplink data sent by the document client.
The editing uplink data may include edited document data and edited dynamic conditions, and the middle server may update the dynamic conditions stored in the middle server according to the edited dynamic conditions, so as to directly return to the updated dynamic conditions when requesting again, and may further obtain updated first-screen document data from the edited document data.
And S1114, the middle server sends the updated first screen document data to the rendering server.
S1115, the rendering server requests the middle server to acquire the view type identifier of the target document under each view type.
S1116, the rendering server updates the editing area rendering file of the target document stored in the cache space under each view type according to the updated first screen document data and the view type identification of the target document under each view type.
In the embodiment of the application, the gateway service is used as an intermediate service between the document client and the rendering server and between the resource server and the middle server, the rendering server is used as main execution equipment for rendering of the server and is responsible for generating rendering files under various view types, the resource server is used for storing the resource files in the document rendering process, such as toolbar rendering files, title bar rendering files and the like, the middle server is used for managing view information, and the first screen rendering efficiency of the document client can be greatly improved through the interaction among the gateway service, the rendering server, the resource server and the middle server.
The foregoing details of the method of embodiments of the present application are set forth in order to provide a better understanding of the foregoing aspects of embodiments of the present application, and accordingly, the following provides a device of embodiments of the present application.
Referring to fig. 12, fig. 12 is a schematic structural diagram of a document processing apparatus provided in an embodiment of the present application, where the document processing apparatus may be provided in a computer device provided in an embodiment of the present application, and the computer device may be a document server mentioned in an embodiment of the above-mentioned method. The document processing apparatus shown in fig. 12 may be a computer program (including program code) running in a computer device, which may be used to perform some or all of the steps of the method embodiments shown in fig. 3, 6 or 11. Referring to fig. 12, the document processing apparatus may include the following units:
a communication unit 1201 configured to receive a document display request from a document client, the document display request being for requesting display of a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
a processing unit 1202, configured to obtain a rendering file of a target document under a target view type in response to a document display request; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
The communication unit 1201 is further configured to send a rendering file of the target document under the target view type to the document client, so that the document client renders a document view of the target document under the target view type based on the received rendering file.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; the editing area rendering file obtained by rendering is stored in a cache space; the processing unit 1202 is configured to, when acquiring a rendering file of a target document under a target view type, specifically perform the following steps:
searching a corresponding editing area rendering file in a cache space based on a document display request;
if the editing area rendering file of the target document under the target view type is successfully searched in the cache space, acquiring the editing area rendering file under the target view type from the cache space;
acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, the processing unit 1202 is configured to, when acquiring a rendering file of a target document under a target view type, further perform the following steps:
if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type;
acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, a document view under a target view type contains a plurality of document contents, and first screen document data under the target view type includes content data of the plurality of document contents; the processing unit 1202 is configured to render the first-screen document data under the target view type, and when obtaining an editing area rendering file under the target view type, perform the following steps:
acquiring a component rendering structure, wherein the component rendering structure comprises a plurality of rendering components, and each rendering component corresponds to one type of document content;
Respectively calling each rendering component to render the content data of the document content of the corresponding type to obtain rendering files of the document content;
splicing the rendering files of the document contents according to the rendering layout corresponding to the component rendering structure to obtain an editing area rendering file under the target view type;
the first screen document data of the target document under different view types are rendered by adopting a component rendering structure.
In one implementation, the rendering layout is a tree structure formed by expanding a root node, the root node comprises one or more layer nodes, the layer nodes comprise one or more grouping nodes, the grouping nodes comprise one or more child nodes, and one child node corresponds to a rendering file of document content; the processing unit 1202 is configured to perform a stitching process on the rendering files of the document contents according to the rendering layout, and when obtaining an editing area rendering file under the target view type, specifically perform the following steps:
splicing the rendering files of the document content corresponding to each child node included in the grouping node to obtain the rendering files corresponding to the grouping node;
splicing rendering files corresponding to each grouping node included in the layer node to obtain rendering files corresponding to the layer node;
Splicing rendering files corresponding to each layer node included by the root node to obtain rendering files corresponding to the root node;
and using the rendering file corresponding to the root node as an editing area rendering file of the target document under the target view type.
In one implementation, the rendering component includes a picture component, and the document content includes a picture; the content data of the picture comprises processing parameters of the picture; the processing unit 1202 is configured to call each component to render the corresponding type of document content, and when obtaining a rendering file of each document content, specifically perform the following steps:
invoking a picture component to render the picture according to the processing parameters to obtain a rendering file of the picture;
wherein the processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and movement parameters.
In one implementation, the rendering component includes a text component, the document content includes text, and the content data of the text includes font parameters of the text; the processing unit 1202 is configured to call each component to render the corresponding type of document content, and when obtaining a rendering file of each document content, specifically perform the following steps:
Calling a text component to perform word segmentation processing on the text;
measuring width information of each word segmentation obtained by word segmentation processing;
determining width information of the text according to the width information of each word;
and rendering the text according to the font parameters of the text content and the width information of the text content to obtain a rendering file of the text.
In one implementation, the rendering component includes a polyline component, the document content includes a table, and the content data of the table includes coordinate data and fill color data of the table; the processing unit 1202 is configured to call each component to render the corresponding type of document content, and when obtaining a rendering file of each document content, specifically perform the following steps:
invoking a broken line component to determine coordinate data of a plurality of broken lines forming the table based on the coordinate data of the table;
determining fill color data for the plurality of polylines based on the fill color data of the form;
rendering each broken line according to the coordinate data and the filling color data of each broken line to obtain a rendering file of each broken line;
and determining the rendering file of the table according to the rendering file of each folding line.
In one implementation, the processing unit 1202 is configured to perform a stitching process on the editing area rendering file under the target view type and the toolbar rendering file under the target view type, and before obtaining the rendering file of the target document under the target view type, further is configured to perform the following steps:
Detecting dynamic conditions of the toolbar rendering file;
if the detection result indicates that the dynamic condition exists in the toolbar rendering file, updating the toolbar rendering file based on the dynamic condition to obtain an updated toolbar rendering file;
the processing unit 1202 is configured to perform a stitching process on the editing area rendering file under the target view type and the toolbar rendering file under the target view type, and when obtaining the rendering file of the target document under the target view type, specifically perform the following steps:
and splicing the updated toolbar rendering file and the editing area rendering file under the target view type to obtain the rendering file of the target document under the target view type.
In one implementation, the processing unit 1202 is configured to, when acquiring first-screen document data of the target document under the target view type, specifically perform the following steps:
acquiring complete document data of a target document under a target view type;
and performing data slicing processing on the complete document data according to the document data slicing information to obtain the first screen document data of the target document under the target view type.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; editing zone 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:
And in response to the editing operation for the target document in the document client, updating the editing region rendering file of the target document stored in the cache space under various view types.
In one implementation, the communication unit 1201 is configured to, when sending the rendering file of the target document under the target view type to the document client, specifically perform the following steps:
when detecting that the window self-adaptation requirement exists on the document client, acquiring a window self-adaptation script file;
and sending the rendering files of the window self-adaptive script file and the target document under the target view type to the document client so that the document client can adaptively present the document view of the target document under the target view type in the document presentation window of the document client based on the rendering files of the window self-adaptive script file and the target view type when the window shape of the document presentation window changes.
According to another embodiment of the present application, each unit in the document processing apparatus shown in fig. 12 may be separately or completely combined into one or several other units, or some unit(s) thereof may be further split into a plurality of units with smaller functions, which may achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the document processing apparatus may also include other units, and in actual application, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of a plurality of units.
According to another embodiment of the present application, a document processing apparatus as shown in fig. 12 may be constructed by running a computer program (including program code) capable of executing the steps involved in some or all of the methods shown in fig. 3, 6 or 11 on a general-purpose computing device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and the document processing method of the embodiment of the present application is implemented. The computer program may be recorded on, for example, a computer-readable storage medium, and loaded into and executed by the computing device described above.
In the embodiment of the application, when the document client has a requirement of displaying the document view of the target document (i.e. the online document) under the target view type, the rendering file of the target document under the target view type can be acquired, and the rendering file of the target document under the target view type is sent 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 can comprise one or more document views under various view types, the document views of the target document under various view types respectively correspond to different rendering files, the rendering files of the target document under various view types are rendered by adopting the same rendering mode, that is, only one set of rendering modes need to be developed to render different document views of the target document at the server side, and different rendering modes do not need to be developed for different document views of the target document at the server side, so that the development cost of multi-view server side rendering in the online document can be effectively reduced.
Based on the above method and apparatus embodiments, embodiments of the present application provide a computer device, which may be the aforementioned document server. Referring to fig. 13, fig. 13 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer device shown in fig. 13 includes at least a processor 1301, an input interface 1302, an output interface 1303, and a computer-readable storage medium 1304. Wherein the processor 1301, the input interface 1302, the output interface 1303, and the computer-readable storage medium 1304 may be connected by a bus or other means.
The input interface 1302 may be used to receive a document display request from a document client, receive a document editing operation from a document client, and so on; the output interface 1302 may be used to output rendering files, window adaptation script files, and the like to a document client.
The computer readable storage medium 1304 may be stored in a memory of a computer device, the computer readable storage medium 1304 for storing a computer program comprising computer instructions, and the processor 1301 for executing the program instructions stored in the computer readable storage medium 1304. Processor 1301 (or CPU (Central Processing Unit, central processing unit)) is a computing core and a control core of a computer device adapted to implement one or more computer instructions, in particular adapted to load and execute one or more computer instructions to implement a corresponding method flow or a corresponding function.
The embodiments of the present application also provide a computer-readable storage medium (Memory), which is a Memory device in a computer device, for storing programs and data. It is understood that the computer readable storage medium herein may include both built-in storage media in a computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores an operating system of the computer device. Also stored in the memory space are one or more computer instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor. Note that the computer readable storage medium can be either a high-speed RAM Memory or a Non-Volatile Memory (Non-Volatile Memory), such as at least one magnetic disk Memory; optionally, at least one computer readable storage medium remotely located from the aforementioned processor.
In some embodiments, one or more computer instructions stored in computer-readable storage medium 1304 may be loaded and executed by processor 1301 to implement the corresponding steps of the document processing method described above with respect to FIG. 3, FIG. 6, or FIG. 11. In particular implementations, computer instructions in the computer-readable storage medium 1304 are loaded by the processor 1301 and perform the steps of:
Receiving a document display request from a document client, wherein the document display request is used for requesting to display a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
responding to a document display request, and acquiring a rendering file of a target document under a target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
and sending the rendering 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 rendering file.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; the editing area rendering file obtained by rendering is stored in a cache space; computer instructions in the computer-readable storage medium 1304, when loaded by the processor 1301 and executed to obtain a rendered file of a target document under a target view type, are specifically configured to perform the steps of:
Searching a corresponding editing area rendering file in a cache space based on a document display request;
if the editing area rendering file of the target document under the target view type is successfully searched in the cache space, acquiring the editing area rendering file under the target view type from the cache space;
acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, the computer instructions in the computer-readable storage medium 1304, when loaded and executed by the processor 1301, are further configured to perform the steps of:
if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type;
acquiring a toolbar rendering file under a target view type;
and performing splicing processing on 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 of the target document under the target view type.
In one implementation, a document view under a target view type contains a plurality of document contents, and first screen document data under the target view type includes content data of the plurality of document contents; 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 when the editing area rendering file under the target view type is obtained, the method specifically is used to execute the following steps:
acquiring a component rendering structure, wherein the component rendering structure comprises a plurality of rendering components, and each rendering component corresponds to one type of document content;
respectively calling each rendering component to render the content data of the document content of the corresponding type to obtain rendering files of the document content;
splicing the rendering files of the document contents according to the rendering layout corresponding to the component rendering structure to obtain an editing area rendering file under the target view type;
the first screen document data of the target document under different view types are rendered by adopting a component rendering structure.
In one implementation, the rendering layout is a tree structure formed by expanding a root node, the root node comprises one or more layer nodes, the layer nodes comprise one or more grouping nodes, the grouping nodes comprise one or more child nodes, and one child node corresponds to a rendering file of document content; the computer instructions in the computer readable storage medium 1304 are loaded by the processor 1301 and executed to perform a stitching process on the rendering file of each document content according to the rendering layout, so as to obtain an editing area rendering file under the target view type, and specifically are used to perform the following steps:
Splicing the rendering files of the document content corresponding to each child node included in the grouping node to obtain the rendering files corresponding to the grouping node;
splicing rendering files corresponding to each grouping node included in the layer node to obtain rendering files corresponding to the layer node;
splicing rendering files corresponding to each layer node included by the root node to obtain rendering files corresponding to the root node;
and using the rendering file corresponding to the root node as an editing area rendering file of the target document under the target view type.
In one implementation, the rendering component includes a picture component, and the document content includes a picture; the content data of the picture comprises processing parameters of the picture; the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to respectively call each component to render the document content of the corresponding type, so as to obtain a rendering file of each document content, and specifically are used to execute the following steps:
invoking a picture component to render the picture according to the processing parameters to obtain a rendering file of the picture;
wherein the processing parameters include any one or more of the following: scaling parameters, cropping parameters, rotation parameters, and movement parameters.
In one implementation, the rendering component includes a text component, the document content includes text, and the content data of the text includes font parameters of the text; the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to respectively call each component to render the document content of the corresponding type, so as to obtain a rendering file of each document content, and specifically are used to execute the following steps:
calling a text component to perform word segmentation processing on the text;
measuring width information of each word segmentation obtained by word segmentation processing;
determining width information of the text according to the width information of each word;
and rendering the text according to the font parameters of the text content and the width information of the text content to obtain a rendering file of the text.
In one implementation, the rendering component includes a polyline component, the document content includes a table, and the content data of the table includes coordinate data and fill color data of the table; the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to respectively call each component to render the document content of the corresponding type, so as to obtain a rendering file of each document content, and specifically are used to execute the following steps:
Invoking a broken line component to determine coordinate data of a plurality of broken lines forming the table based on the coordinate data of the table;
determining fill color data for the plurality of polylines based on the fill color data of the form;
rendering each broken line according to the coordinate data and the filling color data of each broken line to obtain a rendering file of each broken line;
and determining the rendering file of the table according to the rendering file of each folding line.
In one implementation, the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to perform a stitching process on the editing area rendering file under the target view type and the toolbar rendering file under the target view type, and before the result is the rendering file of the target document under the target view type, the steps are further performed:
detecting dynamic conditions of the toolbar rendering file;
if the detection result indicates that the dynamic condition exists in the toolbar rendering file, updating the toolbar rendering file based on the dynamic condition to obtain an updated toolbar rendering file;
the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to perform a stitching process on the editing area rendering file under the target view type and the toolbar rendering file under the target view type, so as to perform the following steps when the rendering file of the target document under the target view type is obtained:
And splicing the updated toolbar rendering file and the editing area rendering file under the target view type to obtain the rendering file of the target document under the target view type.
In one implementation, the computer instructions in the computer readable storage medium 1304 are loaded and executed by the processor 1301 to obtain first screen document data of the target document under the target view type, specifically for performing the following steps:
acquiring complete document data of a target document under a target view type;
and performing data slicing processing on the complete document data according to the document data slicing information to obtain the first screen document data of the target document under the target view type.
In one implementation, the rendering file under any view type is formed by splicing an editing area rendering file under the view type and a toolbar rendering file under the view type; editing zone rendering files of the target document under various view types are stored in a cache space; computer instructions in the computer-readable storage medium 1304 are loaded by the processor 1301 and are also used to perform the steps of:
and in response to the editing operation for the target document in the document client, updating the editing region rendering file of the target document stored in the cache space under various view types.
In one implementation, the computer instructions in the computer-readable storage medium 1304 are loaded by the processor 1301 and execute the steps of, when sending a rendering file of a target document under a target view type to a document client, specifically:
when detecting that the window self-adaptation requirement exists on the document client, acquiring a window self-adaptation script file;
and sending the rendering files of the window self-adaptive script file and the target document under the target view type to the document client so that the document client can adaptively present the document view of the target document under the target view type in the document presentation window of the document client based on the rendering files of the window self-adaptive script file and the target view type when the window shape of the document presentation window changes.
In the embodiment of the application, when the document client has a requirement of displaying the document view of the target document (i.e. the online document) under the target view type, the rendering file of the target document under the target view type can be acquired, and the rendering file of the target document under the target view type is sent 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 can comprise one or more document views under various view types, the document views of the target document under various view types respectively correspond to different rendering files, the rendering files of the target document under various view types are rendered by adopting the same rendering mode, that is, only one set of rendering modes need to be developed to render different document views of the target document at the server side, and different rendering modes do not need to be developed for different document views of the target document at the server side, so that the development cost of multi-view server side rendering in the online document can be effectively reduced.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the document processing methods provided in the various alternatives described above.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (16)
1. A document processing method, the method comprising:
receiving a document display request from a document client, wherein the document display request is used for requesting to display a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
Responding to the document display request, and acquiring a rendering file of the target document under the target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
and sending the rendering 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 rendering file.
2. The method of claim 1, wherein the rendering file for any view type is formed by stitching an edit section rendering file for the view type with a toolbar rendering file for the view type; the editing area rendering file obtained by rendering is stored in a cache space; the obtaining the rendering file of the target document under the target view type comprises the following steps:
searching a corresponding editing area rendering file in the cache space based on the document display request;
if the editing area rendering file of the target document under the target view type is successfully found in the cache space, acquiring the editing area rendering file under the target view type from the cache space;
Acquiring a toolbar rendering file under the target view type;
and performing splicing processing on 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 of the target document under the target view type.
3. The method of claim 2, wherein the obtaining a rendering file of the target document under the target view type further comprises:
if the rendering file of the target document under the target view type is not found in the cache space, acquiring 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 an editing area rendering file under the target view type;
acquiring a toolbar rendering file under the target view type;
and performing splicing processing on 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 of the target document under the target view type.
4. The method of claim 3, wherein the document view under the target view type contains a plurality of document contents, and the first screen document data under the target view type includes content data of the plurality of document contents; rendering the first screen document data under the target view type to obtain an editing area rendering file under the target view type, wherein the rendering comprises the following steps:
Acquiring a component rendering structure, wherein the component rendering structure comprises a plurality of rendering components, and each rendering component corresponds to one type of document content;
respectively calling each rendering component to render the content data of the document content of the corresponding type to obtain rendering files of the document content;
splicing the rendering files of the document contents according to the rendering layout corresponding to the component rendering structure to obtain an editing area rendering file under the target view type;
and the first screen document data of the target document under different view types are rendered by adopting the component rendering structure.
5. The method of claim 4, wherein the rendering layout is a tree structure formed by a root node, the root node comprising one or more layer nodes, the layer nodes comprising one or more grouping nodes, the grouping nodes comprising one or more child nodes, a child node corresponding to a rendering file of document content; the step of splicing the rendering files of the document contents according to the rendering layout to obtain the editing area rendering file under the target view type comprises the following steps:
Splicing the rendering files of the document content corresponding to each child node included in the grouping node to obtain the rendering files corresponding to the grouping node;
splicing rendering files corresponding to each grouping node included in the layer node to obtain the rendering files corresponding to the layer node;
splicing rendering files corresponding to each layer node included by the root node to obtain rendering files corresponding to the root node;
and using the rendering file corresponding to the root node as an editing area rendering file of the target document under the target view type.
6. The method of claim 4, wherein the rendering component comprises a picture component, the document content comprising a picture; the content data of the picture comprises processing parameters of the picture; and respectively calling each component to render the document content of the corresponding type to obtain a rendering file of each document content, wherein the rendering file comprises the following components:
invoking the picture component to render the picture according to the processing parameters to obtain a rendering file of the picture;
wherein the processing parameters include any one or more of: scaling parameters, cropping parameters, rotation parameters, and movement parameters.
7. The method of claim 4, wherein the rendering component comprises a text component, the document content comprises text, and content data of the text comprises font parameters of the text; and respectively calling each component to render the document content of the corresponding type to obtain a rendering file of each document content, wherein the rendering file comprises the following components:
calling the text component to perform word segmentation processing on the text;
measuring width information of each word segmentation obtained by word segmentation processing;
determining width information of the text according to the width information of each word;
and rendering the text according to the font parameters of the text content and the width information of the text content to obtain a rendering file of the text.
8. The method of claim 4, wherein the rendering component comprises a polyline component, the document content comprises a table, and the content data of the table comprises coordinate data and fill color data of the table; and respectively calling each component to render the document content of the corresponding type to obtain a rendering file of each document content, wherein the rendering file comprises the following components:
invoking the polyline component to determine coordinate data of a plurality of polylines constituting the form based on the coordinate data of the form;
Determining fill color data for the plurality of polylines based on the fill color data of the table;
rendering each broken line according to the coordinate data and the filling color data of each broken line to obtain a rendering file of each broken line;
and determining the rendering file of the table according to the rendering file of each folding line.
9. A method according to claim 2 or 3, wherein the splicing process is performed on 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 of the target document under the target view type, and the method further comprises:
detecting dynamic conditions of the toolbar rendering file;
if the detection result of the dynamic condition detection indicates that the toolbar rendering file has a dynamic condition, updating the toolbar rendering file based on the dynamic condition to obtain an updated toolbar rendering file;
the splicing processing is carried out on 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 of the target document under the target view type, and the method comprises the following steps:
And splicing the updated toolbar rendering file and the editing area rendering file under the target view type to obtain the rendering file of the target document under the target view type.
10. The method of claim 3, wherein the obtaining first screen document data of the target document under the target view type comprises:
acquiring complete document data of the target document under the target view type;
and carrying out data slicing processing on the complete document data according to the document data slicing information to obtain first-screen document data of the target document under the target view type.
11. The method of claim 1, wherein the rendering file for any view type is formed by stitching an edit section rendering file for the view type with a toolbar rendering file for the view type; the editing area rendering file of the target document under various view types is stored in a cache space; the method further comprises the steps of:
and in response to the editing operation of the document client for the target document, updating an editing area rendering file of the target document stored in the cache space under various view types.
12. The method of claim 1, wherein the sending the rendering file of the target document under the target view type to the document client comprises:
when detecting that the window self-adaptation requirement exists on the document client, acquiring a window self-adaptation script file;
and sending the window self-adaptive script file and the rendering file of the target document under the target view type to the document client so that the document client can adaptively present the document view of the target document under the target view type in the document presentation window of the document client based on the window self-adaptive script file and the rendering file under the target view type when the window shape of the document presentation window changes.
13. A document processing apparatus, characterized in that the document processing apparatus comprises:
a communication unit configured to receive a document display request from a document client, the document display request being for requesting display of a document view of a target document under a target view type; the target document includes a document view under one or more view types, the target view type being one of the one or more view types;
The processing unit is used for responding to the document display request and acquiring a rendering file of the target document under the target view type; the document views of the target document under different view types respectively correspond to different rendering files, and the rendering files of the target document under various view types are rendered by adopting the same rendering mode;
the communication unit is further used for sending the rendering 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 rendering file.
14. A computer device, the computer device comprising:
a processor adapted to implement a computer program;
a computer readable storage medium storing a computer program adapted to be loaded by the processor and to perform the document processing method according to 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 to perform the document processing method according to any of claims 1-12.
16. A computer program product comprising computer instructions which, when executed by a processor, implement the document processing method of any of claims 1 to 12.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210794646.6A CN117407618A (en) | 2022-07-07 | 2022-07-07 | Document processing method, device, computer equipment, storage medium and program product |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210794646.6A CN117407618A (en) | 2022-07-07 | 2022-07-07 | Document processing method, device, computer equipment, storage medium and program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117407618A true CN117407618A (en) | 2024-01-16 |
Family
ID=89487635
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210794646.6A Pending CN117407618A (en) | 2022-07-07 | 2022-07-07 | Document processing method, device, computer equipment, storage medium and program product |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117407618A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118657135A (en) * | 2024-08-20 | 2024-09-17 | 深圳市金政软件技术有限公司 | Document generation method, device and storage medium |
| CN120358396A (en) * | 2025-06-23 | 2025-07-22 | 北京纵横无双科技有限公司 | A method for automatic line wrapping based on video script |
-
2022
- 2022-07-07 CN CN202210794646.6A patent/CN117407618A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118657135A (en) * | 2024-08-20 | 2024-09-17 | 深圳市金政软件技术有限公司 | Document generation method, device and storage medium |
| CN120358396A (en) * | 2025-06-23 | 2025-07-22 | 北京纵横无双科技有限公司 | A method for automatic line wrapping based on video script |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10976888B2 (en) | Automatically generating column layouts in electronic documents | |
| US10726195B2 (en) | Filtered stylesheets | |
| US9720658B2 (en) | Application creation method and apparatus | |
| US8887132B1 (en) | Application runtime environment and framework | |
| CN106133766B (en) | System and method for calculating, applying and displaying document deltas | |
| US9857959B2 (en) | Supporting webpage design and revision irrespective of webpage framework | |
| US9582600B1 (en) | Cloud browser DOM-based client | |
| US8711148B2 (en) | Method and system for generating and displaying an interactive dynamic selective view of multiply connected objects | |
| US9361280B2 (en) | Web application theme preview based on live previews | |
| CN113326043B (en) | Webpage rendering method, webpage manufacturing method and webpage rendering system | |
| US20080215966A1 (en) | Adaptive server-based layout of web documents | |
| US20180191798A1 (en) | Methods and systems for server-side rendering of native content for presentation | |
| US20040123238A1 (en) | Selectively interpreted portal page layout template | |
| US9740791B1 (en) | Browser as a service | |
| US20210149842A1 (en) | System and method for display of document comparisons on a remote device | |
| CA2817554A1 (en) | Mobile content management system | |
| JP2004510254A (en) | Network server | |
| CN117407618A (en) | Document processing method, device, computer equipment, storage medium and program product | |
| CN111831815B (en) | Control method and device for questionnaire display, storage medium and electronic equipment | |
| US20170031877A1 (en) | Web Page Design System | |
| US20100229083A1 (en) | Screen display program generating apparatus, screen display system, computer readable storage medium having stored therein a computer program causing a computer to function as the screen display program generating apparatus, and screen display program generating method | |
| Xiaoshu | Optimized development of web front-end development technology | |
| CN109324836A (en) | The processing method of the generation method and device of personalized photo, personalized splashette | |
| CN118193723A (en) | Text parsing method, system, electronic equipment and storage medium | |
| Koehl et al. | M. site: Efficient content adaptation for mobile devices |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |