A document editing method and device based on template
By editing only the default text content in the template in the document editing, the format is not allowed to be edited, which solves the problem of cumbersome operations and formats when writing electronic documents with specific formats. Convenient documentation and format maintenance.
Patent Information
- Application Number
- CN202110808651.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-16
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2041-07-16
AI Technical Summary
In the prior art, when writing electronic documents with specific formats, users need to manually adjust the font size, font type, line spacing, etc., which is cumbersome and inefficient, and users are prone to destroy the original format when using templates.
Provide a template -based document editing method. By obtaining the designated document template, it is displayed in the preset page. During the editing process, only edit content of the default text is allowed to be edited without the editor's format to ensure the documentation of the documentation. The format of the template does not change.
It improved the efficiency of document generation, reduced the operation of the user's manual editing format, avoided the destruction of format, improved the user experience, and saved the consumption of equipment performance.
Smart Images

Figure CN113642304B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic document processing, and in particular to a document editing method and device based on a template. Background Art
[0002] With the development of technology, users can use electronic documents to handle various affairs in study and work, which can greatly improve convenience and efficiency compared with traditional paper documents. In some fields, it is usually necessary to use electronic documents in a specific format. For example, official documents (official documents) are written materials formed and used by statutory agencies and organizations in official activities in a specific format and through a certain processing procedure. Generally speaking, the format, type and writing rules of official documents are unified, which requires relevant personnel to strictly abide by the format requirements when writing documents.
[0003] In the related art, the above-mentioned electronic documents with specific formats are usually edited manually by users, and the user needs to manually adjust the font size, font type, line spacing, etc. during the process, which is cumbersome and inefficient. Alternatively, an electronic document template that meets the format specifications can be generated in advance, and the user can directly modify it based on the template. However, the user is likely to destroy the format of the original template during the modification process, resulting in the user still needing to manually adjust the format. Summary of the invention
[0004] In view of this, the present application provides a template-based document editing method and device.
[0005] Specifically, the present application is implemented through the following technical solutions:
[0006] According to a first aspect of the present application, a template-based document editing method is proposed, comprising:
[0007] In response to a document editing request, obtaining a document template specified by the document editing request, wherein the document template is provided with a default text;
[0008] Displaying the document template on a preset page;
[0009] Based on the preset page, receiving a text editing request initiated for a target default text, wherein the target default text is any of the default texts in the document template;
[0010] In response to the text editing request, obtaining a target text;
[0011] The target default text in the document template is replaced with the target text, and the format of the target text is retained as the fixed format of the target default text. According to the second aspect of the present application, a template-based document editing device is proposed, comprising:
[0012] A template acquisition unit, configured to acquire, in response to a document editing request, a document template specified by the document editing request, wherein the document template is provided with a default text;
[0013] A display unit, used to display the document template in a preset page;
[0014] A receiving unit, configured to receive a text editing request initiated for a target default text based on the preset page, wherein the target default text is any of the default texts in the document template;
[0015] A text acquisition unit, configured to acquire a target text in response to the text editing request;
[0016] A replacement unit is used to replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
[0017] In one embodiment of the present application, in response to a document editing request, a document template specified by the document editing request can be obtained, and the document template can be displayed in a preset page. In addition, a text editing request for a target default text can be received based on the preset page, and in response to the text editing request, the target text can be obtained, the target default text in the document template can be replaced with the target text, and the format of the target text can be retained as a fixed format of the target default text. Using the above method, document editing can be performed based on a preset document template to quickly generate a document, thereby improving document generation efficiency and convenience. In addition, during the text editing process, only the text content of the default text can be edited without editing its format, which can ensure that the original format of the document template is not destroyed. Compared with the prior art, the user does not need to readjust the destroyed format, thereby improving the user experience. In addition, the user's manual format editing operations can also be greatly reduced, thereby reducing the consumption of device performance and saving the computing resources of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flowchart of a document editing method based on a template shown in an exemplary embodiment of the present application;
[0019] Figure 2 is a page schematic diagram shown in an exemplary embodiment of the present application;
[0020] Figure 3 is a flowchart of another template-based document editing method shown in an exemplary embodiment of the present application;
[0021] Figure 4 is another page schematic diagram shown in an exemplary embodiment of the present application;
[0022] Figure 5 is a flowchart of another template-based document editing method shown in an exemplary embodiment of the present application;
[0023] Figure 6 is another page schematic diagram shown in an exemplary embodiment of the present application;
[0024] Figure 7 It is a hardware structure diagram of an electronic device where a document editing device based on a template is located, as shown in an exemplary embodiment of the present application;
[0025] Figure 8 It is a block diagram of a document editing device based on a template shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0027] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0028] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0029] With the development of technology, users can use electronic documents to handle various affairs in study and work, which can greatly improve efficiency. In some fields, electronic documents in specific formats are usually required. Common formats include line spacing, font size and font type, the distance between text and header and footer, the position of the title on the page, etc. These specific formats are usually edited manually by users, and the operation is cumbersome. Especially when different types of electronic documents need to be generated, and each type of electronic document has a different format, the manual editing method is inefficient and has a poor user experience.
[0030] In the related art, an electronic document template may be pre-set, and the electronic document template may include some pre-edited default texts that meet the format requirements. The user may edit based on the template to quickly generate an electronic document that meets the format requirements, which can improve efficiency compared to the method of manual editing by the user. However, the formats in these templates are not fixed, and the user may destroy the original format of the template in the process of using the template. For example, the text from other places may be filled into the template by copying and pasting. If the original format of the text is different from the format specified by the template, it is likely that the format filled into the template will be the original format of the text, and the user still needs to manually adjust it to the format specified by the template, which is still very inconvenient.
[0031] Based on this, the present application provides a document editing method based on a template, which can automatically generate an electronic document that complies with the format requirements based on the template, and in the process of generating the electronic document, limit the editing of the default text in the template, that is, the text content of the default text can be edited but the format cannot be edited, so that the format does not change during the document editing process, which not only meets the user's needs for editing based on the template to quickly generate an electronic document, but also ensures that the editing will not cause format changes, which can greatly improve convenience and improve user experience. Furthermore, since the editing of the format is restricted, the number of user operations on the document can be reduced, thereby reducing the consumption of device performance caused by repeated editing during the document editing process, and can save computing resources such as CPU (Central Processing Unit), memory or other processors.
[0032] See also Figure 1 , Figure 1 This is a flow chart of a template-based document editing method shown in an exemplary embodiment of the present application. The method can be applied to an electronic device with a memory and a processor, such as a computer, a tablet computer, a mobile phone, etc. The electronic device can be loaded with a client, such as an application software for document editing.
[0033] The template-based document editing method may include the following steps:
[0034] Step 102: In response to a document editing request, obtain a document template specified by the document editing request, wherein a default text is set in the document template.
[0035] Step 104: display the document template on a preset page.
[0036] Step 106: Based on the preset page, a text editing request initiated for a target default text is received, wherein the target default text is any default text in the document template.
[0037] Step 108: Responding to the text editing request, obtaining the target text.
[0038] Step 110: Replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
[0039] The above steps are described in detail below:
[0040] In this embodiment, several document templates may be pre-set, and the type and content of the document templates may be set according to the actual business scenario, and no special restrictions are imposed on this. Each document template may include several default texts, and the type and content of the default texts may be preset, such as the content matching the business scenario may be preset as the default text, or it may be a default.
[0041] For example, if the document template is an official document template, the official document usually includes text elements such as title, version number, confidentiality level, text, signature, etc., then the default text corresponding to these text elements can be set, that is, the default text corresponding to the title, the default text corresponding to the version number, the default text corresponding to the confidentiality level, the default text corresponding to the text, and the default text corresponding to the signature. The content of each default text can be the default, such as "xxx", or it can match the specific business scenario, such as the default text corresponding to the title can be "Guangzhou Municipal People's Government Document".
[0042] Among them, when the text is subsequently edited based on the document template, only the text content of the default text can be changed, and its fixed format can be restricted from being changed. Of course, fixed text can also be set in the document template, and the type and content of the fixed text can also be set according to the specific application scenario, and the text content and format of the fixed text are fixed. Based on the document template, when the document template is subsequently edited, the fixed text can be made uneditable, that is, the text content and text format of the fixed text are restricted from editing. The fixed text is usually the text that does not change in the document template. For example, in general, each document will include the element of "issuer", then "issuer" can be fixed text. Of course, this example is only an exemplary description and is not used to limit this application. In addition, the document template may include fixed text or may not include fixed text, and there is no special restriction on this.
[0043] In this embodiment, the electronic device can initiate a document editing request, and the document editing request can also carry a document template specified by the user. The client can respond to the document editing request, obtain the document template specified by the document editing request, and display it to the user in a preset page. The preset page, for example, can be a page specifically used to display document templates, and the preset page is used to shield the editing operation for the format of the document template. Specifically, the preset page is used to shield the editing operation for the format of the default text; it is also used to shield the editing operation for the content or format of the fixed text, which will be described in detail in the following embodiments.
[0044] The electronic device may set the display form of the default text to be different from the fixed text, for example, the default text may be marked in a specified form, such as a specified color, a specified background color, a specified font, etc. Further, the electronic device may also detect the difference in the specified form to distinguish which text is the default text and which text is the fixed text.
[0045] The electronic device can initiate a text editing request for any default text (target default text) in the document template based on the preset page, for example, by single-clicking or double-clicking the target default text to initiate the text editing request. The client can receive the text editing request and determine the target default text based on the text editing request.
[0046] In addition, the electronic device can also input a target text for replacing the target default text. The target text can be, for example, carried in a text editing request or re-entered by the electronic device, without any special restrictions. The client can respond to the text editing request, obtain the target text, update the target default text in the document template to the target text, and retain the format of the target text as a fixed format of the target default text, so as to achieve format-invariant editing based on the target document template. The specific method will be described in detail in the following embodiments. It is worth noting that in the above method, filling the target text into the document template refers to editing the document on the basis of the document template to quickly obtain the document required by the user.
[0047] As can be seen from the above description, in one embodiment of the present application, in response to a document editing request, a document template specified by the document editing request can be obtained, and the document template can be displayed in a preset page. In addition, a text editing request for a target default text can be received based on the preset page, and in response to the text editing request, the target text can be obtained, the target default text in the document template can be replaced with the target text, and the format of the target text can be retained as a fixed format of the target default text. Using the above method, document editing can be performed directly based on a preset document template to quickly generate a document, which can improve document generation efficiency and convenience. In addition, the default text in the template can be restricted to be edited through the document template, that is, the text content can be edited but the format cannot be edited, ensuring the format invariance. Compared with the prior art, the user does not need to manually adjust the format, which improves the user experience. It can also reduce the number of user operations on the document, thereby reducing the consumption of device performance during document editing and saving computing resources.
[0048] The following is a description of an embodiment of another template-based document editing method provided by the present application.
[0049] First, the method for generating a document template in this embodiment is described.
[0050] In this embodiment, the relevant personnel can first edit the document according to the format requirements under the corresponding business scenario. The document may include some preset text elements, such as the title, version number, confidentiality level, etc. mentioned in the above example. And the format of these text elements should be in compliance with the specifications, such as the font, font size, page margins, etc. After writing, it can be converted into a template file, that is, converted into a file that cannot be edited for the entire document, and the initial document template is obtained. Then, the relevant personnel can specify some text elements in the initial document template as default text and some text elements as fixed text. Of course, in addition to text elements, fixed text can also be tables, images, shapes, etc.
[0051] Specifically, relevant personnel can initiate a domain setting request for a certain text element. After receiving the request, the client can generate a domain for the text element, use the text corresponding to the text element as the default text, and can also bind a fixed format corresponding to the text element based on the domain.
[0052] In one example, text with a field can be determined as default text, and text without a field can be determined as fixed text. Subsequently, whether the text is set with a field can be distinguished as default text or fixed text.
[0053] In another example, domains can be set for both default text and fixed text, and marks can be added to these domains. For example, the domain of default text can be marked as "1" and the domain of fixed text can be marked as "0". Subsequently, the text can be distinguished as default text or fixed text based on the mark.
[0054] Of course, the default text and the fixed text may also be distinguished by other methods, which are not listed one by one in this embodiment.
[0055] After a domain is created for a certain content in a document, the content can be updated through the domain, such as updating text content, updating format, etc. The specific method of creating a domain can refer to the relevant technology, and this application will not elaborate on it one by one.
[0056] Taking the document template as an example, please refer to Figure 2 , Figure 2 A page in a document template is shown as an example. The page may include text elements such as edition number, confidentiality level, relevant information of the issuing authority, text title and text content, and the font, font size, font color, and position on the page of these text elements are all in compliance with the specifications. Among them, the page may include some default texts and fixed texts. For example, for the content of "issuer xxx", "issuer" is a fixed text, and "xxx" is a default text. The user can edit the text content of the default text. For example, the user can enter "Zhang San", and the original "xxx" can be updated to "Zhang San", then "issuer xxx" will be updated to "issuer Zhang San". In addition, the format of "Zhang San" is the same as that of "xxx".
[0057] In order to help users distinguish which text elements are default text and which are fixed text, a specified format can be set for the default text, such as a specified font color, a specified background color (not shown), a specified font, etc. Figure 2 The examples shown are merely illustrative and are not intended to limit the present application.
[0058] After explaining the method of generating a document template, the document editing method based on the template is described below.
[0059] See also Figure 3 , Figure 3 This is a flowchart of another template-based document editing method shown in an exemplary embodiment of the present application. The method can be applied to a client, such as a document editing plug-in loaded on a WPS client, and can specifically include the following steps:
[0060] Step 302: In response to a document editing request, obtain a document template specified by the document editing request.
[0061] In this embodiment, a button corresponding to the document editing plug-in may be displayed on the WPS client, and the user may click the button to enter the document editing page. Taking the official document template as an example, several types of official document templates may be displayed to the user on this page, such as different types of official document templates may be generated in advance according to the official document type. Common official document types include regulations, provisions, decisions, orders, instructions, replies, notices, etc., and official document templates may be generated in advance for each official document type. These types of official document templates may be displayed to the user (for example, the name and thumbnail of the official document template are displayed), and the user may select the desired document template from them to initiate a document editing request.
[0062] After receiving the document editing request, the document editing plug-in can obtain the document template carried in the request.
[0063] Step 304, displaying the document template in a preset page, the preset page includes a template area and an editing area, displaying the document template in the template area, and displaying text editing boxes corresponding to each default text in the document template in the editing area for inputting target text.
[0064] In this embodiment, the document template can be displayed to the user in a visual preset page. Specifically, the preset page can display a template area and an editing area, wherein the template area is used to display the document template, and the template area is non-editable, shielding the editing operations acting on the template area, that is, it will not respond to the text editing request initiated by the user, and is only used to display the edited preview to the user. If the user wants to edit the document, it is necessary to initiate a text editing request in the editing area. The editing area is used to provide the user with an entry for document editing. The user can initiate a text editing request in the editing area, and the editing area can respond to the text editing request. The editing area can display text editing boxes corresponding to each default text included in the document template, and the text entered by the user can be collected based on these text editing boxes, and the corresponding default text in the template area can be edited. After editing, the editing results can be displayed in the template area.
[0065] See also Figure 4 , Figure 4 It is another page schematic diagram shown in an exemplary embodiment of the present application. Figure 4 The left side of the page is the template area, and the right side of the page is the editing area. The template area displays the document template, which includes several default texts, such as Figure 4 The "Guangzhou Municipal People's Government Document", "xxx", and "Text Title" are outlined in dotted lines. The default pages can be used to make the text content of these default texts editable, while the format is fixed. The editing area displays the text editing boxes corresponding to each default text for inputting text. Figure 4 The text editing box for the issuing authority logo (i.e., "Guangzhou Municipal People's Government Document" in the corresponding template area), the text editing box for the issuer (i.e., "xxx" in the corresponding template area), and the text editing box for the text title (i.e., "Text Title" in the corresponding template area) are displayed. Users can enter text in these text editing boxes to update the corresponding default text in the template area to the text they enter, and the format of the text is the same as that of the default text to ensure that the format remains unchanged. After the user has finished entering, the template area can also display the updated document template to preview the edit.
[0066] The editing area may be displayed persistently, or may be triggered to display after receiving a single click, double click or other operation by the user on any target default text in the template area, and there is no special restriction on this.
[0067] and, Figure 4 In addition to displaying a text edit box for editing the default text, you can also display related controls for editing other non-text content in the document template, such as Figure 4 The control for editing the header separator line includes modifying the style, length, thickness, etc. of the header separator line. Step 306: Based on the preset page, a text editing request initiated for the target default text is received.
[0068] exist Figure 4 In the example, the editing state of the text editing box corresponding to the target default text in the editing area can be monitored; when it is determined that the editing state is that the target text is input, it can be determined to initiate a text editing request for the target default text.
[0069] Step 308: Acquire the target text in response to the text editing request.
[0070] In this embodiment, an editing request for a target default text that acts on a preset page may be received; based on the editing request, a text editing request for the target default text is received.
[0071] For example, a user can initiate an edit request for any target default text in a document template in a preset page editing area. For example, a user can click on a text edit box corresponding to any target default text in the editing area. When the document editing plug-in detects the user's click operation, it determines that the user has initiated an edit request for the target default text. Then, the user can enter the target text in the input box to initiate a text edit request for the target default text, and the plug-in can respond to the text edit request and obtain the target text.
[0072] When the text editing request is used to edit the format of the target default text, the text editing request can be shielded to ensure that the format remains unchanged. In addition to shielding the text editing request, a reminder message can also be output to remind the user that the format cannot be edited.
[0073] Among them, input conditions can also be set for each default text. For example, for the default text "text title", the number of characters in the input title can be set not to exceed a specified number. If the number exceeds the specified number, an abnormal reminder can be output to prompt the user to re-enter the target text.
[0074] There are many ways to determine that the target text has been entered. For example, an "OK" button (not shown) can be displayed on the page, and the user can confirm that the target text has been entered after clicking the button. For another example, the user can first click the area where the text edit box is located to enter the target text, and then after entering, the mouse cursor can be controlled to leave the text edit box and click other areas outside the box. When the user clicks other areas, it is determined that the target text has been entered.
[0075] Step 310: Replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
[0076] In this embodiment, the target text input by the user can be used to update the target default text in the document template. It is worth noting that here it actually refers to editing based on the document template to obtain the document required by the user, and does not refer to generating the template itself.
[0077] Specifically, in this embodiment, a mapping relationship between the default text and its fixed format can be established. After obtaining the target text input by the user for the target default text, the mapping relationship between the target default text and its fixed format can be updated to a mapping relationship between the target text and the fixed format, thereby obtaining the target text with a fixed format, ensuring that the format remains unchanged.
[0078] There are many specific implementation methods for the mapping relationship. For example, a domain can be set for the default text in the template, and each default text can be bound to its corresponding format based on the domain. After obtaining the target text entered by the user for the target default text, the domain corresponding to the target default text can be determined. For example, the domain corresponding to the target default text can be found according to the name of the domain, and then the value of the domain is updated from the target default text to the target text, and the fixed format bound to the domain is kept unchanged, so that the target default text in the target document template can be updated to the target text, and its format is the format specified by the template.
[0079] In this embodiment, the document template after the mapping relationship is updated can also be displayed in the template area to implement a preview of document editing, and the updated document template can display a fixed-format target text with a target default text. This allows the user to clearly know the preview after the target text is filled into the document template, thereby improving the user experience.
[0080] In this embodiment, the user may delete the target default text during the process of editing the target default text.
[0081] In one example, the target default text may not be needed by the user, such as the user may not need Figure 4 The target default text of the version number "000xx" in the editing area can display a delete button (not shown) corresponding to the target default text, and the user can click the button to initiate the deletion command. Of course, it can also be deleted in other ways, which will not be explained here one by one.
[0082] In another example, there may be default content in the text edit box corresponding to the target default text. The default content may be the target default text itself or other content. If the user wants to use the target text to replace the default content, the user needs to delete the default content first and then enter the target text, which will also cause the target default text to be temporarily deleted.
[0083] for example Figure 4 In the edit box corresponding to the issuing agency logo, there may be a default content of "Guangzhou Municipal People's Government Document". If the user wants to replace it with "Shenzhen Municipal People's Government Document", the user can first delete the "Guangzhou Municipal People's Government Document" and then fill in the "Shenzhen Municipal People's Government Document".
[0084] Furthermore, there may be multiple ways to trigger a deletion instruction. For example, a user may click on an edit box corresponding to the issuing authority logo, and then it may be determined that a user-initiated instruction to delete the "Guangzhou Municipal People's Government Document" has been received.
[0085] In this embodiment, when a deletion instruction initiated by the user for the target default text is received, the mapping relationship between the stored target default text and its fixed format can be updated to a mapping relationship between a specified character and the fixed format in response to the deletion instruction. The specified character may be invisible to the user, such as a space with a horizontal width of 0.
[0086] For example, if the user wants to delete a target default text, such as deleting the target default text "000xx", assuming that the fixed format corresponding to "000xx" is "Songti Small Five", the mapping relationship between "000xx" and "Songti Small Five" can be updated to: the mapping relationship between "space" and "Songti Small Five". See Table 1 below:
[0087]
[0088] Table 1
[0089] In this embodiment, after deleting the target default text, the user may want to restore the deletion. In order to facilitate the user to restore the deleted target default text, a restoration method can be preset. When the user wants to restore the deleted target default text, the user can issue a restoration operation for the deleted target default text according to the preset restoration method, such as right-clicking the edit box corresponding to the target default text and clicking the restore button, and then the document editing plug-in can capture the restoration operation, obtain the target default text, and update the mapping relationship between the specified character and the fixed format to the mapping relationship between the target default text and the fixed format, so as to achieve the purpose of restoring the target default text.
[0090] Among them, for the above example where the target default text is deleted due to the need to enter a replacement text, if the default content of the target default text "000xx" is "000xx", and the corresponding fixed format is "Songti Xiaowu", then after receiving the deletion instruction, the mapping relationship between "000xx" and "Songti Xiaowu" can be updated to: the mapping relationship between "space" and "Songti Xiaowu". When the target text entered by the user is received, if the target text is "00001", the specified characters in the mapping relationship can be updated to the target text, that is, updated to the mapping relationship between "00001" and "Songti Xiaowu". See Table 2 below:
[0091]
[0092] Table 2
[0093] When deleting a text element, the text corresponding to the text element is replaced with a specified character, which is essentially a hidden effect. It can ensure that the text element is retained in the specified position in the document template, and the fixed format bound to the text element is still stored in the document template. Furthermore, when restoring a text element, it is only necessary to replace the specified character corresponding to the text element with the restored text, and the restored text corresponding to the text element can be quickly displayed in the specified position in the document template, and the fixed format bound to the text element is retained.
[0094] Of course, the document template may also include some non-deletable target default texts, and you can set a CRUD tag for each target default text, and the CRUD tag is used to identify the corresponding default text as a deletable and restorable element. After the user initiates a delete command for the target default text, you can first determine whether the default text has a CRUD tag set. If so, perform the above-mentioned deletion operation; if not, you can output a non-deletable reminder to the user.
[0095] In this embodiment, after deleting the target default text, if there is no other text in the row where the target default text is located, the row height can be adjusted to 0, which is equivalent to deleting the blank row. In this way, it can be avoided that the row becomes a blank row due to the absence of text, resulting in failure to meet the national standard requirements for official documents. Of course, if there is other text in the row, it is not necessary to adjust the row height to 0.
[0096] For the above situation, when restoring the deletion operation of the target default text, in order to make the row height meet the national standard requirements, the row height corresponding to each default text can also be stored in advance. Then, when restoring the deletion, it can be determined whether the row height of the corresponding row is 0. If it is not 0, the above-mentioned restoration and deletion operation based on the update of the mapping relationship is performed; if it is 0, the row height of the row can be adjusted to the row height of the corresponding target default text, and the above-mentioned restoration and deletion operation based on the update of the mapping relationship is performed.
[0097] By adopting the above method, by setting a specified character, the target default text in the mapping relationship is updated to the specified character after the target default text is deleted. This can avoid the mapping relationship between the target default text and the fixed format being deleted due to the target default text being deleted. The fixed format can be saved, so that if the subsequent user needs to undo the deletion or enter a replacement text, the fixed format can be found and text that conforms to the fixed format can be generated, thereby achieving the format unchanged.
[0098] It can be seen from the above description that in one embodiment of the present application, a document template can be used to help users quickly generate the required documents. Users can edit the text content of the default text in the document template to enter replacement text, and the user does not need to modify the format independently. The target text can be automatically filled into the template in a specified format to achieve editing without changing the format, thereby improving document generation efficiency.
[0099] Furthermore, the target document template can be displayed to the user in a preset page, and the preset page can display a template area and an editing area, the template area is used to display the template, and the editing area is used to provide the user with a text editing box corresponding to the default text, so that the user can enter the target text based on these text editing boxes. Furthermore, after the user enters the target text, the target text can be converted into a corresponding format and displayed in the document template, so as to realize a preview of text editing, which can greatly improve the user experience.
[0100] The following is a description of an embodiment of another template-based document editing method provided by the present application.
[0101] See also Figure 5 , Figure 5 This is a flowchart of another template-based document editing method shown in an exemplary embodiment of the present application. The method can be applied to a client, such as a document editing plug-in loaded on a WPS client, and can specifically include the following steps:
[0102] Step 502: In response to a document editing request, obtain a document template specified by the document editing request, wherein a default text is set in the document template.
[0103] In this embodiment, the specific method of step 502 can refer to the above-mentioned embodiment and will not be described in detail here.
[0104] Step 504, generating a first page, displaying the document template on the first page, generating a second page, wherein the second page is a transparent page and covers the first page.
[0105] In this embodiment, the document template can be displayed to the user in a visualized preset page. The preset page can include a first page and a second page.
[0106] Specifically, a first page may be generated, and the first page is used to display the document template. A second page may also be generated, and the second page is overlaid on the first page, and is used to receive an editing operation initiated by the user based on the second page. In order not to affect the user's reading experience, the second page may be a transparent page, and of course, other forms of pages may also be used, such as a page of a specified color with low transparency, and there is no special restriction on this.
[0107] The following is a specific example to illustrate. Figure 6 This is another page schematic diagram shown in an exemplary embodiment of the present application. Figure 6 The left page in the figure includes a first page, in which a document template is displayed. A transparent second page is covered on the first page, and the second page can be a mask. In one example, the second page can be the same size as the first page and is used to cover the entire first page (not shown).
[0108] In another example, the second page may also be used to cover only a portion of the first page, such as Figure 6 The area marked by the dotted box in the figure is covered by the second page. Generally speaking, the area covered by the second page may include several default texts, and the text content of these default texts can be edited. The area not covered by the second page may not include any text, such as Figure 6 The blank part.
[0109] Step 506: receiving an editing operation applied to the second page, and based on the location of the editing operation applied to the second page, determining the default text of the first page at the location of the editing operation as the target default text.
[0110] Step 508: Receive a text editing request for the target default text.
[0111] Step 510: Acquire target text in response to the text editing request.
[0112] In this embodiment, the user can initiate an editing operation. Since the second page is overlaid on the first page, the user's editing operation is directly applied to the second page, and the legality of the editing operation can be determined based on the second page. For example, the editing operation on the text content is legal, but the operation on the format is illegal, and the editing operation on the format can be shielded.
[0113] Specifically, an editing operation acting on the second page may be received, and based on the position of action of the editing operation on the second page, the default text located at the action position in the first page may be determined as the target default text. A text editing request for the target default text may then be received. For example, the mapped area of the second page where the target default text is located may be set as an editable area, and the editing area may be set to an editable state, and the user may enter the target text in the editable area in the editable state to initiate a text editing request for the target default text. The client may respond to the text editing request and obtain the text entered into the editable area as the target text.
[0114] The editable area only supports inputting target text, but not the format of the target text. The editable area blocks the editing request for the format.
[0115] It can also be determined whether the text located at the action position in the first page is fixed text. If so, the editing operation is shielded.
[0116] For example, see Figure 6 , Figure 6 The area 601 in the figure covers the second page. The user can click on any text in the area to initiate an editing operation on the second page. For example, the user can click on "I. First-level title". After receiving the editing operation, the client can first determine whether the text in the first page corresponding to the action position is the default text. If "I. First-level title" is the default text, the text can be determined as the target default text, and the area 601 can be set as an editable area and adjusted to an editable state. See Figure 6 In the page on the right, after the area is adjusted to an editable state, a text editing box can be displayed to the user, and the user can enter the target text in the text editing box to initiate a text editing request for the target default text.
[0117] certainly, Figure 6 The example shown is only an illustrative description, and other methods may be adopted in actual applications, and there is no special limitation on this.
[0118] Step 512: Replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
[0119] In this embodiment, the corresponding target default text in the document template can be updated according to the target text input by the user, and the updated document template can also be displayed to the user to implement a preview of document editing.
[0120] The format of the target text may be the same as the fixed format bound to the preset default text, so that the replacement text of the fixed format is displayed to the user. The specific implementation method may refer to the above embodiment, and this application will not repeat it here.
[0121] Alternatively, the user may also set a custom format for the target texts. For example, the user may right-click the mouse to set the format, including font type, font size, font color, etc. This embodiment does not impose any special restrictions on this.
[0122] Similarly, the user can also initiate a delete command for the target default text, and then the existing mapping relationship can be updated based on the specified characters to ensure that the format of the target default text is not lost. For details, please refer to the above embodiment, and this application will not go into details here.
[0123] As can be seen from the above description, in one embodiment of the present application, a document template can be displayed to a user in a preset page, the preset page includes a first page and a second page covering the first page, and the user can initiate an editing request for the second page, so that the editing request can be judged as editing format or editing text, and the request for editing format will be shielded, and only editing text is allowed. The above method can ensure that the format remains unchanged during the document editing process. Compared with the prior art, the user does not need to manually adjust the format of the text. The user only needs to enter the target text to automatically generate a document that meets the format specifications, thereby improving document editing efficiency and user experience.
[0124] Corresponding to the aforementioned embodiment of the template-based document editing method, the present application also provides an embodiment of the template-based document editing device.
[0125] The embodiment of the document editing device based on templates of the present application can be applied to electronic devices. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the electronic device in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, if Figure 7 As shown, it is a hardware structure diagram of the electronic device where the template-based document editing device of the present application is located, except Figure 7 In addition to the processor, memory, network interface, and non-volatile memory shown, the electronic device in which the device in the embodiment is located may also include other hardware according to the actual function of the electronic device, which will not be described in detail.
[0126] Please refer to Figure 8 , Figure 8 is a block diagram of a document editing device based on a template as shown in an exemplary embodiment of the present application. The document editing device based on the template can be used in the aforementioned Figure 7 The electronic device shown includes: a template acquisition unit 800 , a display unit 810 , a receiving unit 820 , a text acquisition unit 830 and a replacement unit 840 .
[0127] The template acquisition unit 800 is used to respond to a document editing request and acquire a document template specified by the document editing request, wherein the document template is provided with a default text;
[0128] A display unit 810, used to display the document template in a preset page;
[0129] A receiving unit 820 is configured to receive a text editing request initiated for a target default text based on the preset page, wherein the target default text is any default text in the document template;
[0130] A text acquisition unit 830, configured to acquire a target text in response to the text editing request;
[0131] The replacing unit 840 is used to replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
[0132] Optionally, the preset page includes a template area and an editing area, and the display unit 810 is specifically used to:
[0133] Displaying the document template in the template area;
[0134] The text editing boxes corresponding to the default texts in the document template are displayed in the editing area to input target texts.
[0135] Optionally, the preset page includes a first page and a second page, and the display unit 810 is specifically used for:
[0136] Generate the first page;
[0137] Displaying the document template on the first page;
[0138] A second page is generated, wherein the second page is a transparent page and covers the first page.
[0139] Optionally, the receiving unit 820 is specifically configured to:
[0140] receiving an editing operation acting on the second page;
[0141] Based on the effective position of the editing operation on the second page, determining the default text located at the effective position in the first page as the target default text;
[0142] A text editing request for the target default text is received.
[0143] Optionally, after receiving the editing operation on the second page, the receiving unit 820 is further configured to:
[0144] In the case where the text located at the action position in the first page is fixed text, the editing operation is shielded.
[0145] Optionally, when receiving a text editing request for the target default text, the receiving unit 820 is specifically configured to:
[0146] Setting the area mapped to the target default text on the second page as an editable area; and receiving a text editing request for the target default text based on the editable area;
[0147] The step of obtaining the target text in response to the text editing request includes:
[0148] The text entered into the editable area is used as the target text.
[0149] Optionally, after receiving the text editing request initiated for the target default text based on the preset page, the receiving unit 820 is further configured to:
[0150] In case the text editing request is used to edit a format, the text editing request is shielded.
[0151] Optionally, there is a mapping relationship between the default text and its fixed format, and the replacing unit 840 is specifically used to:
[0152] The mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the target text and the fixed format, so as to obtain the target text with the fixed format.
[0153] Optionally, a field for the default text is provided in the document template, and the field is bound with a fixed format of the default text. The replacing unit 840 is specifically configured to:
[0154] Determine the domain corresponding to the target default text;
[0155] The value of the field is updated from the target default text to the target text, and the fixed format of the field binding is kept unchanged.
[0156] Optionally, the replacing unit 840 is further configured to:
[0157] The updated document template is displayed in the preset page.
[0158] Optionally, after receiving a text editing request initiated for a target default text based on the preset page, the receiving unit 820 is further configured to:
[0159] In the case that the text editing request includes a deletion instruction for the target default text, in response to the deletion instruction, the mapping relationship between the target default text and its fixed format is updated to a mapping relationship between a designated character and the fixed format.
[0160] Optionally, the replacing unit 840 is specifically configured to:
[0161] Based on the preset add / delete tag of the target default text, determining whether the target default text can be deleted; the add / delete tag is used to identify the corresponding default text as a deletable and restorable element;
[0162] If possible, the mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the specified character and the fixed format.
[0163] Optionally, the replacement unit is further used for:
[0164] In response to a recovery request for the deleted target default text, the mapping relationship between the designated characters and the fixed format is updated to the mapping relationship between the target default text and the fixed format.
[0165] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0166] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0167] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0168] Corresponding to the embodiment of the template-based document editing method described above, this specification also provides a template-based document editing device, which includes: a processor and a memory for storing machine executable instructions. The processor and the memory are usually connected to each other via an internal bus. In other possible implementations, the device may also include an external interface to enable communication with other devices or components.
[0169] In this embodiment, by reading and executing the machine executable instructions corresponding to the logic of the template-based document editing device stored in the memory, the processor is prompted to:
[0170] In response to a document editing request, obtaining a document template specified by the document editing request, wherein the document template is provided with a default text;
[0171] Displaying the document template on a preset page;
[0172] Based on the preset page, receiving a text editing request initiated for a target default text, wherein the target default text is any of the default texts in the document template;
[0173] In response to the text editing request, obtaining a target text;
[0174] The target default text in the document template is replaced with the target text, and the format of the target text is retained as the fixed format of the target default text.
[0175] Optionally, the preset page includes a template area and an editing area, and when the document template is displayed in the preset page, the processor is prompted to:
[0176] Displaying the document template in the template area;
[0177] The text editing boxes corresponding to the default texts in the document template are displayed in the editing area to input target texts.
[0178] Optionally, the preset page includes a first page and a second page, and when the document template is displayed in the preset page, the processor is prompted to:
[0179] Generate the first page;
[0180] Displaying the document template on the first page;
[0181] A second page is generated, wherein the second page is a transparent page and covers the first page.
[0182] Optionally, when receiving a text editing request initiated for a target default text based on the preset page, the processor is prompted to:
[0183] receiving an editing operation acting on the second page;
[0184] Based on the effective position of the editing operation on the second page, determining the default text located at the effective position in the first page as the target default text;
[0185] A text editing request for the target default text is received.
[0186] Optionally, after receiving the editing operation acting on the second page, the processor is further prompted to:
[0187] In the case where the text located at the action position in the first page is fixed text, the editing operation is shielded.
[0188] Optionally, upon receiving a text editing request for the target default text, the processor is prompted to:
[0189] Setting the area mapped to the target default text on the second page as an editable area; and receiving a text editing request for the target default text based on the editable area;
[0190] The step of obtaining the target text in response to the text editing request includes:
[0191] The text entered into the editable area is used as the target text.
[0192] Optionally, after receiving a text editing request initiated for a target default text based on the preset page, the processor is further prompted to:
[0193] In case the text editing request is used to edit a format, the text editing request is shielded.
[0194] Optionally, there is a mapping relationship between the default text and its fixed format, and when the target default text in the document template is replaced with the target text and the format of the target text is retained as the fixed format of the target default text, the processor is prompted to:
[0195] The mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the target text and the fixed format, so as to obtain the target text with the fixed format.
[0196] Optionally, a domain for the default text is provided in the document template, and the domain is bound to a fixed format of the default text. When the mapping relationship between the target default text and its fixed format is updated to a mapping relationship between the target text and the fixed format, the processor is prompted to:
[0197] Determine the domain corresponding to the target default text;
[0198] The value of the field is updated from the target default text to the target text, and the fixed format of the field binding is kept unchanged.
[0199] Optionally, after replacing the target default text in the document template with the target text and retaining the format of the target text as a fixed format of the target default text, the processor is further prompted to:
[0200] The updated document template is displayed in the preset page.
[0201] Optionally, after receiving a text editing request initiated for a target default text based on the preset page, the processor is further prompted to:
[0202] In the case where the text editing request includes a deletion instruction for the target default text, in response to the deletion instruction, the mapping relationship between the target default text and its fixed format is updated to a mapping relationship between a designated character and the fixed format.
[0203] Optionally, when updating the mapping relationship between the target default text and its fixed format to the mapping relationship between the specified character and the fixed format, the processor is prompted to:
[0204] Based on the preset add / delete tag of the target default text, determining whether the target default text can be deleted; the add / delete tag is used to identify the corresponding default text as a deletable and restorable element;
[0205] If possible, the mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the specified character and the fixed format.
[0206] Optionally, the processor is further prompted to:
[0207] In response to a recovery request for the deleted target default text, the mapping relationship between the designated characters and the fixed format is updated to the mapping relationship between the target default text and the fixed format.
[0208] Corresponding to the embodiment of the template-based document editing method described above, this specification also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented:
[0209] In response to a document editing request, obtaining a document template specified by the document editing request, wherein the document template is provided with a default text;
[0210] Displaying the document template on a preset page;
[0211] Based on the preset page, receiving a text editing request initiated for a target default text, wherein the target default text is any of the default texts in the document template;
[0212] In response to the text editing request, obtaining a target text;
[0213] The target default text in the document template is replaced with the target text, and the format of the target text is retained as the fixed format of the target default text.
[0214] Optionally, the preset page includes a template area and an editing area, and displaying the document template in the preset page includes:
[0215] Displaying the document template in the template area;
[0216] The text editing boxes corresponding to the default texts in the document template are displayed in the editing area to input target texts.
[0217] Optionally, the preset page includes a first page and a second page, and displaying the document template on the preset page includes:
[0218] Generate the first page;
[0219] Displaying the document template on the first page;
[0220] A second page is generated, wherein the second page is a transparent page and covers the first page.
[0221] Optionally, receiving a text editing request initiated for a target default text based on the preset page includes:
[0222] receiving an editing operation acting on the second page;
[0223] Based on the effective position of the editing operation on the second page, determining the default text located at the effective position in the first page as the target default text;
[0224] A text editing request for the target default text is received.
[0225] Optionally, after receiving the editing operation on the second page, the method further includes:
[0226] In the case where the text located at the action position in the first page is fixed text, the editing operation is shielded.
[0227] Optionally, the receiving a text editing request for the target default text includes:
[0228] Setting the area mapped to the target default text on the second page as an editable area; and receiving a text editing request for the target default text based on the editable area;
[0229] The step of obtaining the target text in response to the text editing request includes:
[0230] The text entered into the editable area is used as the target text.
[0231] Optionally, after receiving a text editing request initiated for a target default text based on the preset page, the method further includes:
[0232] In case the text editing request is used to edit a format, the text editing request is shielded.
[0233] Optionally, there is a mapping relationship between the default text and its fixed format, and replacing the target default text in the document template with the target text and retaining the format of the target text as the fixed format of the target default text includes:
[0234] The mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the target text and the fixed format, so as to obtain the target text with the fixed format.
[0235] Optionally, a domain for the default text is provided in the document template, the domain is bound to a fixed format of the default text, and updating the mapping relationship between the target default text and its fixed format to a mapping relationship between the target text and the fixed format includes:
[0236] Determine the domain corresponding to the target default text;
[0237] The value of the field is updated from the target default text to the target text, and the fixed format of the field binding is kept unchanged.
[0238] Optionally, after replacing the target default text in the document template with the target text and retaining the format of the target text as the fixed format of the target default text, the method further includes:
[0239] The updated document template is displayed in the preset page.
[0240] Optionally, after receiving a text editing request initiated for a target default text based on the preset page, the method further includes:
[0241] In the case where the text editing request includes a deletion instruction for the target default text, in response to the deletion instruction, the mapping relationship between the target default text and its fixed format is updated to a mapping relationship between a designated character and the fixed format.
[0242] Optionally, updating the mapping relationship between the target default text and its fixed format to a mapping relationship between a specified character and the fixed format includes:
[0243] Based on the preset add / delete tag of the target default text, determining whether the target default text can be deleted; the add / delete tag is used to identify the corresponding default text as a deletable and restorable element;
[0244] If possible, the mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the specified character and the fixed format.
[0245] Optionally, also include:
[0246] In response to a recovery request for the deleted target default text, the mapping relationship between the designated characters and the fixed format is updated to the mapping relationship between the target default text and the fixed format.
[0247] The embodiments of the subject matter and functional operations described in this specification may be implemented in the following: digital electronic circuits, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or a combination of one or more of them. The embodiments of the subject matter described in this specification may be implemented as one or more computer programs, i.e., one or more modules in computer program instructions encoded on a tangible non-temporary program carrier to be executed by a data processing device or to control the operation of the data processing device. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagation signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode information and transmit it to a suitable receiver device for execution by a data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.
[0248] The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output. The processes and logic flows can also be performed by special purpose logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application-specific integrated circuits), and the apparatus can also be implemented as special purpose logic circuits.
[0249] Computers suitable for executing computer programs include, for example, general and / or special microprocessors, or any other type of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory and / or a random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, the computer will also include one or more large-capacity storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or the computer will be operably coupled to this large-capacity storage device to receive data from it or to transmit data to it, or both. However, the computer does not necessarily have such a device. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, to name a few.
[0250] Computer readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and memory devices, including, for example, semiconductor memory devices (e.g., EPROM, EEPROM and flash memory devices), magnetic disks (e.g., internal hard disks or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks. The processor and memory may be supplemented by, or incorporated in, special purpose logic circuitry.
[0251] Although this specification includes many specific implementation details, these should not be interpreted as limiting the scope of any invention or the scope of protection claimed, but are mainly used to describe the features of the specific embodiments of specific inventions. Certain features described in multiple embodiments in this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although features may work in certain combinations as described above and even initially claim protection, one or more features from the claimed combination may be removed from the combination in some cases, and the claimed combination may point to a sub-combination or a variation of a sub-combination.
[0252] Similarly, although operations are depicted in a particular order in the accompanying drawings, this should not be understood as requiring that these operations be performed in the particular order shown or performed sequentially, or requiring that all illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product, or packaged into multiple software products.
[0253] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.
[0254] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0255] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A document editing method based on a template, characterized in that: include: In response to a document editing request, obtaining a document template specified by the document editing request, wherein the document template is provided with a default text, and the default text is text marked in a specified form; Displaying the document template on a preset page; Based on the preset page, receiving a text editing request initiated for a target default text, wherein the target default text is any of the default texts in the document template; In response to the text editing request, obtaining a target text; Replacing the target default text in the document template with the target text, and retaining the format of the target text as the fixed format of the target default text; After receiving a text editing request initiated for a target default text based on the preset page, the method further includes: In case the text editing request is used to edit a format, the text editing request is shielded.
2. The method according to claim 1, characterized in that: The preset page includes a template area and an editing area, and displaying the document template in the preset page includes: Displaying the document template in the template area; The text editing boxes corresponding to the default texts in the document template are displayed in the editing area to input target texts.
3. The method according to claim 1, characterized in that: The preset page includes a first page and a second page, and displaying the document template in the preset page includes: Generate the first page; Displaying the document template on the first page; A second page is generated, wherein the second page is a transparent page and covers the first page.
4. The method according to claim 3, characterized in that: The receiving, based on the preset page, a text editing request initiated for a target default text comprises: receiving an editing operation acting on the second page; Based on the effective position of the editing operation on the second page, determining the default text located at the effective position in the first page as the target default text; A text editing request for the target default text is received.
5. The method according to claim 4, characterized in that: After receiving the editing operation on the second page, the method further includes: In the case where the text located at the action position in the first page is fixed text, the editing operation is shielded.
6. The method according to claim 4, characterized in that: The receiving a text editing request for the target default text comprises: Setting the area mapped to the target default text on the second page as an editable area; and receiving a text editing request for the target default text based on the editable area; The step of obtaining the target text in response to the text editing request includes: The text entered into the editable area is used as the target text.
7. The method according to claim 1, characterized in that: There is a mapping relationship between the default text and its fixed format, and the step of replacing the target default text in the document template with the target text and retaining the format of the target text as the fixed format of the target default text includes: The mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the target text and the fixed format, so as to obtain the target text with the fixed format.
8. The method according to claim 7, characterized in that: The document template is provided with a domain for the default text, the domain is bound with a fixed format of the default text, and the updating of the mapping relationship between the target default text and its fixed format to the mapping relationship between the target text and the fixed format includes: Determine the domain corresponding to the target default text; The value of the field is updated from the target default text to the target text, and the fixed format of the field binding is kept unchanged.
9. The method according to claim 1, characterized in that: After replacing the target default text in the document template with the target text and retaining the format of the target text as the fixed format of the target default text, the method further includes: The updated document template is displayed in the preset page.
10. The method according to claim 1, characterized in that: After receiving a text editing request initiated for a target default text based on the preset page, the method further includes: In the case that the text editing request includes a deletion instruction for the target default text, in response to the deletion instruction, the mapping relationship between the target default text and its fixed format is updated to a mapping relationship between a designated character and the fixed format.
11. The method according to claim 10, characterized in that: The updating of the mapping relationship between the target default text and its fixed format to the mapping relationship between the specified character and the fixed format includes: Based on the preset add / delete tag of the target default text, determining whether the target default text can be deleted; the add / delete tag is used to identify the corresponding default text as a deletable and restorable element; If possible, the mapping relationship between the target default text and its fixed format is updated to the mapping relationship between the specified character and the fixed format.
12. The method according to claim 10 or 11, characterized in that: The method further comprises: In response to a recovery request for the deleted target default text, the mapping relationship between the designated characters and the fixed format is updated to the mapping relationship between the target default text and the fixed format.
13. A document editing device based on a template, characterized in that: The device comprises: A template acquisition unit, configured to acquire, in response to a document editing request, a document template specified by the document editing request, wherein the document template is provided with a default text, and the default text is a text marked in a specified form; A display unit, used to display the document template in a preset page; A receiving unit, configured to receive a text editing request initiated for a target default text based on the preset page, wherein the target default text is any of the default texts in the document template; After receiving a text editing request initiated for a target default text based on the preset page, the method further includes: In the case where the text editing request is used to edit a format, shielding the text editing request; A text acquisition unit, configured to acquire a target text in response to the text editing request; A replacement unit is used to replace the target default text in the document template with the target text, and keep the format of the target text as the fixed format of the target default text.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Document generation method, device and equipment
CN112749536A