PPT analysis method and device, electronic equipment and storage medium
By adopting the parsing method and format conversion method corresponding to the target file format in the web page PPT parsing tool, the problem of insufficient PPT parsing capability in the existing technology is solved, and more accurate and complete PPT parsing results are achieved.
Patent Information
- Application Number
- CN202411524876.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-07
AI Technical Summary
When existing web-side PPT parsing tools analyze PPT files with complex structures, they lack parsing capabilities, which may lead to inaccurate parsing results or loss of important content, affecting the final display effect.
A PPT analysis method is proposed. By obtaining the PPT file in the target file format, analyzing it using the PPT file analysis method corresponding to the target file format, obtaining the initial element and its characteristic information, converting the format according to the type identifier, and generating a web page The terminal server supports display of PPT files.
It improves the accuracy of PPT analysis, ensures the accuracy and completeness of the analysis results, and solves the problem of insufficient analysis capabilities in the existing technology.
Smart Images

Figure CN119397118A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of PPT analysis, and in particular to a PPT analysis method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of Web technology, more and more people are looking for or developing web-based PPT solutions. However, the existing web-based PPT parsing tools have insufficient parsing capabilities when parsing complex PPT files, which may lead to inaccurate parsing results or loss of important content, affecting the final presentation effect. Therefore, improving the accuracy of PPT parsing has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose a PPT parsing method, device, electronic device and storage medium, aiming to improve the accuracy of PPT parsing.
[0004] To achieve the above purpose, a first aspect of an embodiment of the present application proposes a PPT parsing method, the method comprising:
[0005] Get the first PPT file in the target file format;
[0006] Parsing the first PPT file in a PPT file parsing manner corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element;
[0007] According to the type identifier of the initial element, the initial element is formatted to obtain a target element, wherein the target element is an element supported for display by the web page server;
[0008] Generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
[0009] In some embodiments, converting the format of the initial element according to the type identifier of the initial element to obtain the target element includes:
[0010] Get the format conversion method corresponding to each type of identifier;
[0011] The format of the initial element is converted using a format conversion method corresponding to the type identifier of the initial element to obtain a target element.
[0012] In some embodiments, obtaining the format conversion method corresponding to each type of identifier includes:
[0013] Classify each type of identifier into categories, wherein the categories include common element identifiers and special element identifiers;
[0014] Determine a format conversion method corresponding to the common element identifier and a format conversion method corresponding to the special element identifier;
[0015] After acquiring the format conversion mode corresponding to each type identifier, and before converting the format of the initial element using the format conversion mode corresponding to the type identifier of the initial element and obtaining the target element, the method further includes:
[0016] The format conversion mode corresponding to the type identifier category to which the type identifier of the initial element belongs is determined as the format conversion mode corresponding to the type identifier of the initial element.
[0017] In some embodiments, converting the format of the initial element according to the type identifier of the initial element to obtain the target element includes:
[0018] Get the format conversion method corresponding to each element category and the category identifier corresponding to each element category;
[0019] Determining the element category of the initial element according to a comparison result of the type identifier of the initial element and the category identifiers corresponding to the element categories;
[0020] The format of the initial element is converted using a format conversion method corresponding to the element category to obtain a target element.
[0021] In some embodiments, the web server stores a PPT file parsing method in the target file format; and obtaining the first PPT file in the target file format includes:
[0022] Get the input source PPT file;
[0023] Identify the file format of the source PPT file;
[0024] When it is identified that the file format of the source PPT file is not the target file format, the source PPT file is converted into a first PPT file in the target file format.
[0025] In some embodiments, identifying the file format of the source PPT file includes:
[0026] Acquire header information and a file format identifier of the source PPT file; the header information includes a file extension, and the file extension includes field information for characterizing the file format;
[0027] The file format of the source PPT file is determined according to the field information and the file format identifier.
[0028] In some embodiments, the attribute information of the initial element includes character information of the initial element; and the method further includes:
[0029] During the parsing process of the first PPT file, if parsing error information is detected, identifying the degree of interference of the parsing error information on the PPT parsing;
[0030] When the interference degree does not affect the parsing of the first PPT file, the character information of the initial element is determined as default character information;
[0031] When the interference level affects the parsing of the first PPT file, the parsing of the first PPT file is stopped and a prompt message indicating that the parsing of the first PPT file has failed is output.
[0032] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a PPT parsing device, the device comprising:
[0033] An identification module, used for acquiring a first PPT file in a target file format;
[0034] A parsing module, used to parse the first PPT file in a PPT file parsing method corresponding to the target file format, to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element;
[0035] An obtaining module, used for performing format conversion on the initial element according to the type identifier of the initial element to obtain a target element, wherein the target element is an element supported for display by the web page server;
[0036] A generation module is used to generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
[0037] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0038] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0039] The PPT parsing method, device, electronic device and storage medium proposed in the present application obtain a first PPT file in a target file format; parse the first PPT file using a PPT file parsing method corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element; perform format conversion on the initial element according to the type identifier of the initial element to obtain a target element, wherein the target element is an element supported for display by the web page server; generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element. That is, obtain a PPT file in the target file format, parse the PPT file in the target file format using a PPT file parsing method corresponding to the target file format, obtain the type identifier of the initial element in the PPT file, and then organize and format-convert the initial element according to the type identifier of the initial element to generate a PPT file that can be displayed on the web page, thereby solving the problem of insufficient parsing capability of the prior art and ensuring the accuracy of the PPT parsing results. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flow chart of the PPT parsing method provided in the embodiment of the present application;
[0041] Figure 2 yes Figure 1 Flow chart of step S101 in FIG.
[0042] Figure 3 yes Figure 2 Flow chart of step S202 in FIG.
[0043] Figure 4 yes Figure 1 Flow chart of step S103 in FIG.
[0044] Figure 5 yes Figure 1 Flow chart of step S103 in FIG.
[0045] Figure 6 yes Figure 5 Flow chart of step S501 in FIG.
[0046] Figure 7 is another flow chart of the PPT parsing method provided in an embodiment of the present application;
[0047] Figure 8 It is a structural schematic diagram of a PPT parsing device provided in an embodiment of the present application;
[0048] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0052] First, some nouns involved in this application are analyzed:
[0053] PPT parsing refers to the process of analyzing and processing PowerPoint presentation files to extract or convert information in the files.
[0054] PPT parsing technology is widely used in data migration, content management, automated report generation, and the production of education and training materials. For example, an enterprise may need to convert a large number of PPT presentations to PDF format for archiving and distribution, or convert PPT content to web page format for online display. In addition, PPT parsing can also help extract information from existing documents for data analysis or knowledge management.
[0055] Multi-format compatibility refers to the ability of a technology or system to support and process multiple different file formats. This compatibility allows users to seamlessly share, view and edit files between different applications, devices or platforms without having to worry about format incompatibility issues.
[0056] Conversion refers to the process and method of converting files from one format to another. This conversion can be automatic or manual, involving different technologies and tools. The choice of conversion method depends on a variety of factors, including the file type, the complexity of the conversion, the quality and speed required, the user's technical proficiency, and willingness to pay for conversion tools. As technology develops, conversion is becoming easier and more efficient.
[0057] Based on this, the embodiments of the present application provide a PPT parsing method, device, electronic device and storage medium, aiming to improve the accuracy of PPT parsing.
[0058] The PPT parsing method, device, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the PPT parsing method in the embodiments of the present application is described.
[0059] The PPT parsing method provided in the embodiment of the present application relates to the technical field of PPT parsing. The PPT parsing method provided in the embodiment of the present application can be applied to a web page server; the web page server can be configured as an independent physical server, or as a server cluster or distributed system composed of multiple physical servers, or as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the PPT parsing method, etc., but is not limited to the above forms.
[0060] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0061] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0062] Figure 1 is an optional flow chart of the PPT parsing method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S104.
[0063] Step S101, obtaining a first PPT file in a target file format;
[0064] Step S102, parsing the first PPT file using a PPT file parsing method corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element;
[0065] Step S103, performing format conversion on the initial element according to the type identifier of the initial element to obtain a target element, wherein the target element is an element supported for display by the web page server;
[0066] Step S104, generating a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
[0067] In steps S101 to S104 shown in the embodiment of the present application, a first PPT file in a target file format is obtained; the first PPT file is parsed using a PPT file parsing method corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element; according to the type identifier of the initial element, the initial element is format-converted to obtain a target element, wherein the target element is an element supported for display by the web page server; a second PPT file including the target element is generated, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element. That is, a PPT file in a target file format is obtained, and a PPT file parsing method corresponding to the target file format is used to parse the PPT file in the target file format, and the type identifier of the initial element in the PPT file is obtained, and then the initial element is sorted and formatted according to the type identifier of the initial element to generate a PPT file that can be displayed on the web page, thereby solving the problem of insufficient parsing ability of the prior art and ensuring the accuracy of the PPT parsing results. It should be noted that the electronic device can store a PPT file parsing method corresponding to at least one file format. In the case where the electronic device stores multiple PPT file formats, the PPT file parsing methods corresponding to the respective file formats can be used for parsing.
[0068] In step S101 of some embodiments, first, a PPT file needs to be obtained, which is a presentation in a target file format.
[0069] It should be noted that the first PPT file may be a PowerPoint presentation file in a target file format, which may be PPT, PPTX, PPS, POT or other common PPT file formats.
[0070] See also Figure 2 In some embodiments, the web server stores the PPT file parsing method of the target file format, and step S101 may include but is not limited to steps S201 to S203:
[0071] Step S201, obtaining an input source PPT file;
[0072] Step S202, identifying the file format of the source PPT file;
[0073] Step S203: when it is identified that the file format of the source PPT file is not the target file format, convert the source PPT file into a first PPT file of the target file format.
[0074] In step S201 of some embodiments, first, a PPT file needs to be obtained from a user or other source. This file may be created by PowerPoint software or other presentation software.
[0075] In step S202 of some embodiments, the format of the acquired PPT file is checked to determine what type of file format it is.
[0076] In step S203 of some embodiments, if the identified file format is not the target file format, then the source PPT file needs to be converted into a first PPT file in the target file format.
[0077] Steps S201 to S203 shown in the embodiment of the present application are as follows: obtaining an input source PPT file; identifying the file format of the source PPT file; and converting the source PPT file into a first PPT file in the target file format when it is identified that the file format of the source PPT file is not the target file format. That is, by converting the source PPT file into the target file format, users can access and use the converted PPT file on different platforms and devices, thereby improving the accessibility of the file; at the same time, the storage, retrieval and management process of the file can be simplified by unifying the file format. In addition, conversion to the target file format can reduce the technical support required due to format issues and reduce the operating costs of the enterprise. It should be noted that in the embodiment of the present application, because the web server only stores a PPT file parsing method in one file format, in order to implement the parsing of PPT files in other file formats, conversion is required to solve the problem of multi-format compatibility processing.
[0078] It should be noted that the source PPT file can be the original presentation file, which may be uploaded by the user or obtained from other sources. The target file format can be the desired file format after conversion, which is usually designed to meet the needs of a specific system or device. The file format can be the encoding method and structure of the file, which determines how the file is stored, transmitted and displayed. Conversion can be the process of converting one file format to another, which usually involves format conversion tools or algorithms.
[0079] For example, suppose you download a file named "Project Proposal.ppt" from an email attachment. You use a file format identification tool to check the "Project Proposal.ppt" file and find that it is an old version of the .ppt format. Since the .ppt format is not the target file format (such as .pptx or web page format), you use a conversion tool to convert the "Project Proposal.ppt" file to the .pptx format, or further convert it to the web page format for display on the web page.
[0080] For example, the embodiment of the present application will achieve compatibility with different PPT formats, mainly including PPT, PPTX, PPS, POT, ODP and other formats. To this end, the electronic device first needs to establish a file parser, which identifies the PPT version according to the file extension. For the ODP format, the conversion tool of LibreOffice or OpenOffice can be used to convert the ODP file into the PPTX format.
[0081] See also Figure 3 In some embodiments, step S202 may include but is not limited to steps S301 to S302:
[0082] Step S301, obtaining header information and a file format identifier of the source PPT file; the header information includes a file extension, and the file extension includes field information for characterizing the file format;
[0083] Step S302: Determine the file format of the source PPT file according to the field information and the file format identifier.
[0084] In step S301 of some embodiments, first, header information needs to be extracted from the source PPT file. The header information includes the file extension, which provides field information about the file format. In addition to the header information, a file format identifier can also be obtained.
[0085] In step S302 of some embodiments, the exact file format of the source PPT file is comprehensively judged and determined based on the acquired field information and file format identifier.
[0086] It should be noted that the header information can be the metadata at the beginning of the file, which usually contains the basic information of the file, such as the creator, creation time, file format, etc. The file format identifier can be a specific structure or code inside the file that is used to identify the file format. The file extension can be the part after the dot (.) in the file name, which is used to indicate the type or format of the file. The field information can be the specific fields in the file extension that are used to characterize the file format. By analyzing these fields, the file format can be determined more accurately.
[0087] The web server may also determine the file format of the source PPT file through either the header information or the file format identifier of the source PPT file.
[0088] Steps S301 to S302 shown in the embodiment of the present application are performed by obtaining the header information and file format identifier of the source PPT file; the header information includes a file extension, and the file extension includes field information used to characterize the file format; according to the field information and the file format identifier, the file format of the source PPT file is determined. That is, by obtaining the header information and file format identifier of the PPT file, and then determining the file format according to the field information and file format identifier contained in the header information. By comprehensively analyzing multiple information sources (header information, file format identifier, file extension), the accuracy of file format recognition can be improved. Accurately identifying the file format helps ensure that the file can be correctly opened and displayed on different software and devices, and enhances the compatibility of the system. Automated file format recognition can reduce manual intervention, optimize file processing procedures, and improve efficiency.
[0089] In step S102 of some embodiments, the acquired PPT file is parsed using a parsing method corresponding to the PPT file format. The purpose of the parsing is to extract all elements (such as text, pictures, charts, etc.) in the file and feature information of these elements (such as element type, size, color, etc.).
[0090] It should be noted that the initial elements can be various objects that constitute the slide in the first PPT file, such as text boxes, pictures, charts, etc. The type identifier can be a code or mark used to identify the element type. For example, a text box can have a specific type identifier, and a picture also has its own type identifier. The attribute information can be parameters that define the appearance and behavior of the element, such as color, size, position, etc.
[0091] Exemplarily, the embodiments of the present application will achieve compatibility with different PPT formats, mainly including PPT, PPTX, PPS, POT, ODP and other formats. To this end, the electronic device first needs to establish a file parser, which identifies the PPT version according to the file extension. During the parsing process, open source libraries such as Apache POI (Java) or python-pptx (Python) are used to parse PPT, PPTX, PPS and POT files. These libraries support reading and extracting elements such as text, images, tables, shapes and icons.
[0092] For ODP format, the conversion tool of LibreOffice or OpenOffice will be used to convert ODP files into PPTX format for parsing. This multi-level format processing ensures that the files uploaded by users can be effectively recognized and converted while retaining the integrity of the original content to the greatest extent possible.
[0093] In step S103 of some embodiments, the initial element in the first PPT file is converted into an element that can be supported for display by the web page server according to the type identifier of the initial element obtained by parsing.
[0094] It should be noted that the web server can be a server running on the Internet, which can process and display web page content, including web page format files converted from PPT.
[0095] According to the type identifier of the initial element, the format of the initial element is converted, which may be to determine the element category of the initial element according to the type identifier of the initial element, and then convert the format of the initial element using a format conversion method corresponding to the element category of the initial element. Figure 4 In some embodiments, step S103 may include but is not limited to steps S401 to S403:
[0096] Step S401, obtaining a format conversion method corresponding to each element category and a category identifier corresponding to each element category;
[0097] Step S402, determining the element category of the initial element according to the comparison result of the type identifier of the initial element and the category identifiers corresponding to the element categories;
[0098] Step S403: convert the format of the initial element using a format conversion method corresponding to the element category to obtain a target element.
[0099] In step S401 of some embodiments, first, it is necessary to determine the conversion rules or methods of element categories (common elements and special elements, where common elements include text, pictures, etc., and special elements include audio and video, animation effects, etc.). These rules define how to convert category elements into a target format. Each element category has a corresponding identifier to distinguish elements of different categories.
[0100] In step S402 of some embodiments, the type identifier of each element in the first PPT file is compared with a known category identifier, and based on the comparison result, it is determined to which category each initial element belongs.
[0101] In step S403 of some embodiments, a corresponding format conversion method is selected according to the determined element category, and the initial element is converted to generate a target element.
[0102] It should be noted that the format conversion method may be a specific method or rule for converting one element type into another format. The category identifier may be a unique identifier for each element category, used to distinguish different types of elements. The target element may be the converted element, which maintains the original function and appearance in the target format.
[0103] Steps S401 to S403 shown in the embodiment of the present application are as follows: by obtaining the format conversion method corresponding to each element category and the category identifier corresponding to each element category; determining the element category of the initial element according to the comparison result between the type identifier of the initial element and the category identifier corresponding to each element category; and converting the format of the initial element using the format conversion method corresponding to the element category to obtain the target element. That is, the initial element is converted into the target element using a specific conversion method for different element categories. Each type of element is converted using a corresponding format conversion method, which can improve the accuracy of element conversion, thereby retaining the original animation effects and audio and video of the ppt, and restoring the content of the ppt itself to the greatest extent. At the same time, the automated format conversion reduces the need for users to manually adjust elements after conversion. Ensure the compatibility of the converted files on different platforms and devices, and improve compatibility. Users can easily convert PPT files to the desired format without having to deeply understand the conversion details, thereby improving the user experience.
[0104] For example, suppose there is a PPT file containing text, pictures, audio and video, and this file needs to be converted into HTML format so as to be displayed on a web page.
[0105] The format conversion methods corresponding to element categories are defined in advance, and the element categories include common elements and special elements. For common elements, direct conversion rules are defined, and for special elements, more complex conversion rules are defined, such as converting audio and video into embeddable formats. By comparing the type identifiers of text, pictures, audio and video with the type identifiers of common elements and special elements, it is determined that text and pictures are classified as common elements, and audio and video are classified as special elements. Furthermore, for text and pictures, the format conversion method corresponding to common elements is applied, and for audio and video, the format conversion method corresponding to special elements is applied to adapt to the limitations of the HTML format.
[0106] According to the type identifier of the initial element, the format of the initial element is converted, and the format of the initial element can be converted by using a format conversion method corresponding to the element type identifier. Figure 5In some embodiments, step S103 may include but is not limited to steps S501 to S502:
[0107] Step S501, obtaining the format conversion method corresponding to each type of identifier;
[0108] Step S502: convert the format of the initial element using a format conversion method corresponding to the type identifier of the initial element to obtain a target element.
[0109] In step S501 of some embodiments, first, a mapping or database needs to be established, which contains format conversion rules corresponding to each type of identifier. These rules define how to convert a specific type of element into a target format.
[0110] In step S502 of some embodiments, for each initial element in the PPT file, the corresponding format conversion method is searched according to its type identifier, and then these rules are applied to convert the element into the target format.
[0111] Steps S501 to S502 shown in the embodiment of the present application are to obtain the format conversion method corresponding to each type identifier; the format conversion method corresponding to the type identifier of the initial element is used to convert the initial element to obtain the target element. That is, the initial element is converted using the conversion format corresponding to each type identifier of the initial element to obtain the target element. The initial element is converted using the corresponding format conversion method, which can improve the accuracy of element conversion, and then the original animation effects and audio and video of the ppt can be retained, and the content of the ppt itself can be restored to the greatest extent. At the same time, automated format conversion can quickly process a large number of elements, shorten conversion time, and improve conversion efficiency. Predefined conversion rules help to maintain the original layout and style of the elements and improve the quality of the final product. When it is necessary to support new element types, only new type identifiers and corresponding conversion rules need to be added, without modifying the existing conversion logic, thereby enhancing the scalability of the system.
[0112] For example, suppose a PPT file contains text, pictures and charts, and this file needs to be converted to PDF format. First, define the rules for converting text, pictures and charts to PDF, for example, text is converted to text objects in PDF, pictures are converted to image objects in PDF, and charts are converted to drawing objects in PDF. For text elements, find the conversion rules corresponding to their type identifiers, and convert the text into text objects in PDF. For picture elements, find the conversion rules corresponding to their type identifiers, and convert the pictures into image objects in PDF. For chart elements, find the conversion rules corresponding to their type identifiers, and convert the charts into drawing objects in PDF. In this way, all elements in the PPT file can be converted to PDF format, generating a new PDF file containing the converted text, pictures and charts.
[0113] For example, once the content of the PPT file is extracted, the parsing engine will process and convert the data to meet the needs of subsequent content operations, such as formatting and typesetting text content, compressing and optimizing images, and encoding, decoding and transcoding audio and video.
[0114] It should be noted that the electronic device may store at least one PPT file parsing method corresponding to a file format. If there is only one, for other file formats, the above method is used to convert the format first and then parse.
[0115] See also Figure 6 In some embodiments, step S501 may include but is not limited to steps S601 to S602:
[0116] Step S601, classify each type of identifier into categories, wherein the categories include common element identifiers and special element identifiers;
[0117] Step S602, determining a format conversion mode corresponding to the common element identifier and a format conversion mode corresponding to the special element identifier;
[0118] In step S601 of some embodiments, all types of identifiers are divided into two main categories: common element identifiers and special element identifiers. Common element identifiers may include common elements, such as text, shapes, standard charts, etc. Special element identifiers may include complex or customized elements, such as macros, special animation effects, audio and video, etc.
[0119] In step S602 of some embodiments, a standard format conversion method is defined for common element identifiers, and a specific format conversion method is defined for special element identifiers to handle more complex conversion requirements, such as retaining the original animation effects and audio and video of the PPT and restoring the PPT content to the greatest extent.
[0120] After step S501 and before step S502, the method may include but is not limited to step S603:
[0121] Step S603: determine the format conversion mode corresponding to the type identifier category to which the type identifier of the initial element belongs as the format conversion mode corresponding to the type identifier of the initial element.
[0122] In step S603 of some embodiments, for each initial element, it is determined whether it is a common element or a special element according to its type identifier. According to the category to which the type identifier of the initial element belongs, a corresponding format conversion method is selected. This conversion method is applied to convert the initial element into a target element.
[0123] It should be noted that the common element identifier may refer to the type identifier of a common, standard PPT element, such as a text box, a standard graphic, and the like.
[0124] Special element identifiers can be type identifiers of uncommon, complex, or customized PPT elements, such as macros, special animation effects, audio and video, etc.
[0125] Steps S601 to S603 shown in the embodiment of the present application are performed by dividing each type identifier into categories, wherein the categories include common element identifiers and special element identifiers; determining the format conversion method corresponding to the common element identifier and the format conversion method corresponding to the special element identifier; and determining the format conversion method corresponding to the type identifier category to which the type identifier of the initial element belongs as the format conversion method corresponding to the type identifier of the initial element. That is, by dividing the type identifier of the initial element into categories, and then determining the format conversion method corresponding to the type identifier of the initial element according to the format conversion method corresponding to the type identifier category. By distinguishing between common and special elements, more precise conversion rules can be provided for different types of elements, thereby improving the flexibility and accuracy of conversion. Users can expect higher quality conversion results, especially for complex files containing special elements, which helps to improve user experience.
[0126] For example, suppose a PPT file contains standard text, pictures, audio and video, and needs to be converted into HTML format so as to be displayed on a web page.
[0127] Identifiers for text and images are classified as common element identifiers, and identifiers for audio and video are classified as special element identifiers. For common element identifiers (text and images), rules are defined for direct conversion to PDF text and images. For special element identifiers (audio and video), more complex conversion rules are defined, which may involve converting animation effects to static images or simplified animations. The type identifier of each element is checked to determine whether it is a common element identifier or a special element identifier. For text and images, the conversion rules for common element identifiers are applied. For audio and video, the conversion rules for special element identifiers are applied, possibly converting them to an embeddable format to fit the limitations of the HTML format.
[0128] In step S104 of some embodiments, a new PPT file is created, which is in a format supported by the web server. In this new file, the attribute information of the converted element (target element) should match the attribute information of the initial element to ensure that the display effect on the web page is the same as or as close as possible to the first PPT file.
[0129] For example, suppose there is a PPT file with text, pictures and charts. The following is an example of the conversion process:
[0130] Select a file named "Annual Report.pptx" from your computer. Use a specialized parsing tool to read the "Annual Report.pptx" file and extract elements such as text, images, and charts, as well as their size, color, and other attribute information. The text box is converted to HTML.<d iv> Tags, retaining the original fonts and colors. Images are converted to Tags, and ensure that the image size is consistent with the original PPT. The chart is converted to an HTML5 Canvas element to maintain the original visual effect. Create a new PPT file, which may be an HTML file, containing the converted text, images, and charts. This file can be opened in a web browser and will display similarly to the original "Annual Report.pptx" file.
[0131] See also Figure 7 , Figure 7 is another optional flow chart of the PPT parsing method provided in an embodiment of the present application, wherein the attribute information of the initial element includes the character information of the initial element, Figure 7 The method may include but is not limited to steps S701 to S703:
[0132] Step S701, during the parsing process of the first PPT file, if parsing error information is detected, then identifying the degree of interference of the parsing error information on the PPT parsing;
[0133] Step S702, when the interference level does not affect the parsing of the first PPT file, the character information of the initial element is determined as default character information;
[0134] Step S703: When the interference level affects the parsing of the first PPT file, the parsing of the first PPT file is stopped and a prompt message indicating that the parsing of the first PPT file has failed is output.
[0135] In step S701 of some embodiments, during the process of parsing the first PPT file, the system monitors and detects whether any parsing errors occur. When an error is detected, it is necessary to evaluate the impact of the error on the entire file parsing process. The impact assessment may be based on factors such as the type, location, and number of errors.
[0136] In step S702 of some embodiments, if the interference level is evaluated as not affecting parsing, that is, the error is not enough to prevent the main content of the file from being correctly parsed, the character information of the erroneous part will be replaced with default character information.
[0137] In step S703 of some embodiments, if the interference level is assessed to affect parsing, that is, the error is so serious that the file cannot be parsed correctly or causes key information to be lost, the parsing process will be stopped and a prompt message indicating parsing failure will be displayed to the user.
[0138] It should be noted that the parsing error information may be the error information detected when parsing the PPT file, which may be caused by file damage, format incompatibility or code errors. The interference degree may be the degree of influence of the error on the file parsing process, which can be divided into two levels: no influence on parsing and influence on parsing. The default character information may be the preset character information used by the system to replace the information of the erroneous part when an error is encountered during the parsing process and the error does not affect the overall parsing. The character information may be the font, font size and color number. The character information is included in the attribute information, and the attribute information also includes the position information.
[0139] In the steps S701 to S703 shown in the embodiment of the present application, if parsing error information is detected during the parsing process of the first PPT file, the interference degree of the parsing error information on the PPT parsing is identified; when the interference degree does not affect the parsing of the first PPT file, the character information of the initial element is determined as the default character information; when the interference degree affects the parsing of the first PPT file, the parsing of the first PPT file is stopped and a prompt message indicating that the parsing of the first PPT file failed is output. That is, by analyzing the interference degree of the detected error information on the PPT parsing, a corresponding processing mechanism is performed to enhance the error recovery capability. At the same time, by distinguishing the degree of influence of the error, more files can be successfully parsed even if they contain some errors, thereby improving the parsing success rate. When the parsing fails, the user can get feedback in time, understand the problem, and take corresponding remedial measures, which can improve the user feedback mechanism.
[0140] See also Figure 8 The embodiment of the present application also provides a PPT parsing device, which can implement the above-mentioned PPT parsing method, and the device includes:
[0141] Identification module 801, used to obtain a first PPT file in a target file format;
[0142] A parsing module 802 is used to parse the first PPT file using a PPT file parsing method corresponding to the target file format to obtain an initial element in the first PPT file and feature information of the initial element, wherein the feature information of the initial element includes a type identifier of the initial element and attribute information of the initial element;
[0143] An obtaining module 803 is used to perform format conversion on the initial element according to the type identifier of the initial element to obtain a target element, where the target element is an element supported for display by the web page server;
[0144] The generation module 804 is used to generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
[0145] The specific implementation of the PPT analysis device is basically the same as the specific implementation of the above-mentioned PPT analysis method, and will not be repeated here.
[0146] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above PPT parsing method when executing the computer program. The electronic device can be any smart terminal including a tablet computer, a car computer, etc.
[0147] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0148] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0149] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the PPT parsing method of the embodiment of this application;
[0150] Input / output interface 903, used to implement information input and output;
[0151] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0152] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0153] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0154] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned PPT parsing method is implemented.
[0155] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0156] The PPT parsing method, PPT parsing device, electronic device and storage medium provided in the embodiments of the present application obtain a first PPT file in a target file format; parse the first PPT file using a PPT file parsing method corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element; perform format conversion on the initial element according to the type identifier of the initial element to obtain a target element, wherein the target element is an element supported for display by the web page server; generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element. That is, obtain a PPT file in the target file format, parse the PPT file in the target file format using a PPT file parsing method corresponding to the target file format, obtain the type identifier of the initial element in the PPT file, and then organize and format-convert the initial element according to the type identifier of the initial element to generate a PPT file that can be displayed on the web page, thereby solving the problem of insufficient parsing capability of the prior art and ensuring the accuracy of the PPT parsing results.
[0157] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0158] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0159] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0161] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0162] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0163] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0164] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0166] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0167] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A PPT analysis method, characterized in that: Applied to a web page server, the method includes: Get the first PPT file in the target file format; Parsing the first PPT file in a PPT file parsing manner corresponding to the target file format to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element; According to the type identifier of the initial element, the initial element is formatted to obtain a target element, wherein the target element is an element supported for display by the web page server; Generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
2. The method according to claim 1, characterized in that The step of converting the format of the initial element according to the type identifier of the initial element to obtain the target element includes: Get the format conversion method corresponding to each type of identifier; The format of the initial element is converted using a format conversion method corresponding to the type identifier of the initial element to obtain a target element.
3. The method according to claim 2, characterized in that The method of obtaining the format conversion corresponding to each type of identifier includes: Classify each type of identifier into categories, wherein the categories include common element identifiers and special element identifiers; Determine a format conversion method corresponding to the common element identifier and a format conversion method corresponding to the special element identifier; After acquiring the format conversion mode corresponding to each type identifier, and before converting the format of the initial element using the format conversion mode corresponding to the type identifier of the initial element and obtaining the target element, the method further includes: The format conversion mode corresponding to the type identifier category to which the type identifier of the initial element belongs is determined as the format conversion mode corresponding to the type identifier of the initial element.
4. The method according to claim 1, characterized in that: The step of converting the format of the initial element according to the type identifier of the initial element to obtain the target element includes: Get the format conversion method corresponding to each element category and the category identifier corresponding to each element category; Determining the element category of the initial element according to a comparison result of the type identifier of the initial element and the category identifiers corresponding to the element categories; The format of the initial element is converted using a format conversion method corresponding to the element category to obtain a target element.
5. The method according to claim 1, characterized in that The web page server stores a PPT file parsing method in the target file format; The step of obtaining a first PPT file in a target file format includes: Get the input source PPT file; Identify the file format of the source PPT file; When it is identified that the file format of the source PPT file is not the target file format, the source PPT file is converted into a first PPT file in the target file format.
6. The method according to claim 5, characterized in that The identifying the file format of the source PPT file includes: Acquire header information and a file format identifier of the source PPT file; the header information includes a file extension, and the file extension includes field information for characterizing the file format; The file format of the source PPT file is determined according to the field information and the file format identifier.
7. The method according to claim 1, characterized in that The attribute information of the initial element includes character information of the initial element; and the method further includes: During the parsing process of the first PPT file, if parsing error information is detected, identifying the degree of interference of the parsing error information on the PPT parsing; When the interference degree does not affect the parsing of the first PPT file, the character information of the initial element is determined as default character information; When the interference level affects the parsing of the first PPT file, the parsing of the first PPT file is stopped and a prompt message indicating that the parsing of the first PPT file has failed is output.
8. A PPT analysis device, characterized in that: The device comprises: An identification module, used for acquiring a first PPT file in a target file format; A parsing module, used to parse the first PPT file in a PPT file parsing method corresponding to the target file format, to obtain an initial element in the first PPT file and characteristic information of the initial element, wherein the characteristic information of the initial element includes a type identifier of the initial element and attribute information of the initial element; an obtaining module, configured to perform format conversion on the initial element according to the type identifier of the initial element to obtain a target element, wherein the target element is an element supported for display by the web page server; A generation module is used to generate a second PPT file including the target element, wherein the second PPT file is a PPT file supported for display by the web page server, and in the second PPT file, the attribute information of the target element matches the attribute information of the initial element.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the PPT parsing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the PPT analysis method according to any one of claims 1 to 7 is implemented.