Ppt file processing method and system

CN119002908APending Publication Date: 2024-11-22SICHUAN BORN TO LEARN EDUCATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410971703.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

[0002]当前,ppt文件必须是在电脑端,下载了微软的ofice或者wps软件才能显示ppt文件,但是如果是要在网页端实现云端浏览ppt文件,就无法实现

Benefits of technology

[0025]通过ppt文件处理方法及系统,能够通过网页端对ppt文件进行读取与处理解析得到JSON数据,JSON数据可供网页端显示与存储;无需在终端设备上通过ofice或者wps软件才能查看ppt文件,通过网页端实现在线浏览ppt文件,解析速度快,不需要安装软件,直接网页端浏览。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119002908A_ABST
    Figure CN119002908A_ABST
Patent Text Reader

Abstract

The invention relates to a ppt file processing method and system. The method comprises the following steps: S1, reading a to-be-processed ppt file and generating to-be-processed data from the to-be-processed ppt file; s2, analyzing the data to be processed into a JavaScript instance object to be processed; s3, traversing the xml files under the JavaScript instance objects to be processed one by one, and analyzing the xml files into JavaScript objects in a JSON format; s4, performing integration operation on the JavaScript object in the JSON format according to a ppt structure to obtain ppt element information; and S5, merging the ppt element objects into a JavaScript object in a JSON format according to a sequence, so as to obtain JSON data. Through the ppt file processing method and system, the ppt file can be read, processed and analyzed through a webpage end to obtain JSON data, and the JSON data can be displayed and stored by the webpage end; according to the method, the ppt file can be viewed on terminal equipment without the need of service or wps software, online browsing of the ppt file is achieved through the webpage end, the analysis speed is high, software does not need to be installed, and direct browsing at the webpage end is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of ppt file processing, in particular to a ppt file processing method and system. Background Art

[0002] Currently, ppt files must be on the computer and have Microsoft's ofice or wps software downloaded to display ppt files. However, if you want to browse ppt files in the cloud on the web, it is not possible. Summary of the invention

[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a ppt file processing method and system, which can realize online browsing of ppt files through a web page.

[0004] The objective of the present invention is achieved through the following technical solutions:

[0005] The ppt file processing method comprises the following steps:

[0006] S1: read the ppt file to be processed and generate the data to be processed from the ppt file to be processed;

[0007] S2: Parse the data to be processed into JavaScript instance objects to be processed;

[0008] S3: traverses the XML files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format;

[0009] S4: integrating the JavaScript objects in the JSON format according to the ppt structure to obtain ppt element information;

[0010] S5: Merge the ppt element objects into a JavaScript object in JSON format in order to obtain JSON data.

[0011] Furthermore, in step S1, the ppt file to be processed is read through JavaScript native FileReader API.

[0012] Furthermore, the parsing of the XML file in step S3 includes lexical parsing and grammatical parsing.

[0013] Furthermore, the parsing operation on the XML file in step S3 includes removing the XML header, removing the content before the node, replacing the XML tags and values ​​with {}, and replacing the XML self-closing node with {}.

[0014] Further, the parsing operation of removing the XML header is completed using the <\?xml[^>]*\?> regular expression;

[0015] The parsing operation of removing the content before the node is completed using >\s+<; the spaces and line breaks before the node are removed;

[0016] The parsing operation of replacing XML tags and values ​​with {} uses the <([^>]+)>([^<]+)<\ / [^>]+> regular expression to match the pattern of XML tags and values, and then replaces them with {};

[0017] The parsing operation of replacing the XML self-closing node with {} uses the <([^>]+)\s*\ / > regular expression to match the XML self-closing node and then replaces it with {}.

[0018] Further, the integration operation includes classification, sorting, and insertion;

[0019] The ppt element information includes the theme of the ppt and the content information of a single ppt.

[0020] Furthermore, before step S5, a cloud address replacement operation is performed on the media file in the JavaScript object in JSON format.

[0021] Furthermore, the cloud address replacement operation is to upload the media file to the cloud space to obtain the material address of the media file in the cloud space, and replace the media file in the JavaScript object in JSON format with the material address.

[0022] Furthermore, the cloud space includes but is not limited to Alibaba Cloud.

[0023] The ppt file processing system comprises a reading unit, a parsing unit, an integration unit and a merging unit; the reading unit reads a ppt file to be processed and generates data to be processed from the ppt file to be processed; the parsing unit parses the data to be processed into a JavaScript instance object to be processed and traverses the XML files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format; the integration unit integrates the JavaScript objects in JSON format according to the ppt structure to obtain ppt element information; the merging unit merges the ppt element objects into the JavaScript objects in JSON format in sequence to obtain JSON data.

[0024] The beneficial effects of the present invention are:

[0025] Through the ppt file processing method and system, the ppt file can be read, processed and parsed through the web page to obtain JSON data, and the JSON data can be displayed and stored on the web page; there is no need to use ofice or wps software on the terminal device to view the ppt file, and the ppt file can be browsed online through the web page, with fast parsing speed, no need to install software, and can be browsed directly on the web page. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0027] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0028] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0029] Embodiment 1:

[0030] like Figure 1 As shown, the ppt file processing method includes the following steps:

[0031] S1: read the ppt file to be processed and generate the data to be processed from the ppt file to be processed;

[0032] In the step S1, the ppt file to be processed is read through the JavaScript native FileReader API.

[0033] FileReader API is the JavaScript native FileReader API.

[0034] The data to be processed adopts ArrayBuffer format, and the data to be processed is stored in the buffer of the current JavaScript environment.

[0035] The ppt files to be processed include files with the suffix .pptx.

[0036] S2: Parse the data to be processed into JavaScript instance objects to be processed;

[0037] The JavaScript instance object to be processed includes a ppt structure directory of the ppt file to be processed.

[0038] That is: parse the data to be processed in the ArrayBuffer format of the buffer and generate a JavaScript instance object containing a ppt structure directory.

[0039] The structure of a JavaScript instance object is similar to a zip archive containing several XML files. You can read the contents of an XML file by entering the name of the XML file.

[0040] S3: traverses the XML files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format;

[0041] According to the JavaScript instance object to be processed in the zip package form, traverse the XML files one by one and parse them:

[0042] The XML format is Extensible Markup Language, which is a tree-structured descriptive file with the following syntax:

[0043] <? xml version="1.0" encoding="ISO-8859-1"? >

[0044] <note>

[0045] <to> Tove< / to>

[0046] <from> Jani< / from>

[0047] <heading> Reminder< / heading>

[0048] Don't forget me this weekend!

[0049] < / note>

[0050] The JavaScript object in JSON format obtained after parsing the xml file in the above format is as follows:

[0051]

[0052]

[0053] The analysis of the XML file in step S3 includes lexical analysis and grammatical analysis.

[0054] The parsing operation of the XML file in step S3 includes removing the XML header, removing the content before the node, replacing the XML tags and values ​​with {}, and replacing the XML self-closing node with {}.

[0055] Specifically, recursively downward from the root node, mainly using regular expressions to remove special symbols, spaces, and line breaks, and replacing <> with curly braces such as {}.

[0056] The parsing operation of removing the XML header is completed using the <\?xml[^>]*\?> regular expression;

[0057] The parsing operation of removing the content before the node is completed using >\s+<; the spaces and line breaks before the node are removed;

[0058] The parsing operation of replacing XML tags and values ​​with {} uses the <([^>]+)>([^<]+)<\ / [^>]+> regular expression to match the pattern of XML tags and values, and then replaces them with {}.

[0059] The parsing operation of replacing the XML self-closing node with {} uses the <([^>]+)\s*\ / > regular expression to match the XML self-closing node and then replaces it with {}.

[0060] After the above process, some JSON format content is obtained.

[0061] S4: integrating the JavaScript objects in the JSON format according to the ppt structure to obtain ppt element information;

[0062] There are multiple JavaScript objects in JSON format obtained in step S3, each corresponding to an XML file.

[0063] The integration operation includes classification, sorting, and insertion.

[0064] The ppt structure is based on Microsoft's official documentation http: / / officeopenxml.com , the structure described by the interpreted keys and values ​​is integrated with the ppt structure and specific values, and finally combined into the element information required for each ppt page (i.e., ppt element information).

[0065] The ppt element information includes the theme of the ppt and the content information of a single ppt (such as size, location, media type, etc.).

[0066] S5: Merge the ppt element objects into a JavaScript object in JSON format in order to obtain JSON data.

[0067] The parsing operation is repeatedly performed, and the obtained single ppt element object is stored in an array object (ie, a JavaScript object in JSON format) according to the parsed paging order, and finally a JSON data containing ppt element information is obtained.

[0068] JSON data can be imported into front-end pages, displayed, and stored.

[0069] Before step S5, a cloud address replacement operation is performed on the media file in the JavaScript object in JSON format.

[0070] The cloud address replacement operation is to upload the media file to the cloud space to obtain the material address of the media file in the cloud space, and replace the media file in the JavaScript object in JSON format with the material address.

[0071] The cloud space includes but is not limited to Alibaba Cloud.

[0072] That is, for media files (video, audio, pictures, etc.), the processing method is to upload the binary file of the media file to Alibaba Cloud after the elements are parsed, obtain the material address of Alibaba Cloud, and replace the original file with the material address.

[0073] The ppt file processing system comprises a reading unit, a parsing unit, an integration unit and a merging unit; the reading unit reads a ppt file to be processed and generates data to be processed from the ppt file to be processed; the parsing unit parses the data to be processed into a JavaScript instance object to be processed and traverses the XML files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format; the integration unit integrates the JavaScript objects in JSON format according to the ppt structure to obtain ppt element information; the merging unit merges the ppt element objects into the JavaScript objects in JSON format in sequence to obtain JSON data.

[0074] Through the ppt file processing method and system, the ppt file can be read, processed and parsed through the web page to obtain JSON data, and the JSON data can be displayed and stored on the web page; there is no need to use ofice or wps software on the terminal device to view the ppt file, and the ppt file can be browsed online through the web page, with fast parsing speed, no need to install software, and can be browsed directly on the web page.

[0075] The above-mentioned embodiments only express the specific implementation of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. ppt file processing method, Features: The following steps are involved: S1: read the ppt file to be processed and generate the data to be processed from the ppt file to be processed; S2: Parse the data to be processed into JavaScript instance objects to be processed; S3: traverses the XML files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format; S4: integrating the JavaScript objects in the JSON format according to the ppt structure to obtain ppt element information; S5: Merge the ppt element objects into a JavaScript object in JSON format in order to obtain JSON data.

2. The ppt file processing method according to claim 1, Features: In the step S1, the ppt file to be processed is read through the JavaScript native FileReader API.

3. The ppt file processing method according to claim 1, Features: The analysis of the XML file in step S3 includes lexical analysis and grammatical analysis.

4. The ppt file processing method according to claim 1, Features: The parsing operation of the XML file in step S3 includes removing the XML header, removing the content before the node, replacing the XML tags and values ​​with {}, and replacing the XML self-closing node with {}.

5. The ppt file processing method according to claim 4, Features: The parsing operation of removing the XML header is completed using the <\?xml[^>]*\?> regular expression; The parsing operation of removing the content before the node is completed using >\s+<; the spaces and line breaks before the node are removed; The parsing operation of replacing XML tags and values ​​with {} uses the <([^>]+)>([^<]+)<\ / [^>]+> regular expression to match the pattern of XML tags and values, and then replaces them with {}; The parsing operation of replacing the XML self-closing node with {} uses the <([^>]+)\s*\ / > regular expression to match the XML self-closing node and then replaces it with {}.

6. The ppt file processing method according to claim 1, Features: The integration operations include classification, sorting, and insertion; The ppt element information includes the theme of the ppt and the content information of a single ppt.

7. The ppt file processing method according to claim 1, Features: Before step S5, a cloud address replacement operation is performed on the media file in the JavaScript object in JSON format.

8. The ppt file processing method according to claim 7, Features: The cloud address replacement operation is to upload the media file to the cloud space to obtain the material address of the media file in the cloud space, and replace the media file in the JavaScript object in JSON format with the material address.

9. The ppt file processing method according to claim 8, Features: The cloud space includes but is not limited to Alibaba Cloud.

10. A ppt file processing system, used to implement the ppt file processing method described in any one of claims 1 to 9, Features: It includes a reading unit, a parsing unit, an integration unit and a merging unit; the reading unit reads the ppt file to be processed and generates the data to be processed from the ppt file to be processed; the parsing unit parses the data to be processed into the JavaScript instance object to be processed and traverses the xml files under the JavaScript instance object to be processed one by one and parses them into JavaScript objects in JSON format; the integration unit integrates the JavaScript objects in JSON format according to the ppt structure to obtain ppt element information; the merging unit merges the ppt element objects into the JavaScript objects in JSON format in sequence to obtain JSON data.