WebPPT file export method, equipment and product
By constructing an abstract syntax tree for WebPPT files and using the Wasm module to standardize and compress elements, the compatibility issue when exporting WebPPT files to devices with different formats is resolved, achieving efficient format conversion and consistent display effects.
Patent Information
- Application Number
- CN202510874625.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-06-27
AI Technical Summary
In the existing technology, there are compatibility issues when exporting WebPPT files to client devices of different formats, which causes the file to be unable to open normally or part of the content cannot be displayed. Especially when the file contains a large number of images, animations and videos, the conversion efficiency is low.
By building the abstract syntax tree of the WebPPT file, loading the vectorization and compression submodules in the Wasm module, standardizing or compressing different element types, generating nodes with smaller data volumes and conforming to the standard format, and finally exporting them to files compatible with the specified format.
Improves the compatibility and conversion efficiency of WebPPT files exported to devices of different formats, especially significantly reducing computing power requirements when containing complex elements, ensuring consistent display and efficient conversion of files on different platforms.
Smart Images

Figure CN120430296B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a WebPPT file exporting method, device, and product. Background Art
[0002] With the development of computer technology, online file editing is becoming more and more popular. For example, PPT files can be edited in a web browser.
[0003] In the prior art, users can use a web browser to edit PPT files online. After the online editing is completed, it can be exported to the corresponding client device according to the actual needs of the user. It is easy to understand that the current client devices support a variety of PPT file formats. Direct export often leads to incompatibility issues, resulting in the PPT file being unable to open normally, or even if it can be opened, some content in the PPT file cannot be displayed or used normally. In order to make WebPPT compatible with various formats after export, the WebPPT file needs to be converted during export. When the file is relatively large, offline conversion is required, and the conversion efficiency is low. Summary of the Invention
[0004] The present disclosure provides a WebPPT file export method, device, and product.
[0005] According to the first aspect of the present disclosure, a WebPPT file export method is provided. The method specifically includes: obtaining a first file in the WebPPT format, parsing the first file and constructing a first abstract syntax tree; wherein the first abstract syntax tree contains a plurality of first nodes of different element types; after loading a Wasm module in a Web editor, calling a vectorization submodule and / or a compression submodule in the Wasm module according to the element type of the first node in the first abstract syntax tree; passing the first element in the first node to the vectorization submodule for standardization processing, and / or passing the second element in the first node to the compression submodule for compression processing, thereby obtaining a second node with less redundant data than the first node and having a standardized format; replacing the first node in the first abstract syntax tree with a second node to obtain a second abstract syntax tree after the node is replaced; and exporting a second file compatible with a specified format based on the second abstract syntax tree.
[0006] Based on the above, after obtaining a first file in WebPPT format, a first abstract syntax tree can be obtained by parsing the first file. This first abstract syntax tree contains many first nodes, and the element types contained in these first nodes are not identical. For example, each first node represents the entire content of a PPT page. Some first nodes contain only text elements, some contain only image elements, and some contain a variety of elements, such as text and image elements. A Wasm module is loaded into the Web editor. This Wasm module contains submodules compiled based on various algorithms, so that corresponding functional submodules are called according to different element types to perform corresponding standardization or compression processing on the first element, second element, and element attributes. This results in a second node with less redundant data than the first node and in a standardized format. The second node obtained after processing replaces the first node in the first abstract syntax tree, resulting in an updated second abstract syntax tree. When performing a subsequent compatibility export, the export is based on the second abstract syntax tree. Because the second node in the second abstract syntax tree contains less data than the first node, the compatibility conversion requires less computing power and is more efficient. This is especially true when the first file to be converted contains a large number of elements such as animations, images, and videos, which are difficult to convert. Using this solution to export the second file is more efficient.
[0007] According to at least one embodiment of the present disclosure, the Wasm module further includes a matrixing submodule, which transmits the first element attribute of the first element and / or the second element to the matrixing submodule to calculate and obtain a standardized second element attribute.
[0008] According to at least one embodiment of the present disclosure, before calculating the standardized second element attribute, it also includes: when the first element attribute is the style and layout of an image element, or the style and layout of text, checking whether multiple first nodes have the same first element attribute; if multiple first nodes have the same first element attribute, merging the first element attributes in the multiple first nodes into a shared first element attribute.
[0009] According to at least one embodiment of the present disclosure, the second element includes: at least one of an image, a video, and an animation. The second element in the first node is passed to a compression submodule for compression processing, including: passing the image to a compression submodule in Wasm format compiled based on an image compression algorithm, and calling the single instruction multiple data stream in the Wasm module to compress the image to obtain a compressed image; passing the animation to a compression submodule in Wasm format compiled based on a merged frame algorithm and / or a key frame difference algorithm to compress the animation to obtain a compressed animation; passing the video to a compression submodule in Wasm format compiled based on an inter-frame compression algorithm and / or an intra-frame compression algorithm to compress the video to obtain a compressed video.
[0010] According to at least one embodiment of the present disclosure, the first element includes: at least one of an image element and a table in a PPT file material; the first element in the first node is passed to a vectorization sub-module for standardized processing, including: passing the image element to a vectorization sub-module in a Wasm format compiled based on a redundant path optimization algorithm, and vectorizing the image element into an intermediate representation image element with a standard format; passing the table to a vectorization sub-module in a Wasm format compiled based on a vectorization decomposition algorithm, and vectorizing the table into an intermediate representation table with a standard format.
[0011] According to at least one embodiment of the present disclosure, exporting a second file compatible with a specified format based on a second abstract syntax tree includes: determining the specified format; judging whether the compressed element, the intermediate representation element, and the second element attribute in the second node in the second abstract syntax tree are compatible with the specified format; if not, performing format conversion on at least one of the compressed element, the intermediate representation element, and the second element attribute according to the format requirements of the specified format; and exporting the second file using the second abstract syntax tree after the format conversion.
[0012] According to at least one embodiment of the present disclosure, after exporting the second file compatible with the specified format based on the second abstract syntax tree, it also includes: making corresponding adjustments to the second abstract syntax tree in response to the user's modification operation on the second file; determining the target second node corresponding to the modification operation, as well as the first element, second element and element attributes in the second node; performing targeted standardization processing on the target second node through the corresponding sub-module in the Wasm module to obtain a modified third file.
[0013] According to at least one embodiment of the present disclosure, a first file in WebPPT format is obtained, and a first abstract syntax tree is constructed after parsing the first file, including: parsing the first file to obtain a first node containing each page element in the file; and constructing the first abstract syntax tree based on multiple first nodes having different element types.
[0014] According to at least one embodiment of the present disclosure, after constructing the first abstract syntax tree, the method further includes: according to the memory structure of the Wasm module, continuously storing the first nodes in the first abstract syntax tree in the corresponding structure arrays according to different element types.
[0015] According to a second aspect of the present disclosure, an electronic device is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, so that the processor executes the method described in the first aspect of any embodiment of the present disclosure.
[0016] According to a third aspect of the present disclosure, a readable storage medium is provided, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the method described in the first aspect of any embodiment of the present disclosure.
[0017] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method according to the first aspect of any embodiment of the present disclosure is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0019] Figure 1 A flowchart of a WebPPT file export method provided by the present disclosure.
[0020] Figure 2 This is a schematic diagram of a Slide root node according to an embodiment of the present disclosure.
[0021] Figure 3 A schematic diagram of a second abstract syntax tree generation process exemplified in the present disclosure.
[0022] Figure 4 This is a schematic block diagram of the structure of a WebPPT file exporting device according to one embodiment of the present disclosure.
[0023] Figure 5 The present invention is a block diagram showing the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present disclosure is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are intended only to illustrate the relevant content and are not intended to limit the present disclosure. It should also be noted that, for ease of description, only the portions relevant to the present disclosure are shown in the accompanying drawings.
[0025] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] In WebPPT (web-based PowerPoint) editing scenarios, users typically edit WebPPT files online. Furthermore, they expect the same editing features in web editors (web editors) as they do in local applications (such as WPSPPT and Office PowerPoint). However, in practice, due to incompatibilities between PPT editing software of different formats, some features cannot be used interchangeably. Therefore, after editing a WebPPT file online, if users want to export the file locally, they need to convert it for compatibility. If the WebPPT file contains a large number of complex elements such as images, animations, and videos, the conversion process requires significant computing power. If users want to convert the file to a specific PPT format within the web editor, insufficient computing power results in low efficiency. Therefore, a solution that can efficiently convert WebPPT files to compatible formats with low computing power is urgently needed.
[0027] For the convenience of description and to make the technical solutions of the specific embodiments of the present disclosure easier to understand, before describing the information display method implemented by the present disclosure, the technical terms involved in the specific embodiments of the present disclosure are explained as follows.
[0028] Wasm: WebAssembly (Wasm) is a low-level, efficient bytecode format designed for browser environments. It aims to provide near-native computing capabilities while maintaining interoperability with JavaScript. Wasm is a compilation target that allows developers to write code in a variety of languages (such as C, C++, Rust, etc.), which is then compiled into Wasm modules and run in web browsers.
[0029] An Abstract Syntax Tree (AST) is a tree-like data structure. Each node in this data structure represents the page parsed from the first file, along with the element types within that page. This allows the first file's content to be separated from its formatting (including style and layout), facilitating subsequent processing.
[0030] Figure 1 This is a flow chart of a WebPPT file export method provided by the present disclosure. Figure 1 The method shown includes steps 101 to 105. The method can be executed by an electronic device such as a server (a local server or a cloud server).
[0031] In step 101, a first file in WebPPT format is obtained, and a first abstract syntax tree is constructed after parsing the first file; wherein the first abstract syntax tree contains a plurality of first nodes of different element types. In the disclosed solution, the first file is a WebPPT file edited in a web browser. According to different user needs, the first file needs to be exported to a second file in a specified format. The specified format mentioned here refers to the format of different PPT software, such as WPS PPT, Office PPT and Web PPT. Of course, there may be other formats of PPT.
[0032] Specifically, in step 101, a first file in WebPPT format is obtained, and the first file is parsed to construct a first abstract syntax tree. This includes: parsing the first file to obtain a first node containing each page element in the file; and constructing the first abstract syntax tree based on a plurality of first nodes having different element types.
[0033] The specific process of parsing a WebPPT file into the first abstract syntax tree (AST) is as follows: decompress the WebPPT file in formats such as .pptx, and obtain the internal XML files (such as the slide XML in the Slides / directory) and resource files (such as images and fonts).
[0034] Use the XML parser to read the XML content of each slide, identify the text boxes, shapes, charts, animations and other elements, and map them to the first nodes of different element types in AST (such as text nodes, image nodes, animation nodes).
[0035] The scattered information such as style (such as font, color), layout (coordinates, alignment) and animation parameters (duration, trigger conditions) are stored as element attributes in the corresponding first node, and a hierarchical relationship is established between the nodes. This hierarchical relationship can be a hierarchical relationship from page to element and then to element attribute (such as slide → text box → text content).
[0036] Associate resource files such as images and fonts with corresponding nodes, and mark the content that needs to be optimized (such as images that need to be compressed and shapes that need to be vectorized) to provide structured input for subsequent Wasm module processing.
[0037] For example, assuming there is a first file in PPT format, the content (text, image, animation, etc.) in the first file is parsed into a tree structure, where each node represents a logical entity (such as a text node, an image node).
[0038] As an example, in Figure 2 A schematic diagram of the Slide root node is shown in FIG.
[0039] It can be seen that after converting the first file into the first abstract syntax tree, the content and format of each page of the PPT can be separated, facilitating subsequent optimization processing. This is because different Wasm functional submodules are selected for optimization processing of different types of elements and element attributes. In this case, when separating content from format, corresponding submodules can be selected for targeted optimization processing, without optimizing other elements and other irrelevant content. This can effectively improve the optimization processing efficiency of the PPT.
[0040] In addition, after converting the first file into the first abstract syntax tree, it is convenient to globally traverse all elements and element attributes in the first file, and it is possible to accurately identify element types and repeated elements and repeated element attributes.
[0041] In step 102, after the Wasm module is loaded in the Web editor, a vectorization submodule and / or a compression submodule in the Wasm module is called according to the element type of the first node in the first abstract syntax tree.
[0042] Before loading a Wasm module into the web editor, it must first be compiled into its various functional submodules. These submodules are pre-compiled. For example, the vectorization submodule compiles algorithms for converting bitmaps to vector paths (such as edge detection and Bezier curve fitting) into the Wasm format, enabling lossless vectorization of simple shapes (such as logos and tables). The compression submodule integrates image compression algorithms (such as WebP's predictive coding and quantization), animation compression algorithms (such as frame merging and keyframe interpolation), and video compression algorithms (such as H.264's inter-frame motion estimation). These algorithms are implemented in C / C++ and then compiled into the Wasm format, achieving near-native data compression performance. Each submodule can be independently optimized or replaced (e.g., upgrading the compression algorithm requires no changes to the vectorization logic). WebAssembly's parallel computing capabilities enable consistent processing across platforms (e.g., adapting SVG vector graphics to both the web and Office formats).
[0043] After loading the Wasm module in the Web editor, the system dynamically calls the corresponding vectorization submodule or compression submodule in the Wasm module based on the element type (such as image, text, animation, etc.) of the first node in the first abstract syntax tree (AST).
[0044] Wasm's hardware-level acceleration significantly improves vectorization and compression efficiency, making it particularly suitable for processing high-resolution images or complex animations. Its modular architecture supports on-demand loading of sub-modules (e.g., there is no need to load vectorization sub-modules when only compression is required), thus reducing resource usage. Through unified intermediate representations (such as vector paths or standardized compression formats), it ensures display consistency of exported files across WPS, Office, and the Web.
[0045] In step 103, the first element in the first node is passed to the vectorization submodule for standardization processing, and / or the second element in the first node is passed to the compression submodule for compression processing, so as to obtain a second node with less redundant data than the first node and in a standardized format.
[0046] In practical applications, different submodules are used to optimize different types of elements. The purpose of using submodules to optimize elements is to compress the content of the first node, removing unnecessary redundant data, redundant images, redundant animation frames, or video frames, thereby obtaining a second node with less redundant data and a smaller data volume. Furthermore, the compressed elements, second element attributes, and intermediate representation elements in the second node facilitate compatibility conversion, improving compatibility conversion efficiency.
[0047] It should be noted that the standardized format mentioned here can be understood as the standardization of formats for different types of elements, for example, images are standardized to the SVG format. This standardized conversion facilitates management.
[0048] The following will describe the implementation process of transferring the first element in the first node to the vectorization submodule for normalization processing, and transferring the second element in the first node to the compression submodule for compression processing.
[0049] The first element mentioned here includes: at least one of an image element and a table in the PPT file material. The aforementioned passing of the first element in the first node to the vectorization submodule for standardization processing specifically includes: passing the image element to the vectorization submodule in Wasm format compiled based on the redundant path optimization algorithm, and vectorizing the image element into an intermediate representation image element with a standard format. Passing the table to the vectorization submodule in Wasm format compiled based on the vectorization decomposition algorithm, and vectorizing the table into an intermediate representation table with a standard format.
[0050] It should be noted that image elements refer to the various image elements that come with a PPT file (for example, illustrations: boxes, circles, and five-pointed stars in shapes, and inserts: WordArt in text). They do not include complex photos or images that you paste or import. Tables refer to text content in table format that you add to a PPT file.
[0051] During the vectorization process, the vectorization submodule processes simple image elements included in PPT (such as boxes and five-pointed stars) using a redundant path optimization algorithm. It first analyzes the edge contours of the original bitmap, identifies shape boundaries using edge detection algorithms (such as Canny), and then generates a vector path through Bezier curve fitting. Redundant control points are removed to simplify the path description (for example, by merging consecutive short lines into a single curve). Finally, a lightweight intermediate representation (such as an SVG path) with a standardized format is output. For table elements, the vectorization submodule uses a vectorization decomposition algorithm to break the table into independent vector segments (horizontal and vertical borders) and text nodes. Repeated styles are merged (such as uniform border width and color). Matrix transformations are then used to dynamically adjust the row and column layout to suit the target platform. The advantages of the vectorization sub-module are reflected in: accelerating geometric calculations (such as curve fitting and matrix operations) through WebAssembly to achieve millisecond-level response; modular design allows independent optimization of algorithms for different element types (such as upgrading path simplification logic without affecting the table processing module); cross-platform intermediate representations (such as SVG and standardized XML) ensure that the exported files maintain consistent display effects on the Web, WPS and Office, and the file size is significantly reduced (for example, redundant paths are significantly optimized).
[0052] Based on this vectorization solution, vector paths remain clear at any resolution, avoiding bitmap blur. Wasm-accelerated computation enables real-time editing and exporting of complex shapes and tables. Intermediate representation formats (e.g., intermediate representation image elements and intermediate representation tables) facilitate subsequent compatibility processing, facilitating adaptation to rendering engines on different platforms and eliminating compatibility differences. Path simplification and style merging significantly reduce the size of the second abstract syntax tree (AST), improving loading and transmission efficiency.
[0053] The second element mentioned here includes: at least one of an image, a video and an animation. Generally speaking, there is only one second element in a first node (for example, only an image, or only an animation). The second element in the first node is passed to the compression submodule for compression processing as mentioned above. Specifically, it includes: passing the image to a compression submodule in Wasm format compiled based on the image compression algorithm, and calling the single instruction multiple data stream in the Wasm module to compress the image to obtain a compressed image. Passing the animation to a compression submodule in Wasm format compiled based on the merged frame algorithm and / or the key frame difference algorithm to compress the animation to obtain a compressed animation. Passing the video to a compression submodule in Wasm format compiled based on the inter-frame compression algorithm and / or the intra-frame compression algorithm to compress the video to obtain a compressed video.
[0054] It should be noted that the image mentioned here is different from the image elements mentioned above. The image mentioned here refers to complex images such as photos imported or pasted into the first file by the user, not illustrations or texts that come with PPT.
[0055] There can be multiple compression submodules mentioned here, including Wasm format compression submodules for animation compression, Wasm format compression submodules for video compression, and Wasm format compression submodules for image compression. These compression submodules with different functions are compiled based on different algorithms.
[0056] In the processing flow of the compression sub-module, the image is compiled into a Wasm module through a lossy / lossless compression algorithm based on WebP or APNG, and pixel blocks are processed in parallel using single instruction multiple data (SIMD) stream to achieve a balance between high compression rate and visual quality.
[0057] Animation is compiled into Wasm modules by merging redundant frames (such as merging consecutive static frames into a single frame) or keyframe interpolation algorithm (retaining only keyframes and dynamically generating intermediate frames), and using multi-threading to accelerate the calculation of inter-frame differences.
[0058] The video is compiled into a Wasm module through inter-frame compression (motion estimation and compensation) and intra-frame compression (DCT transformation and quantization) algorithms, combined with hardware-level optimization to achieve efficient encoding.
[0059] Based on the aforementioned compression scheme, deep integration of algorithms and hardware (such as SIMD-accelerated pixel processing and multi-threaded frame computing), task isolation and resource control (such as independent allocation of computing resources to different sub-modules to avoid resource competition), and dynamic adaptability (such as selecting WebP or HEVC encoding based on the target platform), the resulting compressed images, videos, and animations not only have smaller data sizes, but also output formats (such as WebP and H.265) that easily match the decoding capabilities supported by the specified format, avoiding display anomalies caused by format incompatibility.
[0060] In step 104, the first node in the first abstract syntax tree is replaced with the second node to obtain a second abstract syntax tree after the node replacement. After all the first nodes in the first abstract syntax tree are converted into second nodes, the second nodes can be further used to replace the first nodes in the first abstract syntax tree. After completing the replacement of all nodes, a second abstract syntax tree is obtained. The second node in the second abstract syntax tree has a smaller amount of data, and the elements and element attributes stored in each node. In other words, the overall data volume of the second abstract syntax tree is smaller than that of the first abstract syntax tree. The obtained second abstract syntax tree serves as the basis for subsequent compatibility export, making file export more efficient.
[0061] like Figure 3 The diagram of the second abstract syntax tree generation process for illustrating the present disclosure. The first abstract syntax tree may include multiple first nodes, namely the slide root node, and other first nodes connected to the slide root node (such as the first node text, the first node title). Other first nodes include the text box node and the picture node. Among them, the first node connected to the text box node may also have other first nodes that store element attributes (such as the first node font: Song No. 1): font style information. The first node connected to the picture node also has other first nodes that store element attributes (such as the first node picture: JPG, PNG): resolution, location information and animation information, and is used to store nodes for pictures and picture paths. Before performing node replacement, first nodes with the same content can optionally be merged first. The specific merging method can be referred to the subsequent embodiments, and will not be repeated here.
[0062] After optimizing the first node using the corresponding Wasm format submodule to obtain the second node, all the first nodes in the first abstract syntax tree can be replaced by the second node.
[0063] In an optional solution, a second abstract syntax tree containing only the second node may be established according to the first abstract syntax tree. After the second abstract syntax tree is established, the first abstract syntax tree may be deleted.
[0064] In step 105, a second file compatible with a specified format is exported based on the second abstract syntax tree. Specifically, the specified format is determined; a determination is made as to whether the compressed element, intermediate representation element, and second element attribute in the second node of the second abstract syntax tree are compatible with the specified format; if not, at least one of the compressed element, intermediate representation element, and second element attribute is format-converted according to the format requirements of the specified format; and the second abstract syntax tree, after the format conversion, is exported as a second file. If compatible, no compatibility conversion is required, and the second abstract syntax tree can be directly exported as a second file. This second file can be normally edited and presented on a client device that supports the specified format.
[0065] It should be noted that the specified formats mentioned here refer to the software formats of PPT files that the client device to which you will export can support. For example, these can be WPS PPT format, Office PPT format, and WebPPT format. Of course, in actual applications, there may be other PPT software formats.
[0066] The compressed elements mentioned here include compressed images, compressed animations and compressed videos. The intermediate representation elements mentioned here include intermediate representation image elements and intermediate representation tables.
[0067] Before exporting, it is necessary to first detect what format of PPT software the local device supports, or the user specifies the specified format corresponding to the second file to be exported. In the subsequent embodiments, it is assumed that the format is specified by the user.
[0068] According to the target format specified by the user (such as WPS, Office or Web), the compatibility of the elements in the second abstract syntax tree is determined through the preset compatibility rule library.
[0069] Specifically, it verifies that compressed elements (such as WebP images), intermediate representation elements (such as SVG vector images), and element attributes (such as animation type and font style) are in the supported list for the specified format. For example, if the specified format is an older version of Office (which only supports EMF vector images), the SVG intermediate representation element will be marked as incompatible.
[0070] Checks whether element attributes conform to the specifications of the specified format (such as color depth, animation frame rate, and font embedding rules). For example, the web version supports transparency gradients, but some versions of Office may only support single-color fills.
[0071] If an incompatible element is detected, dynamic format conversion is triggered, for example, compression element conversion: such as converting WebP images to PNG / JPEG, or converting bitmaps back to compatible vector formats (such as EMF) through the vectorization submodule. Intermediate representation conversion: such as converting SVG paths to vector instructions supported by the target platform (such as Office's <a:path>XML tag). Perform attribute adaptation conversion: for example, disabling incompatible animation effects (such as downgrading 3D rotation to displacement animation), or replacing the font with the platform default font.
[0072] The second abstract syntax tree obtained based on the method described above not only has a second node with a smaller data volume, but also the compressed elements, second element attributes, etc. in the second node are an intermediate representation, which has better compatibility adaptation and conversion capabilities. That is, the compatibility conversion based on the second abstract syntax tree is more efficient.
[0073] In one or more embodiments of the present disclosure, the Wasm module further includes a matrixing submodule, which transmits the first element attribute of the first element and / or the second element to the matrixing submodule to calculate and obtain a standardized second element attribute.
[0074] To facilitate subsequent element management and compatibility conversion, position, style, and layout can be uniformly managed through geometric calculations.
[0075] When using the matrix submodule for conversion processing, the matrix calculation method can be used to extract the scattered font and color definitions into a shared style in a standardized format (such as CSS classes). The style rules are converted into a format supported by the target platform (such as CSS for the Web or XML for Office).
[0076] When performing layout calculations, element positions and sizes can be uniformly adjusted using translation, rotation, and scaling matrices. Furthermore, layout parameters can be dynamically calculated based on the resolution supported by the target client (e.g., percentage layout for web applications).
[0077] If the element contains animation, the animation trajectory can be optimized and a smooth animation path can be generated through matrix operations (such as Bezier curve interpolation). The animation parameters are converted from the design coordinate system to the coordinate system of the target platform (such as EMU units).
[0078] Based on the above solution, by performing matrix calculations on the second element attributes corresponding to the first element and / or the second element, the elements in each node are made to have the same standard format, duplicate element attributes can be removed, and element attributes can be merged and managed. In addition, when compatibility conversion is required for PPT file export, the conversion workload can be further reduced, improving work efficiency.
[0079] In one or more embodiments of the present disclosure, after calculating the standardized second element attribute, it also includes: when the first element attribute is the style and layout of an image element, or the style and layout of text, checking whether multiple first nodes have the same first element attribute; if multiple first nodes have the same first element attribute, merging the first element attributes in the multiple first nodes into a shared first element attribute.
[0080] In practical applications, in order to improve management efficiency and compatibility conversion efficiency, the Wasm module can be used to further optimize the first element attributes.
[0081] Specifically, after constructing the first abstract syntax tree containing the first node and the first element attributes (that is, before constructing the second abstract syntax tree), all text nodes in the first abstract syntax tree can be scanned and the first element attributes, such as the font style (font name, size, color, bold / italic, etc.) of each text box, can be analyzed. If multiple text boxes are found to have identical font styles (for example, all titles are Arial, size 24, bold, dark blue), the duplicate styles are extracted as a shared style definition, and all related text boxes reference this shared style.
[0082] For example, let's say you're creating a PowerPoint presentation that contains the following: 10 title text boxes, all using 24-point bold Arial font in dark blue, and 5 body text boxes, all using 12-point regular Times New Roman font in black.
[0083] In the original first abstract syntax tree (AST) (first node), the font style of each text box is stored independently. For example: Heading 1: Font: Arial, 24 point, bold, dark blue, Heading 2: Font: Arial, 24 point, bold, dark blue, etc. Furthermore, Body 1: Font: Times New Roman, 12 point, regular, black, Body 2: Font: Times New Roman, 12 point, regular, black, etc.
[0084] Next, merge the styles. This creates shared style 1: "Title Style" → Font: Arial, size 24, bold, dark blue. Shared style 2: "Body Style" → Font: Times New Roman, size 12, regular, black. Text box 1 → references the "Title Style," and text box 2 → references the "Title Style."
[0085] The above solution achieves greater efficiency by merging the first element attributes before performing compatibility adjustments. In other words, after merging, the number of first nodes and elements within them can be effectively reduced. The subsequent generation of the second abstract syntax tree will have fewer nodes, which means that subsequent optimization and compatibility adjustments will be more efficient.
[0086] For example, if the target platform doesn't support the Arial font, all text boxes need to be checked one by one and the font replaced. If there are 10 headings and 5 body text, this requires 15 steps. However, using the above solution, after merging the first element attributes, only the shared style needs to be modified (for example, replacing the heading style's font with platform-supported Helvetica). All text boxes referencing that style will automatically update, requiring only two steps (for the heading style and the body text style).
[0087] In addition, after merging, duplicate font style information is no longer stored in the AST, resulting in a smaller file size and faster processing. This also effectively avoids omissions or errors (such as missing a text box) caused by manually replacing fonts one by one.
[0088] The Wasm module converts scattered style definitions into shared styles by identifying and merging duplicate font styles. This allows only shared styles to be modified when adjusting compatibility, without having to process nodes one by one, significantly reducing complexity.
[0089] In one or more embodiments of the present disclosure, after exporting the second file compatible with the specified format based on the second abstract syntax tree, it also includes: in response to the user's modification operation on the second file, making corresponding adjustments to the second abstract syntax tree; determining the target second node to be adjusted accordingly by the modification operation, as well as the first element, second element and element attributes in the second node; performing targeted standardization processing on the target second node through the corresponding sub-module in the Wasm module to obtain a modified third file.
[0090] As mentioned above, in the disclosed solution, the modules used to optimize elements and element attributes are all Wasm functional submodules. In other words, targeted optimization and adjustment can be achieved by calling Wasm submodules.
[0091] In the second abstract syntax tree, the second node is a deduplicated and merged node, eliminating redundant attributes from the first node. Therefore, when modifying elements or element attributes in the second node, the above solution can effectively improve modification efficiency. This will be explained below using specific examples.
[0092] When a user requests real-time rendering of a secondary node, for example, a modification (such as dragging a text box) triggers an AST node update, the Wasm submodule responsible for a function immediately recalculates the modified node locally (e.g., recalculating the text box's position matrix and detecting overlap with other elements). Using WebAssembly's high-performance rendering capabilities (such as Canvas or WebGL), the modified AST is rendered to the canvas in real time. This avoids the rendering delays of traditional JavaScript and ensures smooth operation of complex operations (such as dragging high-resolution images).
[0093] When a user modifies a portion of content (such as changing chart data), the Wasm submodule responsible for the corresponding function is called to reoptimize only the affected nodes: Image nodes: recompress or vectorize the modified image; Animation nodes: regenerate keyframes or adjust the timeline; Layout nodes: recalculate matrix transformations (such as position and scale). Unmodified parts retain the original optimization results, avoiding full reprocessing. This significantly reduces computational effort, supports second-level response, and improves the user experience.
[0094] When a user modifies content, the Wasm module immediately checks compatibility with the target platform. For example, if a user changes the text font to "Arial Black," but the target platform (such as WPS) doesn't support this font, the Wasm module dynamically triggers the font replacement (for example, to "Arial") and updates the style node in the AST. The live preview directly displays the effect of the compatibility adjustment. Users don't need to manually address compatibility issues; the modified content is directly adapted to the target platform.
[0095] As shown in the solution described above, using Wasm modules reduces the number and complexity of nodes required for subsequent processing by merging repeated patterns, simplifying animation sequences, and compressing images. For example, an original animation might contain 100 frames. After optimization using the Wasm module, these frames are merged into 10 keyframes, requiring only those 10 frames for subsequent compatibility adjustments. Another example is an original chart that may contain numerous redundant data points. After optimization, only the key data points are retained, reducing the computational effort required for compatibility adjustments.
[0096] Furthermore, Wasm modules enable standardized content conversion of elements and their attributes. Specifically, Wasm modules convert node information into a unified intermediate format (e.g., converting bitmaps to vector graphics, and converting complex animations to standard animation types), making subsequent compatibility adjustments easier to implement. For example, vector graphics (SVG) are more easily adapted to platforms with different resolutions than bitmaps (PNG). Standard animation types (such as fade-in) are more easily supported by WPS or Office than custom animations.
[0097] After the first abstract syntax tree is constructed, the method further includes: according to the memory structure of the Wasm module, continuously storing the first nodes in the first abstract syntax tree in corresponding structure arrays according to different element types.
[0098] For example, the traditional AST node structure can be split into two independent arrays: a node array and a matrix array of different element types. Assume that each array is aligned to 16 bytes to ensure memory alignment when SIMD instructions are loaded, that data of the same type is stored contiguously (e.g., the transform matrices of all nodes are stored centrally), that padding is added to the end of the array (e.g., float[4] actually occupies 16 bytes, no additional padding is required), and that different arrays are accessed through a unified index (e.g., types[i], transforms[i]).
[0099] By adapting the first abstract syntax tree to the linear memory of the Wasm module, the work efficiency of the Wasm module during data processing can be effectively improved.
[0100] Based on any of the above embodiments, the present disclosure also provides a WebPPT file exporting device. Figure 4 FIG. 1 is a schematic block diagram of the structure of a WebPPT file exporting device according to an embodiment of the present disclosure. Figure 4 As shown, the WebPPT file exporting device includes: an acquisition module 31 for acquiring a first file in WebPPT format, parsing the first file, and constructing a first abstract syntax tree; wherein the first abstract syntax tree contains multiple first nodes of different element types. A loading module 32 is configured to load a Wasm module into a Web editor and, based on the element type of the first node in the first abstract syntax tree, invoke a vectorization submodule and / or a compression submodule within the Wasm module. An element processing module 33 (including a compression submodule and a vectorization submodule within Wasm) is configured to pass the first element in the first node to the vectorization submodule for standardization processing and / or pass the second element in the first node to the compression submodule for compression processing, thereby obtaining a second node with less redundant data than the first node and in a standardized format. A replacement module 34 is configured to replace the first node in the first abstract syntax tree with a second node, thereby obtaining a second abstract syntax tree after the node replacement. An export module 35 is configured to export the second abstract syntax tree into a second file compatible with a specified format based on the second abstract syntax tree.
[0101] Optionally, the Wasm module further includes a matrixing submodule 36. The matrixing submodule 36 is configured to transfer the first element attribute of the first element and / or the second element to the matrixing submodule to calculate and obtain a standardized second element attribute.
[0102] The element processing module 33 is also used to check whether multiple first nodes have the same first element attribute when the first element attribute is the style and layout of an image element, or the style and layout of text; if multiple first nodes have the same first element attribute, the first element attributes in the multiple first nodes are merged into a shared first element attribute.
[0103] Optionally, the second element includes at least one of an image, a video, and an animation. The element processing module 33 is further configured to pass the image to a compression submodule in a Wasm format compiled based on an image compression algorithm, and invoke a single instruction multiple data stream in the Wasm module to compress the image to obtain a compressed image; pass the animation to a compression submodule in a Wasm format compiled based on a merged frame algorithm and / or a keyframe difference algorithm to compress the animation to obtain a compressed animation; and pass the video to a compression submodule in a Wasm format compiled based on an inter-frame compression algorithm and / or an intra-frame compression algorithm to compress the video to obtain a compressed video.
[0104] Optionally, the first element includes at least one of an image element and a table in the PPT file material. The element processing module 33 is further configured to pass the image element to a vectorization submodule in Wasm format compiled based on the redundant path optimization algorithm, vectorizing the image element into an intermediate representation image element having a standard format; and pass the table to a vectorization submodule in Wasm format compiled based on the vectorization decomposition algorithm, vectorizing the table into an intermediate representation table having a standard format.
[0105] Optionally, the export module 35 is used to determine the specified format; determine whether the compressed element, intermediate representation element and second element attribute in the second node in the second abstract syntax tree are compatible with the specified format; if not, convert at least one of the compressed element, intermediate representation element and second element attribute according to the format requirements of the specified format; and export the second abstract syntax tree that has completed the format conversion as a second file.
[0106] Optionally, a modification module 37 is also included for making corresponding adjustments to the second abstract syntax tree in response to the user's modification operation on the second file; determining the target second node to be adjusted accordingly by the modification operation, as well as the first element, second element and element attributes in the second node; and performing targeted standardization processing on the target second node through the corresponding sub-module in the Wasm module to obtain a modified third file.
[0107] The acquisition module 31 is configured to parse the first file to obtain a first node containing each page element in the file; and construct a first abstract syntax tree based on a plurality of first nodes having different element types.
[0108] Based on the above solution, when exporting PPT files, the optimization stage and the compatibility stage are separated, making the system easier to expand (for example, when adding new platform support, only the compatibility adjustment module needs to be modified without changing the optimization logic).
[0109] The optimized nodes are cleaner (e.g. no redundant data, unified format), and the computational complexity of subsequent compatibility adjustments is significantly reduced.
[0110] In addition, the optimized nodes have undergone standardized processing (such as vector graphics and WebP compression), and the basic display effects on different platforms are more consistent, and subsequent adjustments only need to deal with minor differences.
[0111] Standardizing and simplifying the first node through the Wasm module significantly reduces the computational complexity and complexity of subsequent compatibility adjustments, improving export efficiency and file quality. This phased design leverages Wasm's high performance while reducing the difficulty of cross-platform adaptation, providing the optimal technical solution.
[0112] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0113] The execution subject of the method in the specific embodiment of the present disclosure may be an electronic device such as a server (including a local server or a cloud server).
[0114] Therefore, based on any of the above embodiments, the present disclosure further provides an electronic device, which can execute the information display method of any of the above embodiments described in the present disclosure.
[0115] Figure 5 The present invention is a block diagram showing the structure of an electronic device according to an embodiment of the present invention.
[0116] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnecting buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules. The bus 1100 can also connect various other circuits 1400 such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.
[0117] Bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component Architecture (EISA) bus. Buses can be classified as address buses, data buses, control buses, and the like. For ease of illustration, this figure shows only one connecting line, but this does not imply that there is only one bus or only one type of bus.
[0118] The present disclosure also provides a readable storage medium having a computer program stored therein, which is used to implement the above-mentioned method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use with an instruction execution system, device or equipment or in conjunction with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion having one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0119] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part using software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, the process or function of the present disclosure is performed in whole or in part.
[0120] A computer program or instruction can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, the computer program or instruction can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The readable storage medium can be any accessible medium or a data storage device such as a server or data center that integrates one or more accessible media. The accessible medium can be a magnetic medium such as a floppy disk, hard disk, or magnetic tape; an optical medium such as a digital video disk; or a semiconductor medium such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or can include both volatile and non-volatile types of storage media.
[0121] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0122] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing method device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing method device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0123] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0125] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and the features of different embodiments / methods or examples, unless they are mutually inconsistent.
[0126] Those skilled in the art will appreciate that the above embodiments are merely intended to clearly illustrate the present disclosure and are not intended to limit the scope of the present disclosure. Other changes or modifications may be made based on the above disclosure, and such changes or modifications are still within the scope of the present disclosure.< / a:path>
Claims
1. A WebPPT file export method, characterized in that: include: Obtain a first file in a WebPPT format, parse the first file, and construct a first abstract syntax tree, wherein the first abstract syntax tree includes a plurality of first nodes of different element types; After loading the Wasm module in the Web editor, calling a vectorization submodule and / or a compression submodule in the Wasm module according to the element type of the first node in the first abstract syntax tree; Passing the first element in the first node to the vectorization submodule for normalization processing and / or passing the second element in the first node to the compression submodule for compression processing to obtain a second node; Replacing the first node in the first abstract syntax tree with the second node to obtain a second abstract syntax tree after node replacement; Exporting a second file compatible with a specified format based on the second abstract syntax tree includes: determining the specified format; judging whether the compressed element, the intermediate representation element, and the second element attribute in the second node in the second abstract syntax tree are compatible with the specified format; if not, performing format conversion on at least one of the compressed element, the intermediate representation element, and the second element attribute according to the format requirements of the specified format; and exporting the second file using the second abstract syntax tree after the format conversion.
2. The method according to claim 1, characterized in that Also includes: The first element attribute of the first element and / or the second element is passed to the matrixing submodule of the Wasm module to calculate and obtain the standardized second element attribute.
3. The method according to claim 2, characterized in that Before calculating the normalized second element properties, it also includes: When the first element attribute is the style and layout of an image element or the style and layout of a text, checking whether multiple first nodes have the same first element attribute; If multiple first nodes have the same first element attribute, the first element attributes in the multiple first nodes are merged into a shared first element attribute.
4. The method according to claim 1, wherein The second element includes at least one of an image, a video, and an animation, and the second element in the first node is transferred to the compression submodule for compression processing, including: Passing the image to the compression submodule in Wasm format compiled based on the image compression algorithm, and calling the single instruction multiple data flow in the Wasm module to compress the image to obtain a compressed image; or Passing the animation to the compression submodule in Wasm format compiled based on the merged frame algorithm and / or the key frame difference algorithm to compress the animation to obtain a compressed animation; or The video is passed to the compression submodule in Wasm format compiled based on the inter-frame compression algorithm and / or the intra-frame compression algorithm to compress the video to obtain a compressed video.
5. The method according to claim 1, wherein The first element includes: at least one of an image element and a table in the PPT file material; Passing the first element in the first node to the vectorization submodule for normalization processing includes: Passing the image elements to the vectorization submodule in Wasm format compiled based on the redundant path optimization algorithm, and vectorizing the image elements into intermediate representation image elements with a standard format; The table is passed to the vectorization submodule in the Wasm format compiled based on the vectorization decomposition algorithm, and the table is vectorized into an intermediate representation table with a standard format.
6. The method according to claim 1 or 3, characterized in that After exporting the second abstract syntax tree into a second file compatible with a specified format, the method further includes: In response to a user modification operation on the second file, adjusting the second abstract syntax tree accordingly; Determining a target second node to be adjusted corresponding to the modification operation, and a first element, a second element, and element attributes in the second node; Targeted standardization processing is performed on the target second node through the corresponding sub-module in the Wasm module to obtain a modified third file.
7. The method according to claim 1, characterized in that Obtaining a first file in a WebPPT format, parsing the first file and constructing a first abstract syntax tree, including: Parsing the first file to obtain a first node containing each page element in the file; A first abstract syntax tree is constructed based on a plurality of first nodes having different element types.
8. An electronic device, characterized in that: include: a memory storing execution instructions; as well as A processor, wherein the processor executes the execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1 to 7.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Node replacement method and device, storage medium and electronic device
CN118860399A