File content processing method and device, equipment, storage medium and program product
Through font statistics and analysis of presentations and other documents, a unified font is determined and applied, which solves the problem of multiple fonts affecting readability and improves the readability and user experience of documents.
Patent Information
- Application Number
- CN202410664977.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-08-23
AI Technical Summary
In documents such as presentations, the presence of multiple different fonts leads to reduced readability, and there is a lack of a quick way to unify fonts.
By conducting font statistics on the file content, a suitable font is determined and applied uniformly to the entire file, including obtaining the content in the file object, analyzing character categories and language types, counting font attributes, and finally determining and applying a unified font.
It realizes the rapid unification of fonts in the file content and improves the readability and user experience of the file.
Smart Images

Figure CN118536475A
Abstract
Description
Technical Field
[0001] The present application relates to the field of document processing technology, and in particular to a file content processing method and apparatus, device, storage medium and program product. Background Art
[0002] In presentations such as PPT (powerpoint), texts may be included. The texts in the presentation may have different fonts such as Kaiti, Heiti, etc. These texts in different fonts appearing in the same presentation document will seriously affect the readability of the presentation document.
[0003] Then, how to quickly unify the fonts in the content of files such as presentations is an urgent problem to be solved. Summary of the invention
[0004] The present application provides a file content processing method and device, electronic device, storage medium and program product to achieve the unification of fonts in the content of a file.
[0005] In a first aspect, the present application provides a method for processing file content. The method includes: in response to a font processing operation on a first object in a first file, displaying a first font obtained based on first content in the first object; in response to a font setting operation of applying the first font to the first file, setting a second object related to the first file to the first font.
[0006] In some possible implementations, the operation of displaying a first font obtained based on a first content in a first object may include: determining the first object based on a first file; obtaining the first content from the first object; performing font statistics on the first content to obtain statistical results, wherein the statistical results include at least one font in the first content and attributes corresponding to each font in at least one font; and determining the first font from at least one font based on the statistical results.
[0007] In some possible implementations, the operation of determining the first object based on the first file may include: acquiring a first master according to the first file, wherein the first file is generated based on the first master; and determining the first object based on the first file and the first master.
[0008] In some possible implementations, performing font statistics on the first content to obtain statistical results may include: obtaining at least one character from the first content; determining the character category of at least one character; and performing font statistics on the at least one character according to the character category to obtain statistical results corresponding to each character category.
[0009] In some possible implementations, the operation of determining the character category of at least one character may include: determining the location type of each first content; determining the language type of each character in each first content; and determining the character category of each character based on the location type and the language type.
[0010] In some possible implementations, the second object may include an object in a copy of the first file; wherein the operation of setting the second object related to the first file to the first font may include: setting the second object to the first font, wherein the content in the first file is consistent with the content of the copy and has the same or different font properties.
[0011] In some possible implementations, the second object may include content in the second object; wherein, the operation of setting the second object related to the first file to the first font may include at least one of the following: setting the content in the second object of the same type associated with the first file to the first font; setting the content in the second object of a different type associated with the first file to the first font.
[0012] In some possible implementations, the first font may include multiple fonts; wherein the operation of setting the second object related to the first file to the first font may include: determining an association relationship between the second object and multiple fonts of the first font; and setting the second object associated with the first file to the first font based on the association relationship.
[0013] In a second aspect, the present application provides a file content processing device. The device includes a first processing module and a second processing module. The first processing module is configured to: in response to a font processing operation on a first object in a first file, display a first font obtained based on a first content in the first object. The second processing module is configured to: in response to a font setting operation of applying a first font to the first file, set a second object related to the first file to the first font.
[0014] In some possible implementations, the first processing module may include an object determination module, a content acquisition module, a font statistics module, and a font determination module. The object determination module is configured to determine the first object based on the first file. The content acquisition module is configured to obtain the first content from the first object. The font statistics module is configured to perform font statistics on the first content to obtain statistical results. The statistical results include at least one font in the first content and the attributes corresponding to each font in the at least one font. The font determination module is configured to determine the first font from the at least one font based on the statistical results.
[0015] In some possible implementations, the object determination module may be configured to: obtain a first master according to a first file, wherein the first file is generated based on the first master; and determine a first object based on the first file and the first master.
[0016] In some possible implementations, the font statistics module may be configured to: obtain at least one character from the first content; determine the character category of the at least one character; and perform font statistics on the at least one character according to the character category to obtain statistical results corresponding to each character category.
[0017] In some possible implementations, the font statistics module may be configured to: determine the location type of each first content; determine the language type of each character in each first content; and determine the character category of each character according to the location type and the language type.
[0018] In some possible implementations, setting the second object related to the first file as the first font can be understood as the second object having a relationship with the first file, and the second object can be a copy file of the first file, a cloud shared file, a file copy, content in the first file, a component in the first file, etc.
[0019] In some possible implementations, the second object may include an object in a copy of the first file; wherein the second processing module may be configured to: set the second object to a first font, wherein the content in the first file is consistent with the content in the copy and has the same or different font properties.
[0020] In some possible implementations, the second object may include content in the second object; wherein the second processing module may be configured to perform at least one of the following: setting the content in the second object of the same type associated with the first file to the first font; setting the content in the second object of a different type associated with the first file to the first font.
[0021] In some possible implementations, the first font may include multiple fonts; wherein the second processing module may be configured to: determine an association relationship between the second object and multiple fonts of the first font; and set the second object associated with the first file to the first font according to the association relationship.
[0022] In a third aspect, the present application provides an electronic device. The electronic device includes a processor and a memory. The memory is used to store executable instructions. The processor is configured to implement the method as described in any one of the first aspect and possible implementations thereof when executing the executable instructions.
[0023] In a fourth aspect, the present application provides a storage medium. The storage medium stores an executable program. When the executable program is executed by a processor, it can implement the method as described in any one of the first aspect and possible implementations thereof.
[0024] In a fifth aspect, the present application provides a computer program or a computer program product. When the computer program or the computer program product is executed on a computer, the computer implements the method as described in any one of the first aspect and possible implementations thereof.
[0025] The technical solution provided by this application may have the following beneficial effects:
[0026] Through this application, font statistics can be performed on files of types such as presentations and characters in possible masters, and fonts suitable for the entire file can be determined based on the statistical results. In this way, one or more fonts can be selected from a variety of possible fonts, and the selected fonts can be applied to the entire file. In this way, the fonts in the content of the entire file can be quickly unified, the font unification operation can be simplified, the readability can be improved, and the user experience can be enhanced.
[0027] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The present invention is a flowchart of a method for processing file content provided in accordance with an embodiment of the present application.
[0029] Figure 2 Schematic diagram of the process of step S110 in the file content processing method provided according to an embodiment of the present application.
[0030] Figure 3 It is a structural diagram of a file content processing device provided according to an embodiment of the present application.
[0031] Figure 4 It is a schematic diagram of the structure of the first processing module in the file content processing device provided according to an embodiment of the present application.
[0032] Figure 5 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application.
[0034] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a" and "the" used in the embodiments of the present application 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 in this article refers to and includes any or all possible combinations of one or more associated listed items.
[0035] It should be understood that, although the terms "first", "second", "third", etc. may be used to describe various information in the embodiments of the present application, 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 embodiments of the present application, "first information" may also be referred to as "second information", and similarly, "second information" may also be referred to as "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 determination".
[0036] Furthermore, in the description of the embodiments of the present application, "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" can refer to two or more than two.
[0037] A presentation is a type of file that can be used for work reports, corporate publicity, product promotion, teacher lectures, etc. Currently, many software providers have provided tools for creating and editing presentations. In addition, many tools for creating and editing presentations can run on one or more operating systems, such as Windows operating system, Mac operating system, Linux operating system, Android operating system, IOS operating system, Harmony operating system or other operating systems.
[0038] In order to improve the readability and aesthetics of a presentation, a theme font may be used in the actual production of the presentation to unify the fonts of the text in the presentation. The theme font may be preset or customized. However, the preset theme fonts are usually limited, and the customization of theme fonts requires complicated operations. It is understandable that this situation may also exist in situations involving document files, spreadsheet files, or other types of files.
[0039] Then, how to quickly unify the fonts of texts in files such as presentations is a problem that needs to be solved urgently.
[0040] To this end, the embodiments of the present disclosure provide a content processing method and apparatus, an electronic device, a storage medium, and a program product.
[0041] In some embodiments, the file content processing method in the embodiments of the present application can be implemented by a first tool. For example, the first tool can be used to quickly unify the fonts in the content of the file.
[0042] In some embodiments, the first tool may be a software tool based on a programming language. The first tool may obtain information and content of a file through an interface call, or even modify the file. In some embodiments, the first tool may be a tool based on a programming language. For example, the first tool may be a tool based on VBA (visual basic for applications), JS (javascript), or other macro languages.
[0043] In some embodiments, the first tool can be independent of the editing tool of the file. In some embodiments, the first tool can be integrated in the editing tool of the file.
[0044] In this embodiment, the file is a PPT document and the first tool is a VBA macro. It is understandable that the file can be other types of files and the first tool can be other tools, which are not specifically limited in this embodiment of the application.
[0045] Figure 1 Schematic diagram of a process flow of a file content processing method provided according to an embodiment of the present application. Figure 1 As shown, the file content processing method may include step S110 and step S120.
[0046] In step S110 , in response to a font processing operation on a first object in a first file, a first font obtained based on first content in the first object is displayed.
[0047] Here, the first file may be a presentation, a document, a spreadsheet file, or other types of files. For example, the first file may be a file of a PPT document type. For example, the file suffix of the first file may be ppt or pptx.
[0048] In some embodiments, the first file may include one or more objects. Each object may be considered as an element in the first file.
[0049] In some embodiments, the objects in the first file can have different types. In some embodiments, the types of objects can include: images, graphics, icons, arrows, text boxes, charts, tables. It is understandable that objects can also have other types, and the embodiments of the present application do not specifically limit this. In some embodiments, objects of text box types can be specifically used to display and edit text. In some embodiments, objects of other types except text box types can also be used to accommodate text.
[0050] In some embodiments, the object may correspond to a Shape object of a VBA macro. In some embodiments, the object in the first file may be referenced by "Shape". In some embodiments, an object of a text box type may be referenced by "Shape" or "TextBox".
[0051] In some embodiments, in response to a font processing operation on a first object in a first file, displaying a first font obtained based on a first content in the first object can be understood as, when setting the font for the first object, the application displays the font types that can be set for the first object, and these font types can be applied to the first content of the first object, or the application displays the font types that can be set for the first content in the first object, and these font types can be applied to the first content of the first object.
[0052] In some embodiments, the first object may be an object targeted by the font processing operation in the first file. The first object may include one or more objects. The first object may include one or more objects among all objects in the first file. For example, the first object may include all objects in the first file. In this case, the font processing operation may be targeted at all objects in the first file. For example, the first object may include some objects in the first file. In this case, the font processing operation may be targeted at some objects in the first file.
[0053] In some embodiments, the font processing operation may be triggered by a user. In one example, the user may trigger the font processing operation through a user interface. For example, a VBA macro may display an option of performing a font processing operation on a first file to a user through a user interface (UI). The user may trigger the font processing operation by selecting the option. For example, a VBA macro may display an operation window through a user interface. The user may select an option related to the font processing operation in the operation window. For example, the user may select the "font processing operation" option. For example, the user may select the "font processing operation" option in the editing window of the first file, thereby triggering a font processing operation for the first file. For example, the user may select the "all" option, and the font processing operation may be for all objects of the first file. For example, the user may select a portion of objects of the first file in the editing window of the first file, and select the "font processing operation" option, and the font processing operation may be for the selected objects in the first file.
[0054] In some embodiments, the font processing operation may be triggered by the VBA macro itself. For example, the VBA macro may perform the font processing operation on the first file according to the configuration.
[0055] In some embodiments, through the font processing operation, the first font obtained based on the first content in the first object can be displayed, so that the user can know the first font obtained for the first file.
[0056] Figure 2 The flowchart of step S110 in the file content processing method provided according to an embodiment of the present application is shown in FIG.
[0057] In step S210 , a first object is determined based on the first file.
[0058] In some embodiments, step S210 may be implemented as: obtaining a first object from a first file.
[0059] Here, the VBA macro can be called through the interface and through the editing tool of the first file to obtain the first object from the first file.
[0060] In some embodiments, step S210 may be implemented as: acquiring a first master according to the first file; and determining a first object based on the first file and the first master.
[0061] In some embodiments, the first file may be generated based on a first master. The first master may be a pre-set master.
[0062] There may be an association between the first file and the first master. In some embodiments, the first file may carry information of the first master. For example, the first file may carry an index value or identifier of the first master. In this case, based on the index value or identifier carried in the first file, the first master associated with the first file may be determined.
[0063] The first master may have a theme font. The theme font of the first master may be a font used throughout the first master. In some embodiments, the font in the first master may be divided into two parts: a primary font and a secondary font. The primary font may be a font used in the portion of the first master used to present the primary content. The secondary font may be a font used in the portion of the first master used to present the secondary content. In some embodiments, the primary font may include a Chinese primary font and a Western primary font. The Western primary font may, for example, include an English font. In some embodiments, the secondary font may include a Chinese secondary font and a Western secondary font. The Western secondary font may, for example, include an English font.
[0064] In some embodiments, the theme font may correspond to the ThemeFont object of the VBA macro. In some embodiments, the theme font may be obtained through "ThemeFont". In some embodiments, the major font may be obtained through "ThemeFont.MajorFont". In one example, the Chinese major font may be obtained through "MajorFont.NameFarEast". In one example, the minor font may be obtained through "ThemeFont.MinorFont". In one example, the Chinese minor font may be obtained through "MinorFont.NameFarEast". In one example, the Western minor font may be obtained through "MinorFont.NameAscii".
[0065] The first master can include placeholders. Placeholders can be considered special objects. Placeholders can be used to identify locations where content is to be inserted in a presentation-type file. The first master can include one or more placeholders.
[0066] The types of placeholders may include mixed, title, text, object, chart, bitmap, media clip, organizational chart, table, slide number, header, footer, date, picture, mixed, etc. It is understandable that the placeholders may also be of other types, which are not specifically limited in the embodiments of the present application.
[0067] In some embodiments, the placeholder may correspond to a Shape object of a VBA macro. In some embodiments, the placeholder in the first master may be referenced by "Shape".
[0068] In some embodiments, the type of the placeholder may be a title. For example, the type of the placeholder may be represented as PlaceholderTypeTitle (placeholder type is title). For example, the enumeration value of the type of the placeholder may be 0. Here, 0 may be used to identify that the type of the placeholder is a title.
[0069] In some embodiments, each placeholder in the first master may be associated with a theme font. Specifically, each placeholder in the first master may correspond to a font in one or more theme fonts of the first master. For example, a placeholder in the first master may correspond to a primary font, and further, to a Chinese primary font and / or an English primary font. For example, a placeholder in the first master may correspond to a secondary font, and further, to a Chinese secondary font and / or an English secondary font.
[0070] After obtaining the first master according to the first information, the VBA macro can be called through the interface, and obtain the first object from the first file and the first master through the editing tool of the first file. Here, the obtained first object can include both the object in the first file and the object in the first master.
[0071] The number of the first objects obtained in step S210 may be one or more. The content in each first object may include an image, a graph, an icon, an arrow, text, a chart, a table, and the like.
[0072] The first object may be a part or all of all objects in the first file and / or the first master.
[0073] In some embodiments, there may be preset content in each placeholder. For example, for a placeholder of a title type, the preset content may include text with preset font attributes. For example, the text in a placeholder of a title type may be "Click here to add a title", and the text may have a preset font. For example, for a placeholder of a body type, the preset content may include text with preset font attributes. For example, the text in a placeholder of a title type may be "Click here to add text", and the text may have a preset font.
[0074] In step S220, first content is obtained from the first object.
[0075] Here, the content in all the first objects may be acquired, thereby obtaining the first content.
[0076] In some embodiments, the first object may include objects of types such as images, graphics, icons, etc. The content in these types of objects may take the form of images or graphics. For example, when the first object is an image, the image may be composed of multiple pixels. These pixels may present one or more characters. In some embodiments, the first object may include objects of types such as tables, text boxes, etc. The content in these types of objects may take the form of text. For example, when the first object is a text box, the text box may include one or more characters.
[0077] In some embodiments, step S220 may be implemented as: traversing all first objects in the first file and / or the first master to determine the first objects containing content; and obtaining the first content from the first objects containing content.
[0078] In some embodiments, the content obtained from each first object can be considered as one first content. In this way, the number of first objects can be one or more, and the number of first contents can also be one or more.
[0079] In some embodiments, the content in the first object may exist in the form of text. For example, the first object may be a text box, and the text in the first object may be directly acquired and used as the first content.
[0080] In some embodiments, the content in the first object may exist in the form of an image. For example, the first object may be an image, a graphic, an icon, etc., and the first content may be obtained by processing the first object. In one example, the first object may be a picture in which text is presented. In this case, by performing image processing on the first object, the first content associated with these characters may be obtained. Graphic processing may include optical character recognition (OCR) or other processing methods. For example, OCR processing may be performed on the first object to obtain the first content. Here, after the first object is image processed, the text presented in the picture and the font attributes related to the text may be obtained. Font attributes may include, for example, the language type, font, font size, etc. of the text.
[0081] In step S230, font statistics are performed on the first content to obtain statistical results.
[0082] Here, the font statistics of the first content may be performed in units of characters, so as to obtain font-related statistical results. The statistical results may include at least one font appearing in the first content and the attributes of each font in the at least one font.
[0083] In some embodiments, step S230 may be implemented as: obtaining at least one character from the first content; determining a character category of the at least one character; and performing font statistics on the at least one character according to the character category to obtain statistical results corresponding to each character category.
[0084] In the first content, the character category of each character can be one of the following: title Chinese, title Western, main text Chinese, main text Western. In one example, if a character is a Chinese character in the title, the character category of the character can be title Chinese. In one example, if a character is a Western character in the title, the character category of the character can be title Western. In one example, if a character is a Chinese character in the main text, the character category of the character can be main text Chinese. In one example, if a character is a Western character in the main text, the character category of the character can be main text Western.
[0085] In some cases, the first content may be of the type of image, graphic, icon, etc. In this case, the character category of each character in the text presented in the first content may be one of the following: body text in Chinese, body text in Western language.
[0086] After determining the character categories of the characters in the first content, font statistics can be performed on all the characters in the first content according to the character categories. Specifically, for each character category, font statistics can be performed on the characters in the character category.
[0087] In some embodiments, the operation of obtaining at least one character from the first content can be implemented as: traversing all the first contents to obtain all the characters contained in the first contents. It can be understood that, whether it is a first object of text type or a first object of non-text type (including images, graphics, icons, etc.), the first contents in these types of first objects can be traversed to obtain all the characters contained therein. The characters obtained from the first content of the first object of text type can be in the form of text. The characters obtained from the first content of the first object of image, graphic, icon, etc. can be obtained by image processing of the first object.
[0088] In some embodiments, the operation of determining the character category of at least one character can be implemented as: determining the position type of each first content in the first content; determining the language type of each character in each first content; and determining the character category of each character based on the position type and the language type.
[0089] In some embodiments, the location type of each first content may be one of the following: title location, text location. Each first content is obtained from a corresponding first object. The location type of the first content may be determined according to the object type of the corresponding first object. The object type of the first object may be one of the following: title object, text object.
[0090] In some embodiments, when the first object corresponding to each first content is a title object, the position type of the first content can be determined to be a title position; when the first object corresponding to each first content is a text object, the position type of the first content can be determined to be a text position. More specifically, when the object type of a first object is a title object, the position type of the first content obtained from the first object is a title position; when the object type of a first object is a text object, the position type of the first content obtained from the first object is a text position.
[0091] In some embodiments, the operation of determining the location type of the first content may include: determining an object type of a first object corresponding to the first content.
[0092] In one example, for a first object, it can be determined whether the first object is a placeholder object. If the first object is a placeholder object, it can be further determined whether the type of the first object is PlaceholderTypeTitle (for example, the enumeration value is 0). If the type of the first object is PlaceholderTypeTitle (for example, the enumeration value is 0), it can be determined that the first object is a title object. If the type of the first object is not PlaceholderTypeTitle (for example, the enumeration value is 0), it can be determined that the first object is a non-title object. If the first object is not a placeholder object, it can be further determined whether the first object is a title object based on the tag information of the first object. The tag information can be used to indicate that the first object is a tag object. It should be noted that regardless of whether the first object is a placeholder object, if the first object is determined to be a non-title object (i.e., an object other than a title object), the first object can be considered to be a text object.
[0093] In some embodiments, the language type of each character in each first content can be determined. In one example, the language type can include Chinese and Western. At this time, it can be determined that each character in each first content is a Chinese character or a Western character. In one example, the language type can more specifically include Chinese and English. At this time, it can be determined that each character in each first content is a Chinese character or an English character.
[0094] In some embodiments, determining the language type of a character can be achieved based on the ASCII (American Standard Code for Information Interchange) value of the character. ASCII can include 128 different symbols. All English letters, all numeric symbols, and other commonly used symbols are specified in ASCII. The value of ASCII can be represented by an 8-bit binary number. For example, the numerical values 0 to 127 can be represented by 00000000 to 01111111, respectively, and can be used to represent English letters, numeric symbols, and other commonly used symbols. 10000000 to 11111111 can be defined as negative numbers. In this way, for each character, if the ASCII value of the character is less than 0, it can be determined that the character is a Chinese character; if the ASCII value of the character is greater than or equal to 0, it can be determined that the character is an English character.
[0095] By traversing each character in each first content, the position type and language type of the character can be obtained. Based on the position type and language type, the character category of the character can be determined. In one example, the character category of the character is a combination of the position type of the first content where the character is located and the language type of the character. In this way, the character categories of all characters in the first file and / or the first master can be determined.
[0096] In the first file and the first master, the font can be set in units of characters. In other words, each character has corresponding attribute information. The attribute information may include the font attribute of the character. The font attribute can be used to indicate the font of the character. The font attribute can exist in the first file along with the character. In some embodiments, the font of the character can correspond to the Font object of the VBA macro. In some embodiments, the font of the character can be referenced by "Font.Name".
[0097] In some embodiments, font statistics of at least one character may be performed separately for different character categories such as Chinese for titles, Western for titles, Chinese for main text, and Western for main text.
[0098] In some embodiments, font statistics may be performed on characters in each character category among all characters in all first contents to obtain statistical results.
[0099] In some embodiments, the statistical results may include the fonts of the characters under the character category and the attributes of the fonts.
[0100] In some embodiments, the attributes of the font in the statistical results can be used to indicate information related to the font. For example, the attributes of the font may include the number of characters or the ratio of the number of characters corresponding to each font obtained by font statistics. Of course, the attributes of the font may also include other information of the character, such as font size, etc., which is not specifically limited in the embodiments of the present application.
[0101] In one example, the statistical results can be presented in the form of a storage table. In the storage table, the statistical results can be expressed as: [font 1, attribute 1], [font 2, attribute 2], ..., [font n, attribute n]. Here, n can be a positive integer. Font 1, font 2, ..., font n can be n fonts presented by the characters under the character category. Attribute 1, attribute 2, ..., attribute n correspond to n fonts respectively. In one example, the attribute of the font can be the number of characters, and the storage table can be: [font 1, number of characters 1], [font 2, number of characters 2], ..., [font n, number of characters n]. Font 1, font 2, ..., font n can be n fonts presented by the characters under the character category. Number of characters 1 can be the number of characters using font 1 under the character category. Number of characters 2 can be the number of characters using font 2 under the character category. Number of characters n can be the number of characters using font n under the character category. It can be understood that the number of characters can also be understood as the number of occurrences. In other words, the character quantity 1 may be the number of times a character using font 1 appears under the character category, the character quantity 2 may be the number of times a character using font 2 appears under the character category, and so on.
[0102] In some embodiments, storage tables may be established for different character categories such as Chinese titles, Western titles, Chinese text, and Western text. Then, in the process of traversing all characters in all first contents of the first file, after obtaining the font of a symbol under a character category, the number of characters of the corresponding font under the character category in the storage table may be added by 1. In this way, after completing the traversal of all characters, statistical results corresponding to different character categories may be obtained.
[0103] In some embodiments, the statistical results may be stored and / or presented in the following manner: [font 1, character quantity ratio 1], [font 2, character quantity ratio 2], ..., [font n, character quantity ratio n]. Here, n may be a positive integer. Font 1, font 2, ..., font n may be n fonts presented by the characters under the character category. The number of characters 1 may be the ratio of characters using font 1 under the character category to all characters under the character category. The number of characters 2 may be the ratio of characters using font 2 under the character category to all characters under the character category. The number of characters n may be the ratio of characters using font n under the character category to all characters under the character category.
[0104] In step S240, a first font is determined from at least one font according to the statistical result.
[0105] Here, after obtaining the statistical results in step S230, a first font applied to the first file may be determined based on the statistical results.
[0106] The first font may be used to set the font for the characters of the first content in the first file. In some embodiments, the first font may be a font corresponding to the largest number of characters in at least one font corresponding to the first content. Specifically, among the one or more fonts used for the characters in the first content, the font corresponding to the largest number of characters may be the first font.
[0107] The first font may include one or more second fonts. Different character categories may correspond to the same or different second fonts. For example, the first font may include four second fonts. These four second fonts may correspond to the title Chinese, the title Western, the body Chinese, and the body Western, respectively. In one example, the second fonts corresponding to the title Chinese and the body Chinese may be the same or different. In one example, the second fonts corresponding to the title Western and the body Western may be the same or different. In one example, the second fonts corresponding to the title Chinese and the title Western may be the same or different. In one example, the second fonts corresponding to the body Chinese and the body Western may be the same or different.
[0108] The first font may be the same or different for the first content of the first object of a text type and the first content of the first object of a non-text type.
[0109] In some embodiments, the statistical results may include statistical results corresponding to each character category. In this case, step S240 may be implemented as: determining the second font according to the statistical results corresponding to each character category. In some embodiments, the second font may be a font corresponding to the characters with the maximum number of characters in each character category. In some embodiments, the second font may be a font corresponding to the characters with a larger number of characters in each character category.
[0110] The statistical result may be obtained by performing font statistics according to the character category in step S230. In this way, for each character category, the second font may be determined separately. The second font may be the font corresponding to the maximum number of characters in the character category. In one example, for each character category, the font with the largest number of characters may be determined from the corresponding statistical result as the second font. For example, the maximum number of characters may be determined from the number of characters 1, the number of characters 2, ..., the number of characters n, and the font corresponding to the maximum number of characters may be determined as the second font. For example, the maximum number of characters may be determined from the number of characters ratio 1, the number of characters ratio 2, ..., the number of characters ratio n, and the font corresponding to the maximum number of characters ratio may be determined as the second font. For example, a larger number of characters may be determined from the number of characters 1, the number of characters 2, ..., the number of characters n, and the font corresponding to these larger numbers of characters may be determined as the second font. For example, a larger number of character ratios may be determined from the number of characters ratio 1, the number of characters ratio 2, ..., the number of characters ratio n, and the font corresponding to these larger number of characters may be determined as the second font. For example, a larger number of character ratios may be determined from the number of characters ratio 1, the number of characters ratio 2, ..., the number of characters ratio n, and the font corresponding to these larger number of characters ratios may be determined as the second font.
[0111] Through the above steps S210 to S240, a first font may be obtained based on the first content in the first object.
[0112] In some embodiments, step S110 may include step S250. In step S250, the first font is displayed.
[0113] After obtaining the first font, the first font may be displayed. For example, the first tool may output information of the first font through a user interface. The information of the first font may be displayed to the user. For example, the information of the first font may be displayed through an operation window. For example, the information of the first font may be displayed through a dedicated display window.
[0114] In one example, the displayed first font may include one font. For example, multiple second fonts for different character types in the first font obtained based on the first content in the first object may be the same, and only one font may be displayed.
[0115] In one example, the displayed first font may include multiple fonts. For example, a second font corresponding to each character type may be displayed. The second font may be a font corresponding to the maximum number of characters or a ratio of the number of characters under each character type. For example, multiple second fonts corresponding to each character type may be displayed. These second fonts may be multiple fonts corresponding to the largest number of characters or a ratio of the number of characters under each character type.
[0116] In one example, a font corresponding to the first object of a text type and a font corresponding to the first object of a non-text type may be displayed.
[0117] In step S120 , in response to a font setting operation of applying a first font to a first file, a second object related to the first file is set to the first font.
[0118] Here, after the first font is determined, the first file may be configured using the first font. Specifically, the characters in the second object related to the first file may be set to the first font.
[0119] In some embodiments, step S120 may be performed in response to a font setting operation. The font setting operation may be an operation performed by a user through a user interface, or may be a configured operation. In one example, a user may select an option related to the font setting operation in the operation window. For example, a user may select the "font setting operation" option. Through the user's font setting operation, font setting of a second object related to the first file may be triggered. In one example, when the first font is obtained, the first tool may perform the font setting operation on its own. For example, the first tool may trigger font setting of a second object related to the first file on its own.
[0120] The second object may include at least one of: an object in the first file, an object in the first master, an object in the copy of the first file.
[0121] In some embodiments, the copy of the first file may be a copy of the entire first file. For example, the copy of the first file may be another file independent of the first file. In this case, the content in the first file may be consistent with the content in the copy. The content in the first file and the content in the copy may be updated synchronously. In the case where either the first file or the copy changes, the other of the two changes synchronously. At the same time, the aspects that remain consistent between the content in the first file and the content in the copy do not include font properties. The content in the first file and the content in the copy may have the same or different font properties. The second object may only include the object in the copy. That is, the first font may only be used to set the font for the second object in the copy. In this process, the font of the object in the first file and the font of the object in the first master do not change. For example, the objects in the first file include content Z and content Y, and content Z and content Y are set with fonts A, font B, and font C. The user sets the first font D. At this time, a copy of the first file can be set. The copy of the first file includes the same content Z and content Y as those in the first file, and the copy of the first file uses the first font D. Furthermore, when content H is added to the first file, content H uses font E. At this time, the copy of the first file simultaneously adds content H. Since the first font is still the first font D, the content H added to the first copy is still the first font D. Furthermore, the first file and the copy of the first file can be displayed on two devices respectively. The copy of the first file can be the content shared or projected by the first file. There may or may not be an association relationship between the copy of the first file and the first file. Then, when there is no association relationship, information will not be synchronized between the two. For example, the object in the first file contains content Z and content Y, and content Z and content Y are set with fonts A, font B, and font C. The user sets the first font D. At this time, a copy of the first file can be set. The copy of the first file includes the same content Z and content Y as in the first file. The copy of the first file uses the first font D. Then, no matter how the content is added, deleted, or modified in the first file, it will not affect the content of the copy of the first file. The copy of the first file can be, when the first file is saved as a copy of the first file or the first file is exported as a copy of the first file or the first file is output as a copy of the first file, the user sets the copy of the first file saved, exported, or output to the first font D, and makes the two have no association relationship, then the copy of the first file will maintain the first font D.Here, the copy of the first file may include all the contents of the first file, or may only include part of the contents of the first file. In the case of including all the contents, the contents of the copy of the first file may be all synchronously associated with the first file, or part of the contents in the copy of the first file may be synchronously associated with part of the contents in the first file. In the case of including only part of the contents of the first file, the contents of the copy of the first file may be all synchronously associated with the first file, or part of the contents in the copy of the first file may be synchronously associated with part of the contents in the first file, or may not be associated.
[0122] In some embodiments, the copy of the first file may be a copy of a portion of the first file. For example, the copy of the first file may be a copy of one or more objects in the first file. Taking the first object of image type as an example, the second object in the copy of the first file may be a new layer related to the first object. In this case, the first font may be used to set the font of the characters presented in the new layer. The new layer may cover at least a portion of the first object. In this way, the characters presented in the image may have the first font.
[0123] In one example, the first font may include a second font corresponding to character categories such as title Chinese, title Western, body Chinese, body Western, etc. In this case, the characters of the character category corresponding to the second font may be set to the second font. For example, the Chinese characters in the title object in the first file may be set to the second font corresponding to the title Chinese. For example, the Western characters in the title object in the first file may be set to the second font corresponding to the title Western. For example, the Chinese characters in the body object in the first file may be set to the second font corresponding to the body Chinese. For example, the Western characters in the body object in the first file may be set to the second font corresponding to the body Western.
[0124] In some embodiments, the second object may include the content in the second object. Step S120 may include at least one of the following: setting the content in the second object of the same type associated with the first file to the first font; setting the content in the second object of a different type associated with the first file to the first font. In some embodiments, the type of the second object may include a text type and a non-text type. In one example, the content in all second objects of the text type may be uniformly set to the first font. In one example, the content in all second objects of the non-text type may be uniformly set to the first font. In one example, the content in all second objects of the text type and the content in all second objects of the non-text type may be uniformly set to the first font. For example, the first file includes a first type of content A, a second type of content B, and a third type of content C. The user may select one type of content to use the first font D, such as selecting the second type of content B and the third type of content C to use the first font D, wherein all pictures in the file may be classified as content A, all table content may be classified as content B, and all body content may be classified as content C. Here, the content classification may be divided into pictures, tables, titles, body, numbers, etc., without limitation.
[0125] In some embodiments, the first font may include multiple fonts. Step S120 may include: determining an association relationship between a second object and multiple fonts of the first font; and setting the second object associated with the first file to the first font according to the association relationship. The multiple fonts in the first font may be multiple second fonts. For example, the second object may include at least one of the following types: title Chinese, title English, body Chinese, body English. The association relationship between the second object and multiple fonts of the first font includes a correspondence between the type of the second object and the types corresponding to the multiple fonts in the first font. The type of each second object may correspond to After determining the type of each second object, a font corresponding to the type may be determined from the first font and applied to the second object. For example, the first font may include font A and font B. The user can set it with one click in the file, using font A for odd pages and font B for even pages, or setting it with one click for content C of the same type to use font A and content D of the same type to use font B. The user can also specify that user E of the collaborative file uses font A and user F uses font B in the file. Then, when user E edits the first file, the font of the content entered is font A, and when user F edits the first file, the font of the content entered is font B. For example, the first file includes first category content A, second category content B, and third category content C. The user can select one type of content to use the first font. The first font includes font Z and font X. For example, when second category content B and third category content C are selected to use the first font, the second category content B can be set to use font Z and the third category content C to use font Y with one click. Among them, all pictures in the file can be classified as content A, all table contents can be classified as content B, and all text contents can be classified as content C. Here, content classification can be divided into pictures, tables, titles, text, numbers, etc., without limitation.
[0126] In some embodiments, for the second object of text type, the font of the character can correspond to the Font object of the VBA macro. In some embodiments, the font of the character can be set by "Font".
[0127] Through the above steps S110 and S120, the embodiment of the present application implements content processing for the first file, thereby determining the first font used by the first file and using the first font to set the font of the first file and / or the copy of the first file.
[0128] Through the embodiments of the present application, it is possible to count the characters in a file such as a presentation and a possible master, and determine the font suitable for the entire file based on the statistical results. In this way, one or more fonts can be selected from a variety of possible fonts, and the selected fonts can be applied to the file or a copy of the file. In this way, it is possible to quickly unify the characters in the entire file and improve the readability of the presentation.
[0129] Based on the same inventive concept, an embodiment of the present application provides a file content processing device. In one example, the first tool can be located on the file content processing device. In one example, the first tool can be implemented by the file content processing device. For example, the first tool can run on the file content processing device. In one example, the file content processing device can be the first tool.
[0130] Figure 3 Schematic diagram of the structure of a word processing device provided according to an embodiment of the present application. Figure 3 As shown, the word processing device 300 includes a first processing module 301 and a second processing module 302. The first processing module 301 is configured to: in response to a font processing operation on a first object in a first file, display a first font obtained based on a first content in the first object. The second processing module 302 is configured to: in response to a font setting operation of applying a first font to the first file, set a second object related to the first file to the first font.
[0131] Figure 4 FIG. 1 is a schematic diagram of the structure of the first processing module in the file content processing device provided according to an embodiment of the present application. Figure 4 As shown, in some possible implementations, the first processing module 301 may include an object determination module 3011, a content acquisition module 3012, a font statistics module 3013, and a font determination module 3014. The object determination module 3011 is configured to determine the first object based on the first file. The content acquisition module 3012 is configured to obtain the first content from the first object. The font statistics module 3013 is configured to perform font statistics on the first content to obtain statistical results. The statistical results include at least one font in the first content and the attributes corresponding to each font in the at least one font. The font determination module 3014 is configured to determine the first font from the at least one font according to the statistical results.
[0132] In some possible implementations, the object determination module 3011 may be configured to: obtain a first master according to a first file, wherein the first file is generated based on the first master; and determine a first object based on the first file and the first master.
[0133] In some possible implementations, the font statistics module 3013 may be configured to: obtain at least one character from the first content; determine the character category of the at least one character; and perform font statistics on the at least one character according to the character category to obtain statistical results corresponding to each character category.
[0134] In some possible implementations, the font statistics module 3013 may be configured to: determine the location type of each first content; determine the language type of each character in each first content; and determine the character category of each character according to the location type and the language type.
[0135] In some possible implementations, the second object may include an object in a copy of the first file; wherein the second processing module 302 may be configured to: set the second object to a first font, wherein the content in the first file is consistent with the content in the copy and has the same or different font attributes.
[0136] In some possible implementations, the second object may include content in the second object; wherein the second processing module 302 may be configured to perform at least one of the following: setting the content in the second object of the same type associated with the first file to the first font; setting the content in the second object of a different type associated with the first file to the first font.
[0137] In some possible implementations, the first font may include multiple fonts; wherein the second processing module 302 may be configured to: determine an association relationship between the second object and multiple fonts of the first font; and set the second object associated with the first file to the first font according to the association relationship.
[0138] In some possible implementations, the first processing module 301 may further include a display module 3015. The display module 3015 may be used to display the first font.
[0139] It should be noted that the specific implementation of the first processing module 301 and the second processing module 302 in the above-mentioned text processing device 300 can be referred to Figure 1 and Figure 2 For the sake of brevity, the detailed description of the relevant embodiments will not be repeated here.
[0140] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which may be a computer or a terminal in one or more of the above embodiments. Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device in an embodiment of the present application. Figure 5 As shown, the electronic device 500 adopts general computer hardware and includes a processor 501 , a memory 502 , a bus 503 , an input device 504 , and an output device 505 .
[0141] In some possible implementations, the memory 502 may include computer storage media in the form of volatile and / or non-volatile memory, such as read-only memory and / or random access memory. The memory 502 may store an operating system, application programs, other program modules, executable code, program data, user data, etc.
[0142] Input device 504 can be used to input commands and information to the electronic device, such as a keyboard or a pointing device, such as a mouse, trackball, touchpad, microphone, joystick, game pad, satellite TV antenna, scanner or similar device. Input device 504 can be connected to processor 501 via bus 503.
[0143] The output device 505 can be used to output information to the electronic device 500 . In addition to the monitor, the output device 505 can also be other peripheral output devices, such as a speaker and / or a printing device. The output device 505 can also be connected to the processor 501 through the bus 503 .
[0144] The electronic device 500 may be connected to a network, such as a local area network (LAN), via an antenna 506. In a networked environment, executable instructions may be stored in a remote storage device, rather than being limited to local storage.
[0145] When the processor 501 in the electronic device 500 executes the executable code or application stored in the memory 502, the electronic device 500 can implement the text processing method in the above embodiment. The specific execution process refers to the above embodiment and will not be repeated here.
[0146] The memory 502 may store information for implementing Figure 3 Executable instructions for the functions of the first processing module 301 and the second processing module 302. Figure 3 The functions / implementation processes of the first processing module 301 and the second processing module 302 can be realized by Figure 5 The processor 501 in the embodiment calls the executable instructions stored in the memory 502 to implement the above-mentioned implementation process and functions.
[0147] Based on the same inventive concept, the embodiment of the present disclosure further provides a storage medium. The storage medium stores instructions. When the instructions are executed on a computer, the instructions are used to execute the word processing method in one or more of the above embodiments.
[0148] Based on the same inventive concept, the embodiments of the present disclosure further provide a computer program or a computer program product. When the computer program product is executed on a computer, the computer implements the word processing method in one or more of the above embodiments.
[0149] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0150] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for processing file content, characterized in that: The method comprises: In response to a font processing operation on a first object in a first file, displaying a first font obtained based on first content in the first object; In response to a font setting operation of applying the first font to the first file, a second object related to the first file is set to the first font.
2. The method according to claim 1, characterized in that The displaying a first font obtained based on the first content in the first object includes: Based on the first file, determining the first object; obtaining the first content from the first object; Performing font statistics on the first content to obtain a statistical result, wherein the statistical result includes at least one font in the first content and attributes of each font in the at least one font; The first font is determined from the at least one font according to the statistical result.
3. The method according to claim 2, characterized in that The determining the first object based on the first file includes: According to the first file, a first master is acquired, wherein the first file is generated based on the first master; Based on the first file and the first master, the first object is determined.
4. The method according to claim 2 or 3, characterized in that: The performing font statistics on the first content to obtain a statistical result includes: Acquire at least one character from the first content; determining a character category of the at least one character; According to the character category, font statistics are performed on the at least one character to obtain statistical results corresponding to each character category.
5. The method according to claim 4, characterized in that The determining the character category of the at least one character comprises: determining a location type for each first content; determining a language type of each character in each of the first contents; The character category of each character is determined according to the position type and the language type.
6. The method according to claim 1, characterized in that The second object comprises an object in a copy of the first file; The step of setting the second object related to the first file to the first font includes: The second object is set to the first font, wherein the content of the first file and the content of the copy are consistent and have the same or different font attributes.
7. The method according to claim 1, characterized in that The second object includes the content in the second object; The step of setting the second object related to the first file to the first font includes at least one of the following: Setting the content in a second object of the same type associated with the first file to the first font; The content in a second object of a different type associated with the first file is set as the first font.
8. The method according to claim 1, characterized in that: The first font includes a plurality of fonts; The step of setting the second object related to the first file to the first font includes: determining an association relationship between the second object and a plurality of fonts of the first font; According to the association relationship, the second object associated with the first file is set as the first font.
9. A file content processing device, characterized in that: The device comprises: A first processing module, configured to, in response to a font processing operation on a first object in a first file, display a first font obtained based on a first content in the first object; The second processing module is configured to set a second object related to the first file to the first font in response to a font setting operation of applying the first font to the first file.
10. An electronic device, characterized in that: The electronic device comprises: processor; A memory for storing executable instructions; Wherein, the processor is configured to: implement the method according to any one of claims 1 to 8 when running the executable instructions.
11. A storage medium, characterized in that: The storage medium stores an executable program, wherein when the executable program is executed by a processor, the method according to any one of claims 1 to 8 can be implemented.
12. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
