A document editing method, device, storage medium, and apparatus

By configuring a second font format from the registry to automatically convert the font format of text objects, the problem of frequently manually modifying fonts in official document writing is solved, achieving efficient document editing and standard format compliance.

CN113935282BActive Publication Date: 2025-11-25ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111262323.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-11-25
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

In the process of drafting official documents, users need to frequently and manually modify the font format to meet the standard requirements of different hierarchical structures, which makes editing inconvenient and prone to errors.

Method used

By determining the text type of text objects in the document, configuring the corresponding second font format from the registry, and rendering text objects using the second font format when they differ from the first font format, the text objects are automatically converted to a standard format.

Benefits of technology

It improves document editing efficiency, ensures that documents meet standard format requirements, and avoids non-standard issues caused by users making arbitrary modifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113935282B_ABST
    Figure CN113935282B_ABST
Patent Text Reader

Abstract

The specification provides a document editing method, device, storage medium and equipment, in which, according to the text type of a text object in a document, a second font format configured for the text type is determined from a registry, the text object is set to a first font format in the document, and in the case that the second font format is different from the first font format, the text object is rendered using the second font format. In this way, the text object in the document is automatically converted to the font format corresponding to its text type, which can quickly meet the requirements of the standard format, improve the efficiency of document editing, and since the second font format is configuration information written into the registry and must be modified through the registry, the problem of non-standard documents caused by users arbitrarily modifying the font format in the program can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of computer, and particularly relates to a document editing method and device, a storage medium and an equipment. BACKGROUND

[0002] In daily work and life, a user often needs to edit a document according to a certain standard, especially a government document, which needs to be written according to the national standard format of the government document. The government document is a written material formed and used by a legal organ and organization in a public activity according to a specific body and a certain processing procedure. In the process of writing the government document, different levels of the document are provided with corresponding standard font formats, which leads to the fact that the user needs to actively modify the font every time the level is changed in the editing process, which is very inconvenient and prone to errors. SUMMARY

[0003] To overcome the problems in the related art, the present specification provides a document editing method and device, a storage medium and an equipment.

[0004] According to a first aspect of an embodiment of the present specification, a document editing method is provided, comprising:

[0005] determining a text type of a text object in a document, wherein the text object is set to a first font format in the document;

[0006] determining a second font format configured for the text type from a registry;

[0007] in a case where the second font format is different from the first font format, rendering the text object using the second font format.

[0008] In some examples, the above determining the text type of the text object in the document comprises:

[0009] reading document data corresponding to the document;

[0010] parsing a label of the text object from the document data;

[0011] determining a text type mapped by the label as the text type of the text object based on a mapping relationship between the label and the text type.

[0012] In some examples, the above determining the second font format configured for the text type from the registry comprises:

[0013] accessing the registry;

[0014] searching an entry configured for the text type in the registry;

[0015] In the presence of the table entry, a second font format corresponding to the text type is determined according to a value of the table entry.

[0016] In some examples, the searching, in the registry, for the table entry configured for the text type in the registry comprises:

[0017] constructing a string based on a name of the text type;

[0018] determining an access path using the string;

[0019] searching, in the registry, for the table entry corresponding to the text type according to the access path.

[0020] In some examples, the text type comprises a structure type and a character type; and the constructing a string based on a name of the text type comprises:

[0021] concatenating the name of the structure type and the name of the character type according to a preset classification order to obtain the constructed string.

[0022] In some examples, the method further comprises:

[0023] In the absence of the table entry, a default font format of the text type is used as the second font format.

[0024] In some examples, the rendering the text object using the second font format comprises:

[0025] ignoring a first font format of the text object set in a document when rendering the text object;

[0026] rendering characters in the text object using the second font format.

[0027] In some examples, the method further comprises:

[0028] receiving an editing operation for editing a font format of a target text object;

[0029] if a text type of the target text object is configured with a corresponding font format in the registry, shielding the editing operation.

[0030] In some examples, the method further comprises:

[0031] obtaining an incremental installation package;

[0032] extracting a font configuration file from the incremental installation package;

[0033] configuring a corresponding font format for a preset text type in the registry based on the font configuration file.

[0034] In some examples, the font format includes at least one of a font type, a font style, a font size, a number of character bits occupied, and a font color.

[0035] According to a second aspect of the embodiments of the present specification, a document editing apparatus is provided, including:

[0036] A first determining module configured to determine a text type of a text object in a document, wherein the text object is set to a first font format in the document;

[0037] A second determining module configured to determine a second font format configured for the text type from a registry;

[0038] A rendering module configured to render the text object using the second font format if the second font format is different from the first font format.

[0039] According to a third aspect of the embodiments of the present specification, a computer readable storage medium is provided, which stores a computer program, and the program is executed by a processor to implement any of the methods in the embodiments of the present specification.

[0040] According to a fourth aspect of the embodiments of the present specification, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods in the embodiments of the present specification when executing the program.

[0041] The technical solutions provided by the embodiments of the present specification can include the following beneficial effects:

[0042] In the embodiments of the present specification, a document editing method, apparatus, storage medium, and device are disclosed, in which a second font format configured for a text type of a text object in a document is determined from a registry according to the text type of the text object, the text object is set to a first font format in the document, and the text object is rendered using the second font format if the second font format is different from the first font format. In this way, the text object in the document is automatically converted to a font format corresponding to its text type, which can quickly meet the requirements of standard formats and improve the efficiency of document editing. Moreover, since the second font format is configuration information written into the registry, it must be modified through the registry, which can avoid the problem of non-standard documents caused by users arbitrarily modifying font formats in the program.

[0043] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present specification. BRIEF DESCRIPTION OF DRAWINGS

[0044] The accompanying drawings, which are incorporated herein and constitute part of this specification, illustrate embodiments consistent with the description and serve to explain the principles of the description.

[0045] Figure 1 is a flow chart of a document editing method according to an exemplary embodiment of the description;

[0046] Figure 2 is a schematic diagram of preset table items configured by an application in a registry according to an exemplary embodiment of the description;

[0047] Figure 3 is a schematic diagram of a scheme flow of an application performing automatic conversion of fonts according to an exemplary embodiment of the description;

[0048] Figure 4 is a hardware structure diagram of a computer device in which a document editing apparatus is located according to an exemplary embodiment of the description;

[0049] Figure 5 is a block diagram of a document editing apparatus according to an exemplary embodiment of the description. DETAILED DESCRIPTION

[0050] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description of the exemplary embodiments is merely representative of all embodiments consistent with the description. Rather, they are merely examples of apparatus and methods consistent with some aspects of the description as detailed in the appended claims.

[0051] The terminology used in the description is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in the description and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0052] It will be understood that, although the terms first, second, third, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used merely as labels to distinguish between different sets of information. For example, a first information can be termed a second information, and similarly, a second information can be termed a first information, without departing from the scope of the description. The word "if' as used herein means "when" or "upon" or "in response to the determination" depending on the context.

[0053] In daily work and life, users often need to edit documents according to certain specifications, especially for writing official documents. Official documents, i.e. official documents, are written materials formed and used by legal organizations and organizations in official activities according to specific formats and through certain processing procedures. In the process of writing official documents, the corresponding standard font format needs to be set for different levels of document structure according to the national official document standard format, which leads to the fact that users need to actively modify the font every time the level changes during editing, which is very inconvenient and prone to errors. Based on this, the embodiments of the present specification provide a document editing scheme to solve the above problems.

[0054] Next, the embodiments of the present specification will be described in detail:

[0055] As Figure 1 indicated, Figure 1 is a flowchart of a document editing method according to an exemplary embodiment of the present specification. The method can be applied to an application program for editing a document, of course, in addition to editing a document, the application program can also be used for browsing a document, establishing a document, and other processing operations.

[0056] The method comprises:

[0057] Step 101, determining the text type of the text object in the document, wherein the text object is set to a first font format in the document;

[0058] The text object mentioned in this step refers to the text information recorded and stored in a document. A text object can be a word, a sentence, a paragraph, or a passage. The text type of the text object can be a type related to the layout display of the text object in the document. In some examples, the said text type can include a structural type and / or a character type. Among them, the structural type refers to the type of the hierarchical structure where the text object is located, and it can be divided according to the layout requirements of the specific document. For example, the main text part of some documents can include four hierarchical structures. The first layer uses "一、" as the ordinal language, the second layer uses "(一)" as the ordinal language, the third layer uses "1." as the ordinal language, and the fourth layer uses "(1)" as the ordinal language. At this time, the structural type of the title of the first layer can be called a first-level title, and so on. The structural type of this document can also include second-level titles, third-level titles, and fourth-level titles. Correspondingly, the structural types of the main texts under each title can be divided into first-level main texts, second-level main texts, third-level main texts, and fourth-level main texts according to the hierarchical structure. Of course, in other embodiments, the structural types of the main texts under each title can also be uniformly recorded as main texts. In addition, some documents can also include other structural types, such as the text area, the header, the footer, etc. This specification does not limit this. The character type can include Chinese, Western languages, numbers, punctuation marks, etc. Among them, Western languages refer to the texts of English and other Western European languages.

[0059] In some examples, when the text object is the current editing content in the document, that is, the content that the user is about to input in the current document, the structural type corresponding to the text object can be determined based on the position information of the text object in the document. In an application program, usually the cursor is used as the identifier of the position where the user is about to input content. The user can control the position of the cursor through a mouse, a keyboard, etc. to control the position of the content to be input. If the position where the user is about to input content is in a paragraph with the ordinal language of the first layer, it can be determined that the structural type of the text object is a first-level title; or, if there is no ordinal language in the paragraph corresponding to the position where the user is about to input content, and in the above content of this paragraph, the ordinal language closest to this paragraph is the ordinal language of the second layer, it can be determined that the structural type of the text object is a second-level main text. At the same time, the character type corresponding to the text object can be determined based on the unified code converted from the text object. Since the unified code (Unicode) sets a unified and unique binary code for each character in each language, therefore, through the converted unified code, the character type of the text object can be determined.

[0060] In some examples, the text type of the text object can be determined based on the following manner: reading document data corresponding to the document; parsing a label of the text object from the document data; and determining a text type mapped by the label as the text type of the text object based on a mapping relationship between the label and the text type. Since the current document editing software adopts Extensible Markup Language (XML) as a markup language, the document data can include XML data. XML is a markup language used to mark electronic files to have a structure, and the text object in the document is presented in the form of an XML element in the XML data. The XML element mainly includes a label and element content, and the label of the XML element can include an XML attribute for providing additional information about the XML element. Therefore, based on the label of the text object or the attribute defined in the label of the text object, the structure type and / or the character type of the text object can be determined. Specifically, the parsing of the document data can be implemented based on a Document Object Model (DOM) manner. DOM is a tree-based Application Programming Interface (API), and when parsing the XML data, it can present the XML data as a tree structure with elements, attributes, and text, i.e., a DOM tree. Through the operation of the DOM tree, the operation of the XML data can be implemented, for example, by traversing the DOM tree, the attribute value in the label of each XML element can be extracted. Since the attribute value of the label can describe the corresponding information in different forms, after the label of the text object is parsed, the text type mapped by the label can be determined as the text type of the text object based on a pre-set mapping relationship. Through the manner of parsing the document data, the text type of the text object can be quickly determined, thereby improving the efficiency. Of course, in other embodiments, the document data can also be other types of data, such as HTML data, etc. Correspondingly, the document data can also be parsed based on other manners, which is not limited in the present specification.

[0061] The embodiment is a scheme for automatically converting font formats of text objects in a document. The scheme can be used to automatically convert font formats of text objects input by a user during the user's editing of a document, or to automatically convert font formats of text objects in an external document when the user opens the external document. The first font format mentioned in this step is the font format of a text object before the automatic conversion. The first font format can be the default font format displayed when the application is started, or the font format of the text object in the source of the copy. For example, if the default Chinese font is Songti No. 4 when the application is started, the Chinese content input by the user in a newly created document will usually be displayed in the font format of Songti No. 4, i.e., the first font format of the Chinese content in the current document is Songti No. 4. Alternatively, if the user copies a piece of text from an external document and pastes it in the current document, the first font format of the piece of text in the current document is also Heiti No. 3, because the piece of text is set to the font format of Heiti No. 3 in the external document.

[0062] Step 102, determining a second font format configured for the text type from the registry;

[0063] The registry is a database in an operating system, used to store configuration data of computer software and hardware. The registry is composed of entries. An entry of the registry is equivalent to a folder in the registry, containing sub-entries and value entries. The value entry, also called a value item, is an ordered value with a name and a value. The value entry is composed of a name, a data type, and data. The application of the embodiment has the permission to read and write the registry. The permission can be obtained when the application is installed.

[0064] Corresponding to the first font format, the second font format mentioned in this step is the font format corresponding to the text object after automatic conversion. The second font format can be set according to the standard format requirements of the document. The document in this embodiment can include any one of the following: official documents, papers. The official documents here can include resolutions, bulletins, announcements and the like, and the papers here can include academic papers, degree papers, investigation reports and the like. These documents generally have standard format requirements. Taking official documents as an example, official documents have strict specifications in form and format, and official document files that do not meet the standard format requirements are unqualified and may not be useful. For scenarios that need to write such documents, the scheme of the embodiment can pre-configure table items in the registry according to the standard format requirements of the corresponding document, to record the corresponding relationship between the text type and the second font format. For example, some official documents require Chinese to be in 3 bold font format and require Western to be in 3 new roman font format for first-level titles. The application program of the embodiment can pre-configure corresponding table items in the system registry based on the standard format requirements, such as configuring a table item corresponding to the first-level title. A number of value entries of the table item indicate that the corresponding Chinese font format is 3 bold, and the corresponding Western font format is 3 new roman. In addition to official documents and papers, the scheme of the specification can also be applied to other types of documents, such as contract documents, project declaration documents, etc. The specification does not limit this.

[0065] For the above-mentioned adding method, in some examples, the table item can be added to the specified location in the registry after the application program is installed. The table item can be added based on a font configuration file, which can be pre-stored in the installation package of the application program, or pre-stored in a preset location, such as a preset remote server, so that the installation package of the application program can obtain it from the preset location during the installation process.

[0066] Further, in some scenarios, the standard format of the document faced by different users can be different, for example, when writing official documents, the national official document standard requires the use of Fangsong font, but it is not limited to "Fangsong_GBK" or "Huawen_Fangsong_GBK", so there are differences in the official document standard format of different users. For this case, in the related art, it is common to customize the official document template for each user and replace the new template of the application program for these users one by one, which is a very large workload. In the scheme of the embodiment, for the production platform of the application program, it can prepare the font configuration file according to the user's demand, and then build the installation package of the application program. Since the current software production platform has a mature OEM packaging method, such as using a packaging tool to sort and store the developed main application program, data file, configuration file, etc. and compile it to generate an installation package, therefore, the production platform of the application program can efficiently modify the font configuration file and generate the installation package according to the change of the user's demand, so as to quickly meet the needs of different users.

[0067] For the above change mode of the table item, since the user is generally a non-professional person, it is not easy to accurately change the configuration information of the table item in the registry. Based on this, in some examples, the above method further includes: obtaining an incremental installation package; extracting a font configuration file from the incremental installation package; and configuring a corresponding font format for a preset text type in the registry based on the font configuration file. The extraction of the font configuration file and the writing of the table item can be realized by a preset script in the incremental installation package, that is, the user can obtain the incremental installation package of the application program to obtain the preset script capable of modifying the table item, and then automatically modify the font format configured for each text type in the registry by the preset script. Of course, in other embodiments, the table item can also be updated according to the full download mode, and the present specification does not limit this.

[0068] In some examples, the font format of the table item described above can include at least one of the following: font type, font style, font size, character bit number, font color. The font type here refers to the type of font, which can include Songti, Fongsong, bold, KaiTi, etc.; the font style here can include bold, non-bold, italic, non-italic, etc.; the font size here refers to the size of the font, which can include the first number, the small first number, the first number, the small one, etc., and can also be defined based on the pound value of the font size; the character bit number indicates the full-angle state or the half-angle state, wherein the full-angle state refers to a state in which one character occupies two standard character positions, and the half-angle state refers to a state in which one character occupies one standard character position. It should be noted that, generally, one Chinese character occupies two standard character positions on a computer screen, therefore, the character bit number here can be configuration information for controlling other character types other than Chinese characters; the font color here can include black, red, yellow, etc. The font color of the text object in most documents is generally black, but in some special documents, the font color of part of the text object may be required to be other colors, such as the red font color of the total title in some announcement documents.

[0069] In the above manner, there can be table items in the registry for configuring the second font format corresponding to some text types, and the application program can determine the second font format of the text object based on these table items. For example, the application program has four table items pre-configured in the system registry, which are table item 1, table item 2, table item 3, and table item 4, which correspond to the body, the first-level title, the second-level title, and the third-level title, respectively. Each preset table item includes a plurality of value entries, which correspond to the font format of Chinese, the font format of western characters, the font format of numbers, etc. When the structure type of the currently edited text object is a third-level title and the character type is Chinese, since the table item 3 corresponds to the third-level title structure type, and one value entry of the table item 3 corresponds to the Chinese character type, the application program can determine the second font format of the text object as "3 Fongsong" according to the font format indicated by the value entry corresponding to Chinese in the table item 3, that is, the font size is 3 and the font type is Fongsong.

[0070] In some examples, the second font format can be obtained in the following manner: accessing the registry; searching for a table item configured for the text type in the registry; and in the case where the table item exists, determining the second font format corresponding to the text type according to the value of the table item. That is, after obtaining the text type of the text object, the table item corresponding to the text type can be searched from the registry to determine the second font format corresponding to the text type.

[0071] In some examples, the search table item can be based on the name of the text type to build a string, and then use the string to determine the access path, and then search the table item corresponding to the text type in the registry according to the access path. The location of a table item in the registry can be regarded as a storage path, which is the line of table items that the user goes through when searching for the table item in the registry, and the access path described above is the path of retrieving the table item, when the access path coincides with the storage path of a table item, the table item can be searched; otherwise, when the access path does not coincide with the storage path of the table item, the table item cannot be searched. The table item corresponding to the text type can be named based on the name of the text type, based on which, the string built using the name of the text type can be used to determine the access path, for example, the name of the first-level title can be represented as "title1", and when searching for the table item corresponding to the first-level title, the table item for the first-level title can be determined based on "title1" combined with the path of the application in the registry.

[0072] It should be noted that the table item of the text type can be a first-level classification, or a multi-level classification, wherein in the first-level classification, the structure type and the character type can be configured based on different table items in parallel; the multi-level classification can include a second-level classification, in the second-level classification, the structure type classification can be performed first, and then the character type classification, in this case, the character type can be configured based on the sub-table item of the table item corresponding to the structure type; or the second-level classification of the text type can also perform the character type classification first, and then the structure type classification, accordingly, in this case, the structure type can be configured based on the sub-table item of the table item corresponding to the character type. In some examples, when the text type includes the structure type and the character type, the string built for the text type of the text object can be obtained by concatenating the name of the structure type and the name of the character type in the pre-set classification order. For example, the structure type and the character type of a text object are body text and Chinese respectively, and when determining the access path for the text type of the text object, the string built can be "body text / Chinese" or "body text\Chinese", wherein "body text" is the name of the structure type, "Chinese" is the name of the character type, and " / " or "\" is the concatenation symbol of the path, which is a case of second-level classification. Of course, the multi-level classification can also include N-level classification (N is greater than or equal to 3), which is not limited in the embodiment. The concatenation symbol of the path is also not limited in the embodiment, and can be adjusted adaptively according to different operating systems.

[0073] Step 103, in the case where the second font format is different from the first font format, rendering the text object using the second font format.

[0074] In a case where the second font format configured for the text type of the text object is obtained from the registry, if the second font format is different from the first font format, the text object is rendered using the second font format, and in a case where the second font format is the same as the first font format, the text object can be directly rendered using the first font format, and the result of the rendering is the first font format, which is also the second font format. That is, after the second font format corresponding to the text type of the text object is determined, the text object can be displayed based on the second font format, that is, the font format of the current editing content can be automatically converted to the standard font format. The process in which the application renders the text object using the second font format can include: ignoring the first font format set for the text object in the document, and rendering the characters in the text object using the second font format. The operation mode in which the application ignores the first font format can be not reading the first font format, or skipping reading the first font format. In this way, the application can automatically convert the text object in the document to the standard font format, so as to reduce the workload of manual adjustment of the user. For example, when the user inserts a piece of copied text information from another document into the current document, the first font format of the text information is the font format of the copy source, specifically, Song font No. 3, which does not conform to the standard font format of the current document, and the application of the embodiment can automatically convert the font format of the text information to the second font format conforming to the standard, specifically, Bold font No. 3. The conversion process is automatically performed by the application, without the need for manual operation of the user.

[0075] In addition, in the embodiment, when the application replaces the first font format with the second font format to render the text object, the format set for the text object in the document can not be changed, in which case, when the user opens the document by using another application, the font format of the displayed text object is still the first font format; and in some other examples, the application can change the format set for the text object in the document, in which case, when the user opens the document by using another application, the font format of the displayed text object is the second font format.

[0076] In some examples, when there is no table item configured for the text type of the text object in the registry, a default font format of the text type is taken as the second font format. The default font format here can be a font format of the text type in a new template of the application program. The new template of the application program provides a set of styles for the user to use, and the new template can be created and written into the installation package of the current application program by the production platform of the application program according to the standard format requirements of the current document, or can be created and imported into the current application program by the user according to the standard format requirements of the current document. When there is a table item configured for the text type of the text object in the registry, the application program preferentially adopts the second font format indicated by the target table item to render the text object; when there is no table item configured for the text type of the text object in the registry, the application program obtains the default font format of the text type in the new template, and renders the text object according to the default font format, thereby quickly realizing the adjustment of the font format. In this way, the efficiency of the user document editing can be improved, and both the requirements of the standard format and the requirements of the user customized format can be met.

[0077] In actual applications, the application program for editing a document generally provides functions for the user to modify the font format, and these functions are presented in the menu of the application program, so in general, the user can modify the font format through the menu of the application program. However, since there are many font formats, the user is prone to make mistakes when modifying the font format in the program. Based on this, in some examples, when an editing operation for editing the font format of a target text object is received, if the text type of the target text object is configured with a corresponding font format in the registry, the editing operation is shielded. Since the configuration of the registry is system-level, it has a higher priority than the software-level configuration in the software setting interface, so the application program of the embodiment needs to run under the indication of the registry configuration when running. When the user modifies the font format of a target text object in the software setting interface, if the registry is configured with a table item recording the corresponding relationship between the text type of the target text object and the second font format, the application program ignores this editing operation of the user and still renders the target text object based on the second font format. In this way, errors caused by the user's arbitrary modification can be effectively avoided. In addition, when shielding the editing operation of the user, the application program can also prompt the user that the editing operation is invalid in the form of a pop-up window, and optionally, the content of the pop-up window can be text, icons, etc., which are not limited in the present specification.

[0078] The method of the embodiment determines a second font format configured for the text type of a text object of a document from the registry according to the text type of the text object, the text object being set to a first font format in the document, and renders the text object using the second font format if the second font format is different from the first font format. In this way, the text objects in the document are automatically converted to the font format corresponding to their text types, which can quickly meet the requirements of the standard format, improve the efficiency of document editing, and since the second font format is configuration information written into the registry and must be modified through the registry, the problem of non-standard documents caused by users arbitrarily modifying the font format in the program can be avoided.

[0079] Further, considering that in practical applications, documents have multiple types, and different types of documents can have different structure types and different specifications, based on this, in some examples, the preset entry added by the application program in the registry can be configured with: font formats corresponding to different document types, different structure types and / or different character types. The document type here can be determined according to the file format of the document, which can include text documents, table documents, or presentation documents, etc. Specifically, taking an example of configuring the corresponding relationship of the four of the document type, the structure type, the character type, and the font format in the preset entry, the application program can configure a corresponding number of preset entries in the specified location of the system registry in advance according to the number of document types that provide editing functions, and use the subentry of each preset entry to correspond to different structure types, and use the value entry of each subentry to indicate the font format corresponding to different character types in each structure type. Or, when the preset entry configures the corresponding relationship of the document type, the structure type, and the font format, the application program can configure a corresponding number of preset entries in the specified location of the system registry in advance according to the number of document types that provide editing functions, and use the subentry of each preset entry to correspond to different structure types, and use the value entry of each subentry to indicate the font format corresponding to each structure type. Of course, in other embodiments, the corresponding relationship of the document type, the structure type, and / or the character type, and the font format can also be configured based on other settings of the preset entry, the subentry, and the value entry, which are not limited by the present description. In this way, the application program can pre-configure the corresponding preset entry according to the standard format requirements corresponding to different types of documents, and then help the user to automatically convert the font format when the user edits the document, and make the converted font format meet the requirements of the standard format of the document type. It should be noted that according to the specific layout requirements, different document types can have different structure types, for example, for table documents, each cell in the document can be divided into different structure types according to the layout requirements, such as the structure type corresponding to the cell of the first row and the first column is the title, and the structure type corresponding to the remaining cells is the body; for presentation documents, the area of the text box in the document can be divided into different structure types according to the layout requirements, such as the first line in the text box corresponds to the structure type of the title, and the content below the title can be divided into primary text, secondary text, etc. according to the sequence. Of course, in other embodiments, the structure types corresponding to different document types can also be set according to the needs of specific scenarios, which are not limited by the present description.

[0080] In addition, in some examples, the application program can have the official document mode and at least one other mode, and the method of the present disclosure can be executed in response to the user's operation in the case of newly creating a document in the official document mode. For example, the application program can have the official document mode and the normal mode, and when the user newly creates a document in the official document mode, the application program executes the above-mentioned scheme of steps 101 to 103, while when the user newly creates a document in the normal mode, the application program does not convert the font format. In this way, the user can select a suitable mode according to the needs, thereby improving the convenience and the use experience.

[0081] To make a more detailed description of the document editing scheme of the present disclosure, a specific embodiment is introduced as follows:

[0082] In the scenario of the present embodiment, the user needs to write an official document, which needs to be edited according to a preset official document standard format. The official document standard format specifies the font format to be used for different structural types and different character types in the official document, for example, the official document standard format specifies that the Chinese font in the first-level title of the official document is Songti, and the Western font is Arial, and so on.

[0083] The document editing scheme of the present embodiment is applied to an application program. The production platform of the application program prepares a font configuration file according to the user's needs, builds an installation package of the application program, and sends the installation package to the user's device. After the application program is installed on the user's device, the corresponding preset entries in the system registry are configured according to the font configuration file. The preset entries are configured with the font format corresponding to different structural types and different character types, for example, Figure 2 Figure 2 is a schematic diagram of the preset entries configured in the registry by the application program according to an exemplary embodiment. There are four preset entries, respectively corresponding to Title1 (first-level title), Title2 (second-level title), Text1 (first-level text), and Text2 (second-level text) these four structural types. The value entries of each preset entry indicate the font format corresponding to different character types. The value entries of the Title1 preset entry indicate that the font format corresponding to Chinese and punctuation is Songti, and the font format corresponding to Western and numbers is Arial, and further indicate that the character bit number corresponding to Western, numbers, and punctuation is two bytes, i.e., the three character types in this structural type are in full-width state.

[0084] ​The application has a document mode and a normal mode; in the normal mode, the application does not execute the scheme of automatically converting fonts; wherein the application executing the scheme of automatically converting fonts can be embodied based on the following flow as shown in Figure 3

[0085] S301, in response to the operation of the user, a document in the document mode is newly created;

[0086] S302, a preset entry in a specified location in the registry is accessed;

[0087] S303, a structure type and a character type of the current editing content are obtained;

[0088] S304, it is judged whether a target entry corresponding to the structure type and the character type exists in the preset entry, if yes, S305 is executed, otherwise, S306 is executed;

[0089] S305, a target font format is determined according to the target entry, and the current editing content is displayed based on the target font format;

[0090] In one scenario of the embodiment, after the application newly creates a blank document of the document, the current default font is “Fangzheng Fanti_GBK”, when the user inputs the Chinese content of the first-level title, the application determines a target entry from the preset entry, the target entry indicates that the font format corresponding to the Chinese content of the first-level label is “Fangzheng Heiti_GBK”, and then the application automatically converts the current input content of the user into the font format of “Fangzheng Heiti_GBK”;

[0091] S306, the current editing content is displayed according to the default font format corresponding to the structure type in the preset template;

[0092] In one scenario of the embodiment, when the user inputs the Chinese content of the third-level title, the application judges that the target entry corresponding to the Chinese content of the third-level title does not exist in the preset entry, and then the application displays the current input content of the user according to the default font format “Huawen Fanti_GBK” corresponding to the third-level label in the preset template. It should be noted that the style set provided by the preset template of the embodiment does not include the style corresponding to the default font format of different character types; however, in other embodiments, the style set provided by the preset template includes the style corresponding to the default font format of different structure types and different character types, and therefore, when the application judges that the target entry does not exist in the preset entry, the application can determine the corresponding default font format from the preset template according to the structure type and the character type of the current editing content for display.

[0093] ​Through the above process, the application helps the user to automatically convert the default font of each structure type, without the need for the user to modify in the program interface, so that the edited document can meet the requirements of the standard format, and can reduce the workload of repeatedly setting the font, and improve the efficiency of the user document editing.

[0094] Corresponding to the embodiments of the foregoing method, the specification also provides embodiments of a document editing device and a terminal to which the document editing device is applied.

[0095] The embodiments of the document editing device of the specification can be applied on a computer device, such as a server or a terminal device. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking the software implementation as an example, as a logically meaningful device, it is formed by the processor of the file processing reading the corresponding computer program instructions in the non-volatile memory into the memory for running. From the hardware level, as shown in Figure 4 Figure 4 In addition to the processor 410, the memory 430, the network interface 420, and the non-volatile memory 440 shown in the figure, the server or the electronic device in which the device 431 in the embodiment is located, according to the actual function of the computer device, can also include other hardware, which will not be described again.

[0096] Correspondingly, the embodiments of the specification also provide a computer storage medium, the storage medium stores a program, and the program is executed by a processor to implement the method in any of the above embodiments.

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

[0098] As​Figure 5 as shown, Figure 5 is a block diagram of a document editing apparatus according to an example embodiment, the apparatus comprising:

[0099] a first determining module 51 configured to determine a text type of a text object in a document, wherein the text object is set in a first font format in the document;

[0100] a second determining module 52 configured to determine a second font format configured for the text type from a registry;

[0101] a rendering module 53 configured to render the text object using the second font format if the second font format is different from the first font format.

[0102] In some examples, the first determining module comprises:

[0103] a reading module configured to read document data corresponding to the document;

[0104] a parsing module configured to parse a label of the text object from the document data;

[0105] a mapping module configured to determine a text type mapped by the label as the text type of the text object based on a mapping relationship between labels and text types.

[0106] In some examples, the second determining module comprises:

[0107] an accessing module configured to access the registry;

[0108] a searching module configured to search an entry configured for the text type in the registry;

[0109] a first obtaining module configured to determine a second font format corresponding to the text type according to a value of the entry if the entry exists.

[0110] In some examples, the searching module comprises:

[0111] a constructing submodule configured to construct a string based on a name of the text type;

[0112] a first determining submodule configured to determine an access path using the string;

[0113] a searching submodule configured to search the entry corresponding to the text type in the registry according to the access path.

[0114] In some examples, the text type comprises a structure type and a character type; and the constructing submodule is specifically configured to:

[0115] The name of the structure type and the name of the character type are spliced according to a preset classification order to obtain a constructed string.

[0116] In some examples, the apparatus further includes:

[0117] The second obtaining module is configured to, in the absence of the table entry, take a default font format of the text type as the second font format.

[0118] In some examples, the rendering module includes:

[0119] The ignoring submodule is configured to, when rendering the text object, ignore a first font format set for the text object in a document.

[0120] The rendering submodule is configured to render the characters in the text object using the second font format.

[0121] In some examples, the apparatus further includes:

[0122] The receiving module is configured to receive an editing operation for editing a font format of a target text object.

[0123] The shielding module is configured to, if a text type of the target text object is configured with a corresponding font format in the registry, shield the editing operation.

[0124] In some examples, the apparatus further includes:

[0125] The installing module is configured to obtain an incremental installation package.

[0126] The extracting module is configured to extract a font configuration file from the incremental installation package.

[0127] The configuring module is configured to, based on the font configuration file, configure a corresponding font format for a preset text type in the registry.

[0128] The functions and effects of the modules in the apparatus are achieved in the implementation process of the corresponding steps in the above method, and will not be described here.

[0129] For the apparatus embodiments, since they basically correspond to the method embodiments, the relevant parts are referred to the part of the description of the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the modules described as separate components can or can not be physically separated, and the components shown as modules can or can not be physical modules, i.e., can be located in one place or distributed on multiple network modules. Some or all of the modules can be selected to achieve the purposes of the solutions of the present specification according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0130] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order in which they are recited and still achieve the desired results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0131] Other embodiments of the present specification will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples given are intended as illustrative only and not limiting of the true scope and spirit of the present specification. The true scope and spirit of the present specification are indicated by the following claims.

[0132] It should be understood that the present specification is not limited to the precise structures as herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present specification is indicated by the appended claims, and all changes that come within the meaning and range of equivalents are intended to be embraced therein.

[0133] The above only describes the preferred embodiments of the present specification, and does not limit the present specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.

Claims

1. A document editing method, characterized in that, include: Determine the text type of a text object in the document, wherein the text object is set to a first font format in the document; Determine the second font format configured for the text type from the registry; When the second font format is different from the first font format, the text object is rendered using the second font format; wherein, rendering the text object using the second font format includes: ignoring the first font format set in the document when rendering the text object; rendering the characters in the text object using the second font format; the operation of ignoring the first font format includes: not reading the first font format, or skipping reading the first font format, and not changing the first font format set in the document when rendering the text object using the second font format; Receives editing operations for editing the font format of the target text object; If the text type of the target text object has a corresponding font format configured in the registry, the editing operation is disabled.

2. The method according to claim 1, characterized in that, Determining the text type of text objects in a document includes: Read the document data corresponding to the document; Parse the tags of the text objects from the document data; Based on the mapping relationship between tags and text types, the text type mapped to the tag is determined as the text type of the text object.

3. The method according to claim 1, characterized in that, The second font format determined from the registry for the text type includes: Access the registry; Search the registry entries configured for the text type; If the table entry exists, the second font format corresponding to the text type is determined based on the value of the table entry.

4. The method according to claim 3, characterized in that, The process of searching the registry for entries configured for the text type includes: Construct a string based on the name of the text type; Use the string to determine the access path; According to the access path, search the registry for the entry corresponding to the text type.

5. The method according to claim 4, characterized in that, The text type includes structure type and character type; the construction of a string based on the name of the text type includes: The names of the structure type and the character type are concatenated according to a pre-set classification order to obtain the constructed string.

6. The method according to claim 3, characterized in that, The method further includes: If the table entry does not exist, the default font format of the text type shall be used as the second font format.

7. The method according to claim 1, characterized in that, The method further includes: Obtain the incremental installation package; Extract the font configuration file from the incremental installation package; Based on the font configuration file, the corresponding font format is configured in the registry for the preset text type.

8. A document editing device, characterized in that, include: The first determining module is used to determine the text type of a text object in a document, wherein the text object is set to a first font format in the document; The second determining module is used to determine from the registry the second font format configured for the text type; A rendering module is used to render the text object using the second font format when the second font format is different from the first font format; wherein, rendering the text object using the second font format includes: ignoring the first font format set in the document when rendering the text object; rendering the characters in the text object using the second font format; the operation of ignoring the first font format includes: not reading the first font format, or skipping reading the first font format, and not changing the first font format set in the document when rendering the text object using the second font format; The receiving module is used to receive editing operations for editing the font format of the target text object; The blocking module is used to block the editing operation if the text type of the target text object is configured with a corresponding font format in the registry.

9. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It contains a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Clause document generation method and terminal equipment

    CN110457659A