Web page translation methods, devices, app store systems, equipment, and media

By generating container controls and adding image and text styles to the corresponding controls, the problem of low content fidelity in WPF web pages was solved, achieving a consistent presentation effect with the web page.

CN117786256BActive Publication Date: 2026-11-17SHANGHAI UNITED IMAGING HEALTHCARE
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311815456.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-26
Publication Date
2026-11-17
Estimated Expiration
2043-12-26

AI Technical Summary

Technical Problem

When rendering web page content in WPF, the format reproduction accuracy is low, and existing technologies cannot effectively solve the problem of inaccurate rendering after converting web page content to WPF format.

Method used

By obtaining style tags, image storage paths, and image/text grouping information from the page data, a container control is generated. Based on this information, the execution result of the container control is presented in the graphical user interface, ensuring that the positions of text and images are consistent with the web page. The container control is used to accurately add image and text styles to the corresponding controls.

Benefits of technology

The format conversion accuracy of the WPF client has been improved, ensuring that the presented content is consistent with that of the web page, thus solving the problem of low format accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117786256B_ABST
    Figure CN117786256B_ABST
Patent Text Reader

Abstract

This application relates to a webpage translation method, apparatus, app store system, device, and medium, comprising: acquiring HTML page data; wherein the HTML page data includes style tags of text nodes, image storage paths, and grouping information of text and images; generating a container control in a user interface window based on the grouping information of text and images; generating a text style list based on the style tags of text nodes, and adding the text style list and corresponding text to the corresponding container control; acquiring images based on the image storage paths, and adding the images to the corresponding container control; executing the container control, and presenting the execution result of the container control in WPF format in the window of the graphical user interface. By generating a container control in the window of the graphical user interface, the position of text and images in the WPF side is accurate and the format is consistent, solving the problem of low content fidelity in the WPF presentation after the webpage content is converted to WPF format.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of web page translation technology, and in particular to a web page translation method, apparatus, app store system, device, and medium. Background Technology

[0002] Traditionally, web page content is translated into WPF format and rendered using the RichTextBox control in the WPF (Windows Presentation Foundation) framework. However, loading web page content using RichTextBox in WPF requires placing the object to be converted into the RichTextBox control and modifying the properties of the selected text. Editing text one by one using existing controls limits text formatting and results in a rigid interface. Consequently, the formatting of web page content rendered in WPF is inaccurate, layout is inflexible, and the WPF rendering suffers from low fidelity to the original web page format.

[0003] There is currently no effective solution to the problem of low content fidelity in WPF presentation after web page content is converted to WPF format. Summary of the Invention

[0004] Therefore, it is necessary to provide a web page translation method, apparatus, application store system, device, and medium that can improve the format conversion accuracy when converting web page content to WPF format, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a webpage translation method, the method comprising:

[0006] Obtain page data; wherein, the page data includes style tags for text nodes, image storage paths, and image-text grouping information;

[0007] Based on the image and text grouping information, a container control is generated in the form of the graphical user interface;

[0008] Based on the style tags of the text nodes, generate a list of text styles, and add the list of text styles and the corresponding text to the corresponding container control;

[0009] The image is obtained according to the image storage path, and the image is added to the corresponding container control;

[0010] The container control is executed, and the execution result of the container control is presented in WPF format on the form of the graphical user interface.

[0011] In one embodiment, a container control is generated in a window of the graphical user interface based on the image and text grouping information, including:

[0012] The number of container controls is determined based on the number of image and text groups;

[0013] The style of the container control is determined based on the relative position information between the text and images within the image and text group;

[0014] The arrangement position of the multiple container controls is determined based on the relative position information between the multiple graphic groups.

[0015] In one embodiment, the style of the container control is determined based on the relative position information of the text and images within the group, including:

[0016] A first region is generated based on the area occupied by the text on the webpage;

[0017] A second region is generated based on the area occupied by the image on the webpage;

[0018] The first region and the second region are combined based on the relative positions of the text and the image.

[0019] In one embodiment, a list of text styles is generated based on the style tags of the text nodes, including:

[0020] Iterate through the style tags of the text nodes to obtain the text styles corresponding to the style tags;

[0021] The text styles are recorded in the style list according to the traversal order.

[0022] In one embodiment, before traversing the style tags of the text nodes, the method further includes:

[0023] Determine whether the style tag of the text node contains sorting information;

[0024] If it is determined that the style tag of the text node contains the sorting information, the sorting information is recorded in the style list.

[0025] In one embodiment, obtaining the page data includes:

[0026] Based on the preset data format, communication is established with the page to obtain the page data.

[0027] Secondly, this application also provides a webpage translation device, the device comprising an acquisition module, a task execution module, and a display module; wherein,

[0028] The acquisition module is used to acquire a pre-defined data format and obtain page data according to the pre-defined data format; wherein, the page data includes style tags of text nodes, image storage, paths, and image-text grouping information;

[0029] The task execution module is used to create queue tasks based on the page data and execute the queue tasks; wherein, the queue tasks include container tasks, rich text tasks, and image-text tasks, the container tasks are used to generate container controls in the window of the graphical user interface based on the image-text grouping information; the rich text tasks are used to generate a list of text styles based on the style tags of text nodes, and add the list of text styles and corresponding text to the corresponding container controls; the image-text tasks are used to obtain images based on the image storage path, and add the images to the corresponding container controls;

[0030] The display module is used to execute the container control and present the execution result of the container control in WPF format in the window of the graphical user interface.

[0031] Thirdly, this application also provides an app store system, the system comprising:

[0032] Acquisition device, used to acquire web pages containing application information;

[0033] A webpage translation device for implementing the webpage translation method described in the first aspect above.

[0034] Fourthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the webpage translation method described in the first aspect.

[0035] Fifthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the webpage translation method described in the first aspect.

[0036] The aforementioned webpage translation method, apparatus, app store system, device, and medium generate container controls based on the image and text grouping information in the page data. These container controls ensure that the positions of text and images presented on the WPF side correspond to those on the web page. Furthermore, by obtaining image text and text styles from the page data and placing these elements into the corresponding container controls, the WPF side can accurately present text and images consistent with the web page. This webpage translation method in this embodiment solves the problem of low content fidelity in WPF presentation after converting webpage content to WPF format, thus improving the fidelity of format conversion. Attached Figure Description

[0037] Figure 1 This is a diagram illustrating the application environment of a webpage translation method in one embodiment;

[0038] Figure 2 This is a flowchart illustrating a webpage translation method in one embodiment;

[0039] Figure 3 This is a flowchart illustrating the process of translating web content into WPF content in one embodiment;

[0040] Figure 4 This is a flowchart illustrating the execution of a rich text task in one embodiment;

[0041] Figure 5 This is a structural block diagram of a webpage translation device in one embodiment;

[0042] Figure 6 This is a structural block diagram of an app store system in one embodiment;

[0043] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0045] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of a terminal for a webpage translation method according to an embodiment of this application. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.

[0046] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the webpage translation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0047] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0048] In one embodiment, such as Figure 2 As shown, a webpage translation method is provided. This embodiment illustrates the method's application to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0049] Step S201: Obtain page data; wherein, the page data includes style tags for text nodes, image storage paths, and image-text grouping information.

[0050] The page data refers to the web page content obtained as a data stream. Optionally, a request is made to communicate with the web client to obtain the data stream corresponding to the web page content, thus obtaining the page data. The page data includes image storage paths, image and text grouping information, rich text, and other data information. The rich text in the page data is converted into a document object model to obtain multiple nodes of the page and their corresponding style tags.

[0051] Step S202: Generate a container control in the form of the graphical user interface based on the image and text grouping information.

[0052] The grouping information for text and images includes the combination relationship between text and images on the web page, the position information of the text within the combination, and the position information of the image within the combination. A form in the graphical user interface (GUI) is a presentation control used to hold other controls, allowing users to interact with the data presented by the GUI based on the form. Container controls are used to present text, images, etc.

[0053] Step S203: Generate a text style list based on the style tags of the text nodes, and add the text style list and corresponding text to the corresponding container control.

[0054] The style tag for a text node is the `style` attribute of the element within that text node. Style tags include text size, font color, text background color, font formatting, etc. Optionally, after generating a list of text styles based on the visited nodes, the corresponding container control is determined based on the grouping information of the text and images. The list of text styles corresponding to that node and the text itself are then added to the corresponding container control.

[0055] Step S204: Obtain the image according to the image storage path and add the image to the corresponding container control.

[0056] The image storage path indicates the location where the image is stored, and the image can be downloaded based on the image storage path. Optionally, after downloading the image based on the image storage path, a container control corresponding to the image is determined based on the grouping information of the text and the image.

[0057] Step S205: Execute the container control and present the execution result of the container control in WPF format on the graphical user interface form. Executing the container control includes operations such as activating and starting the control.

[0058] In the above webpage translation method, container controls are generated based on the grouping information of text and images in the HTML page data. These container controls ensure that the positions of text and images presented in the graphical user interface correspond to those on the web page. Image text and text styles are obtained from the HTML page data. By placing the images, text, and text styles into the corresponding container controls, the WPF client can accurately present WPF format text and images consistent with the web page. The webpage translation method in this embodiment solves the problem of low content fidelity on the WPF client after converting webpage content to WPF format, thus improving the fidelity of format conversion.

[0059] In one embodiment, generating container controls in a graphical user interface window based on grouping information includes: determining the number of container controls based on the number of groups; determining the style of the container controls based on the relative position information of text and images within the groups; and determining the arrangement position of the multiple container controls based on the relative position information between the multiple groups.

[0060] The groups of texts and images are in one-to-one correspondence with the number of container controls. The relative position information of the texts and images within each group is obtained according to the relative positions of the texts and images in the page layout, and the relative position information may be information such as "image on the left and text on the right", "image at the upper right and text at the lower left", and the like. In the grouping of texts and images, the paragraph where the text is located and the image may be in any one of a one-to-one relationship, a one-to-many relationship, a many-to-one relationship, or a many-to-many relationship. For example, if a group includes a piece of text and an image, and the relative position information of the text and the image is image on top and text below, a container control shaped like the Chinese character "日" is generated, wherein the upper area is used for presenting the image in the group, and the lower area is used for presenting the text in the group. If a group includes two pieces of text and two images, and the relative position information of the texts and the images is image on the left and text on the right, a container control shaped like the Chinese character "田" is generated, wherein the left area is used for presenting the images in the group, and the right area is used for presenting the texts in the group. If the page includes multiple groups, the positions of the container controls in the form are in one-to-one correspondence with the positions of the groups in the web page.

[0061] In one embodiment, determining the style of the container control according to the relative position information of the texts and images within the group comprises: generating a first area according to the range occupied by the text in the web page; generating a second area according to the range occupied by the image in the web page; and combining the first area and the second area according to the relative positions of the text and the image.

[0062] The range occupied by the text in the web page is acquired, and the range of the text is scaled according to a preset proportion to obtain the range occupied by the first area in the window. The range occupied by the image in the web page is acquired, and the range of the image is scaled according to a preset proportion to obtain the range occupied by the second area in the window. The relative positions of the first area and the second area in the container control are consistent with the relative positions of the texts and images within the group.

[0063] In one embodiment, generating a text style list according to the style tags of text nodes comprises: traversing the style tags of the text nodes to obtain the text styles corresponding to the style tags; and recording the text styles in the style list according to the traversal order.

[0064] The `style` attribute of an element within a text node carries text styles, including but not limited to font size, font color, background color, and font formatting. The style list records the text styles specified in the `style` tags based on recursive logic. Optionally, it iterates through the text styles corresponding to the `style` tags in the current text node, recording these styles in the style list according to the iteration order, until no unretrieved style tags remain in the current text node. The text styles recorded in the style list are then added to the corresponding container control, the style list is cleared, and the process continues to the next node, until all nodes have been traversed.

[0065] In one embodiment, before traversing the style tags of the nodes, the method further includes: determining whether the style tags of the text nodes contain sorting information; if it is determined that the style tags of the text nodes contain sorting information, recording the sorting information in the style list.

[0066] The sorting information is located before the paragraph containing the text and includes ordered and unordered sorting information. Ordered sorting information is used to indicate the order of multiple text paragraphs, such as "1", "2", "3", "1)", "2)", "3)", etc. Unordered sorting information is used to mark the beginning position of a text paragraph, and there is no logical relationship between multiple unordered sorting information, such as "●", "○", "■", etc.

[0067] Optionally, when the text node is reached, the style attribute of the element in the text node is obtained, and it is determined whether the style attribute contains sorting information. If sorting information is contained, the sorting information is recorded in the style list.

[0068] In one embodiment, obtaining page data includes: establishing communication with the page based on a preset data format to obtain the page data.

[0069] The preset data format defines the format of the data stream acquired during communication. This preset data format includes image storage paths and grouping information for text and images. Optionally, an HTTP communication request is initiated to the page. If HTTP communication is established, the page's source code is obtained as a data stream. The page's source code is then parsed based on the preset data format to obtain page data conforming to the preset data format.

[0070] Traditionally, web pages are embedded in WPF to display web content. However, since WPF's built-in web page embedding uses the IE engine, protocol authentication can take several minutes, which is time-consuming. This embodiment obtains the data stream via HTTP communication, which is much faster, and the token verification during communication ensures the security of data transmission.

[0071] In one embodiment, a flowchart illustrating the translation of web content into WPF content is disclosed, such as... Figure 3 As shown, it includes the following steps:

[0072] Step S301: Define the data format;

[0073] Step S302: Start the worker thread;

[0074] Step S303: Obtain HTML page data. The HTML page data includes the HTML page's data structure and rich text. The data structure includes image storage paths, text and image grouping information, etc.; the rich text includes text, style tags for text nodes, etc.

[0075] Step S304: Create a queue task based on the HTML page data.

[0076] The data format is a preset format. Based on this preset format, it can retrieve the module name and module name from an HTML page, as well as the relative positions of text and images within the module, and text and image information. The relative positions of text and images include composition (formatting) and grouping information. Composition indicates the relative positions of text and images, such as "image above text." Grouping information indicates the correspondence between text and images. Text information includes rich text and style tags. Image information includes image storage paths and captions.

[0077] The queue tasks include: container tasks, rich text tasks, and image-text tasks. Container tasks create container types based on templates; the templates indicate the correspondence between container control styles and container types, the correspondence between the arrangement of container controls and the relative positions of text and images within image-text groups, and the relative positions of multiple container controls and image-text groups. Rich text tasks translate and add to containers, meaning translating rich text into text based on WFP format and adding the translated text to the corresponding container. Image-text tasks asynchronously download placeholder images and add the downloaded images and their corresponding captions to containers.

[0078] Figure 5 This is a flowchart illustrating the process of performing rich text tasks. For example... Figure 5 As shown, it includes the following steps:

[0079] Step S401: Create a rich text container, TextBlock;

[0080] Step S402: Convert the rich text in HTML format into a document object model in XML format;

[0081] Step S403: Traverse the child nodes under the root node of the document object model;

[0082] Step S404: Determine whether the rich text paragraph of the current node contains sorting information; if yes, proceed to step S405; otherwise, proceed to step S406.

[0083] Step S405: Add a prefix number before the rich text paragraph according to the sorting information. The prefix number is obtained based on the sorting information and can be a number or a shape.

[0084] Step S406: Create a new style list;

[0085] Step S407: Traverse the nodes under the rich text paragraph and add the text style corresponding to the style tag in the current node to the style list;

[0086] Step S408: Determine if the current node is a text node. If yes, proceed to step S409; otherwise, traverse the next node and proceed to step S407.

[0087] Step S409: Create a run method based on the style list and add it to the rich text container TextBlock; then clear the style list.

[0088] Step S410: Determine whether there are any untraversed rich text paragraphs; if yes, execute step S408 for the untraversed rich text paragraphs; if no, execute step S411.

[0089] Step S411: Add the rich text to the rich text container TextBlock.

[0090] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0091] Based on the same inventive concept, this application also provides a webpage translation device for implementing the webpage translation method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more webpage translation device embodiments provided below can be found in the limitations of the webpage translation method described above, and will not be repeated here.

[0092] In one embodiment, such as Figure 6 As shown, a webpage translation device is provided, which includes an acquisition module, a task execution module, and a display module.

[0093] The acquisition module is used to acquire the agreed-upon data format and obtain the page data according to the agreed-upon data format; the page data includes style tags for text nodes, image storage, paths, and image-text grouping information;

[0094] The task execution module is used to create queue tasks based on page data and execute them. These queue tasks include container tasks, rich text tasks, and image-text tasks. Container tasks generate container controls in the graphical user interface form based on image-text grouping information. Rich text tasks generate a list of text styles based on the style tags of text nodes and add the text style list and corresponding text to the corresponding container controls. Image-text tasks retrieve images based on their storage paths and add them to the corresponding container controls.

[0095] The display module is used to execute container controls and present the execution results of container controls in WPF format on the form of the graphical user interface.

[0096] Each module in the aforementioned webpage translation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0097] Based on the same inventive concept, embodiments of this application also provide an application store system for implementing the webpage translation method described above, such as... Figure 7 As shown, the app store system includes: an acquisition device for acquiring web pages containing application information; and a web page translation device for implementing the steps in the above method embodiments.

[0098] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface and display unit are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a webpage translation method. The display unit is used to form a visually visible image and can be an imaging device such as a display screen or a projection device. The display screen can be a liquid crystal display (LCD) or an electronic ink display.

[0099] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0100] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments. In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the above-described method embodiments.

[0101] It should be noted that the data involved in this application (including but not limited to data used for analysis, data stored, data displayed, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0103] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0104] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for web page translation, the method comprising: The method includes: Obtain page data; wherein, the page data includes image storage path, image and text grouping information, and rich text; the rich text includes text and style tags for text nodes; Based on the image and text grouping information, a container control is generated in the form of the graphical user interface; Based on the style tags of the text nodes, generate a list of text styles, and add the list of text styles and the corresponding text to the corresponding container control; The image is obtained according to the image storage path, and the image is added to the corresponding container control; Execute the container control and present the execution result of the container control in WPF format on the form of the graphical user interface; Based on the style tags of the text nodes, a list of text styles is generated, and the list of text styles and the corresponding text are added to the corresponding container controls, including: Iterate through the text styles corresponding to the style tags in the current text node, and record the text styles to the style list according to the traversal order; Add the text styles recorded in the style list to the corresponding container control, clear the style list, and iterate through the next node until all nodes have been traversed. Before iterating through the style tags of the nodes, the method also includes: Determine whether the style tags of a text node contain sorting information; If it is determined that the style tag of a text node contains sorting information, the sorting information is recorded in the style list; Retrieve page data, including: Establish communication with the page based on a preset data format to obtain the page data; Based on the image and text grouping information, a container control is generated in the form of the graphical user interface, including: The number of container controls is determined based on the number of image and text groups; The style of the container control is determined based on the relative position information between the text and images within the group of the image and text group; The arrangement position of the multiple container controls is determined based on the relative position information between the multiple graphic groups.

2. The method according to claim 1, characterized in that, Based on the relative position information of the text and images within the group, the style of the container control is determined, including: A first region is generated based on the area occupied by the text on the webpage; A second region is generated based on the area occupied by the image on the webpage; The first region and the second region are combined based on the relative positions of the text and the image.

3. A webpage translation device, characterized in that, The device includes an acquisition module, a task execution module, and a display module; wherein... The acquisition module is used to acquire a pre-defined data format and obtain page data according to the pre-defined data format; wherein, the page data includes a data structure and rich text; the rich text includes text and style tags for text nodes; the data structure includes image storage paths and image-text grouping information; the acquisition module is also used to establish communication with the page based on a preset data format and acquire the page data; The task execution module is used to create queue tasks based on the page data and execute the queue tasks, wherein the queue tasks include container tasks, rich text tasks, and image-text tasks; the container tasks are used to generate container controls in the window of the graphical user interface based on the image-text grouping information; the rich text tasks are used to generate a text style list based on the style tags of text nodes and add the text style list and corresponding text to the corresponding container controls; the image-text tasks are used to obtain images based on the image storage path and add the images to the corresponding container controls; The display module is used to execute the container control and present the execution result of the container control in WPF format on the form of the graphical user interface. The process of performing the rich text task includes: Step S401: Create a rich text container; Step S402: Convert the rich text in HTML format into a document object model in XML format; Step S403: Traverse the child nodes under the root node of the document object model; Step S404: Determine whether the rich text paragraph of the current node contains sorting information; if yes, proceed to step S405; otherwise, proceed to step S406. Step S405: Add a prefix number before the rich text paragraph according to the sorting information; Step S406: Create a new style list; Step S407: Traverse the nodes under the rich text paragraph and add the text style corresponding to the style tag in the current node to the style list; Step S408: Determine whether the current node is a text node; if yes, proceed to step S409; otherwise, traverse the next node and proceed to step S407. Step S409: Create a run method based on the style list and add it to the rich text container; then clear the style list. Step S410: Determine whether there are any untraversed rich text paragraphs; if yes, execute step S408 for the untraversed rich text paragraphs; if no, execute step S411. Step S411: Add the rich text to the rich text container; Based on the image and text grouping information, a container control is generated in the form of the graphical user interface, including: The number of container controls is determined based on the number of text and image groups. The style of the container controls is determined based on the relative position information between the text and images within the text and image groups. The arrangement of the container controls is determined based on the relative position information between multiple text and image groups.

4. An app store system, characterized in that, The system includes: Acquisition device, used to acquire web pages containing application information; A web page translation device for implementing the steps of the method according to any one of claims 1 to 2.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 2.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Webpage printing method and device

    CN113360106A