A method and device for online previewing of multi-format files on a webpage end and a medium

By receiving binary file streams uploaded by clients, calling the file server API to generate absolute path addresses and querying preview strategies, efficient online previewing of multi-format files is achieved, solving the problem of low efficiency in existing technologies and improving user experience.

CN117216433BActive Publication Date: 2025-10-24LANGCHAO GONGCHUANG (SHANDONG) SUPPLY CHAIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311180180.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2025-10-24
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

Existing technologies are inefficient for online previewing of multiple file formats, resulting in a poor user experience, and downloaded files consume local memory space.

Method used

By receiving the binary file stream uploaded by the client, calling the file server API interface, generating a temporary absolute path address of the file, and querying the corresponding preview strategy according to the file format, the file is displayed online on the client.

Benefits of technology

Improved the efficiency of online preview of multi-format files, improved user experience, and reduced download and storage requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216433B_ABST
    Figure CN117216433B_ABST
Patent Text Reader

Abstract

The application discloses a webpage-oriented multi-format file online preview method and device, and a medium. The method comprises the following steps: receiving a binary file stream uploaded by a client, and calling an interface of a file server; receiving file information returned by the file server; returning the file information to the client; receiving an online preview request for the file initiated by the client, calling an interface of the file server, and sending a relative path address to the file server; the file server generates a temporary absolute path address of the file at the current time according to the relative path address; receiving response information returned by the file server; the response information comprises a file name, a file type and an absolute path address of the file; intercepting the suffix of the absolute path address, determining the file format of the file according to the suffix; querying a file preview strategy of the file format; and displaying the file online according to the file preview strategy and the response information. The online preview efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the computer technical field, and particularly relates to a multi-format file online preview method for a webpage end, equipment and medium. BACKGROUND

[0002] In the mainstream business process and business development, a large number of contract files, other attachments, data file uploading and the like are involved. These document data can be various file formats, such as pictures, pdf, word, excel and the like.

[0003] At present, when a webpage is viewed by a client, a part of the webpage is viewed by clicking a file link to download the file for viewing. However, when the business volume is complex and a large number of business files are involved, it is time-consuming to download and view the files one by one, the user experience of the system is greatly reduced, and the downloaded documents also occupy a large amount of local memory space. Another part is the description of online preview for a single file type. In the face of the current actual business multi-file format viewing demand, the developer needs to practice each document type one by one and then summarize the use, and the development practice is difficult, and the online preview efficiency is low.

[0004] Therefore, a more efficient multi-format file online preview technical solution is urgently needed. SUMMARY

[0005] The embodiment of the present application provides a multi-format file online preview method for a webpage end, equipment and medium, and solves the problem of the urgent need for a more efficient multi-format file online preview technical solution.

[0006] The embodiment of the present application adopts the following technical solution:

[0007] In one aspect, the embodiments of the present application provide a method for receiving a binary file stream uploaded by a client, calling an API interface of a file server according to the binary file stream, receiving file information returned by the file server, the file information including a relative path address of the file, a temporary absolute path address of the file, and a file name, returning the file information to the client, receiving an online preview request for the file initiated by the client, calling an API interface of the file server, sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at a current time according to the relative path address, receiving response information returned by the file server, the response information including the file name, the file type, and the absolute path address, intercepting a suffix of the absolute path address, determining a file format of the file according to the suffix, querying a file preview strategy corresponding to the file format, and displaying the file online on a web page of the client according to the file preview strategy and the response information.

[0008] In one example, after the API interface of the file server is called according to the binary file stream, the method further includes: the file server generates a relative path address of the file according to the binary file stream and file information including the relative path address, sends the file information to the business server for the first time, judges whether feedback information of the business server is received within a preset time period, the feedback information is used to indicate whether the file information is received by the business server, if not, the file information is sent to the business server for the second time, and if the feedback information of the business server is not received for the second time within the preset time period, an exception notification information is generated and sent to a management user terminal.

[0009] In one example, so that the file server generates a temporary absolute path address of the file at a current time according to the relative path address, specifically includes: the file server matches the relative path address in a file database, if the matching is successful, the temporary absolute path address of the file at the current time is generated, and the suffix of the absolute path address includes a current time stamp.

[0010] In one example, before the querying the file preview strategy corresponding to the file format, the method further comprises: determining a plurality of sample file formats; the sample file formats include picture type, PDF type, word document type, and excel document type; constructing a file preview strategy corresponding to each sample file format; establishing a mapping relationship between each sample file format and the corresponding file preview strategy to construct a file preview strategy mapping relationship table; and querying the file preview strategy corresponding to the file format, specifically comprising: matching the file format in the file preview strategy mapping relationship table to obtain a matched file format; and obtaining the file preview strategy according to the matched file format.

[0011] In one example, the file format is a picture type, and the online display of the file according to the file preview strategy and the response information specifically comprises: setting the src attribute of an img tag to the absolute path address to call the file from the file server; and displaying the file in a picture format based on the response information.

[0012] In one example, the file format is a PDF type, and the display of the file according to the file preview strategy and the response information specifically comprises: obtaining the file page number of the file; setting the src attribute of a pre-constructed PDF component to the absolute path address to call the file from the file server; and displaying the file in a PDF format based on the response information, and flipping the file for preview according to the PDF component and the file page number.

[0013] In one example, the file format is a word type, and the display of the file according to the file preview strategy and the response information specifically comprises: calling the file from the file server according to the absolute path address, converting the file into a file in a type array format with a preset number of bits; inputting the file in the type array format with the preset number of bits as an input parameter into a Convert to Html method provided by a mammoth plug-in to convert the file into an html resource, and displaying the file in a word format according to the response information.

[0014] In an example, the file format is an excel type, and the displaying the file according to the file preview strategy and the response information specifically includes: calling the file from the file service end according to the absolute path address, converting the file into a file in a preset bit number type array format according to an xlsx plug-in; parsing the file in the preset bit number type array format to obtain file content; and displaying the file content in a client-side excel format according to an online table component and the response information.

[0015] In another aspect, the embodiments of the present application provide a multi-format file online preview device for a web page end, applied to a business service end, including: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: receive a binary file stream uploaded by a client, and call an API interface of a file service end according to the binary file stream; receive file information of a file returned by the file service end, the file information including a relative path address, a temporary absolute path address, and a file name of the file; return the file information to the client; receive an online preview viewing request for the file initiated by the client, call an API interface of the file service end, and send the relative path address to the file service end, so that the file service end generates a temporary absolute path address of the file at a current time according to the relative path address; receive response information returned by the file service end; the response information including the file name, the file type, and the absolute path address of the file; intercept a suffix of the absolute path address, determine a file format of the file according to the suffix; query a file preview strategy corresponding to the file format; and display the file online on a web page of the client according to the file preview strategy and the response information.

[0016] In another aspect, the embodiment of the present application provides a nonvolatile computer storage medium for online previewing of multi-format files on a webpage end, which stores computer executable instructions, and the computer executable instructions are configured to: receive a binary file stream uploaded by a client, and call an API interface of a file server according to the binary file stream; receive file information returned by the file server for the file, the file information including a relative path address, a temporary absolute path address, and a file name of the file; return the file information to the client; receive an online previewing request for the file initiated by the client, call an API interface of the file server, and send the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at a current time according to the relative path address; receive response information returned by the file server; the response information including the file name, the file type, and the absolute path address of the file; intercept a suffix of the absolute path address, determine a file format of the file according to the suffix; query a file previewing strategy corresponding to the file format; and display the file online on a web page of the client according to the file previewing strategy and the response information.

[0017] The above at least one technical solution adopted by the embodiment of the present application can achieve the following beneficial effects:

[0018] The file information returned by the file server is received, so that when the online previewing request for the file initiated by the client is received, the temporary absolute path address of the file at the current time is generated by the file server, regardless of the file format, so that the corresponding file previewing strategy is matched from the pre-constructed multiple file previewing strategies, and the file is displayed online based on the file previewing strategy. Compared with the file viewing method of downloading and storing, the viewing efficiency can be greatly improved, and the user viewing experience is greatly improved. Compared with the online previewing method supporting only a single format file, only a small amount of code is used to realize the online previewing function supporting multiple format files, and the online previewing efficiency can be quickly improved. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the present application, some embodiments of the present application will be described in detail below with reference to the accompanying drawings, in which:

[0020] Figure 1 A flowchart of a multi-format file online previewing method for a webpage end provided by the embodiment of the present application;

[0021] Figure 2 A structural diagram of a multi-format file online previewing device for a webpage end provided by the embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in a clear and complete manner with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0023] Some embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0024] Figure 1 A flowchart of a method for online previewing of multi-format files on a webpage provided by an embodiment of the present application is shown in FIG. 1. The method can be applied to different business fields, such as the Internet financial business field, the e-commerce business field, the instant messaging business field, the game business field, the public service business field, etc. Some input parameters or intermediate results in the flowchart allow manual intervention for adjustment, so as to help improve the accuracy.

[0025] Figure 1 The flowchart in FIG. 1 can include the following steps:

[0026] S101: A business service end receives a binary file stream uploaded by a client end, and calls an API interface to a file service end according to the binary file stream.

[0027] In the method, a user uploads a file in an interface of the client end, so that the client end uploads the binary file stream to the business service end.

[0028] S102: File information for the file returned by the file service end is received, the file information including a relative path address of the file, a temporary absolute path address, and a file name; and the file information is returned to the client end.

[0029] In some embodiments of the present application, after the business service end uploads the binary file stream to the file service end, the file service end generates a relative path address for the file and file information including the relative path address according to the binary file stream.

[0030] It should be noted that the file service end saves the file and the file information of the file to a file database.

[0031] Then, the file information is sent to the business service end, so that the business service end receives the file information for the file returned by the file service end.

[0032] It should be noted that when the file server sends the file information to the business server, there is a possibility of sending failure, for example, the transmission network is interrupted, or the business server fails, or the file server fails.

[0033] Based on this, the business server will send feedback information indicating that the file information is received successfully to the file server after receiving the file information returned by the file server.

[0034] Therefore, after the file server sends the file information to the business server for the first time, it is determined whether the feedback information of the business server is received within a predetermined time. The feedback information is used to indicate whether the business server receives the file information.

[0035] If yes, the second sending is not performed. If no, the file information is sent to the business server for the second time.

[0036] If the feedback information of the business server is not received for the second time within a predetermined time, an abnormal notification information is generated and sent to the management user terminal. If the feedback information of the business server is received for the second time, the abnormal notification information is not generated.

[0037] S103: Receive the online preview request initiated by the client for the file, call the API interface of the file server, and send the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address.

[0038] In some embodiments of the present application, when generating the temporary absolute path address of the file at the current time, the file server matches the relative path address in the file database when the API interface is called.

[0039] If the matching is successful, the temporary absolute path address of the file at the current time is generated. The suffix of the absolute path address includes the current timestamp. In addition, the response information returned to the business server for the file is also generated.

[0040] It should be noted that the absolute path address is related to the generation time. If it is an absolute path address of the file before the current time, it is considered as an invalid absolute path address.

[0041] That is, since the relative path address of the file of the business server may be tampered, after being tampered, the same relative path address cannot be found in the file database. Therefore, by matching the relative path address, the security of the file can be improved.

[0042] Based on this, if the matching fails, the service server returns a call failure notification information.

[0043] S104: receiving the response information returned by the file server; the response information includes the file name, file type, and absolute path address of the file.

[0044] S105: intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix.

[0045] That is, the absolute path address suffix includes the file format, and in addition, only after obtaining the absolute path address of the file, the file can be previewed on the browser webpage of the client.

[0046] S106: querying the file preview strategy corresponding to the file format.

[0047] In some embodiments of the present application, a plurality of file preview strategies of file formats need to be constructed in advance, and each file preview strategy is independent and mutually exclusive.

[0048] Specifically, a plurality of sample file formats are determined. Wherein, the sample file format includes picture type, PDF type, word document type, and excel document type.

[0049] Construct a file preview strategy corresponding to each sample file format.

[0050] Establish a mapping relationship between each sample file format and the corresponding file preview strategy to construct a file preview strategy mapping relationship table.

[0051] Based on this, the file preview strategy corresponding to the file format is queried, which specifically includes:

[0052] In the file preview strategy mapping relationship table, the file format is matched to obtain the matched file format. Then, according to the matched file format, the file preview strategy is obtained.

[0053] S107: displaying the file online on the web page of the client according to the file preview strategy and the response information.

[0054] Based on this, when the file format is a picture type, the src attribute of the img tag is set to the absolute path address to call the file from the file server. Then, based on the response information, the file is displayed in a picture format.

[0055] When the file format is of the pdf type, the file page number of the file is obtained. Then, the src attribute of the pre-constructed pdf component is set to the absolute path address to call the file from the file server. For example, the pdf component is provided by vue-pdf-signature-5. Finally, the file is displayed in the PDF format based on the response information, and the file is previewed based on the pdf component and the file page number.

[0056] When the file format is of the word type, the file is converted into a file of the type array format with a preset number of bits based on the absolute path address to call the file from the file server. For example, the input parameter needs to be a type array file format with 8 bits. The type array format is arrayBuffer.

[0057] The file is converted into an html resource by inputting the file of the type array format with a preset number of bits as an input parameter of the Convert to Html method provided by the mammoth plug-in, and the file is displayed in the word format based on the response information.

[0058] When the file format is of the excel type, the file is converted into a file of the type array format with a preset number of bits based on the absolute path address to call the file from the file server. Then, the file of the type array format with a preset number of bits is parsed to obtain the file content. Finally, the file content is displayed in the excel format of the client based on the online table component and the response information.

[0059] It should be noted that the table form of the file can be changed into the excel format template of the client, but the content of the file remains unchanged

[0060] It should be noted that if the file is temporarily uploaded and viewed by the client, the file information does not need to be saved to the database of the business server.

[0061] However, in order to facilitate the next business operation or file viewing, or in the case that other users can click to view on other clients, the client needs to click the save button after online previewing, so that the business server saves the relative path to the database of the business server.

[0062] When other clients click to view the page, the business server queries the corresponding relative file path from the database and returns the relative file path to other clients. Other clients obtain the relative file path and display the file name.

[0063] When other clients click to view again, a request is sent to the business server, the business server calls the file method of the file server, and the absolute path is returned to other clients for display.

[0064] It should be noted that although the embodiments of the present application are introduced and described in sequence with reference to Figure 1 steps S101 to S107, this does not mean that steps S101 to S107 must be executed in strict sequence. The embodiments of the present application introduce and describe steps S101 to S107 in sequence as shown in Figure 1 order to facilitate the understanding of the technical solutions of the embodiments of the present application by those skilled in the art. In other words, in the embodiments of the present application, the sequence of steps S101 to S107 can be adjusted as needed.

[0065] By the method, Figure 1 the file information returned by the file service end for the file is received, so that when the online preview viewing request for the file initiated by the receiving client is received, the temporary absolute path address of the file at the current time can be generated by the file service end, regardless of the file format, so that the corresponding file preview strategy can be matched in the pre-constructed multiple file preview strategies, so that the file can be displayed online based on the file preview strategy. Compared with the file viewing method of downloading and storing, the viewing efficiency can be greatly improved, and the user viewing experience can be greatly improved. Compared with the online preview method supporting only a single format file, only a small amount of code is used to realize the function of supporting online preview of multiple format files, which can quickly improve the online preview efficiency.

[0066] Based on the same idea, some embodiments of the present application also provide a device and a non-volatile computer storage medium corresponding to the above method.

[0067] Figure 2 A structure diagram of a multi-format file online preview device for a web end provided by an embodiment of the present application is applied to a business service end, and the device comprises:

[0068] at least one processor; and

[0069] a memory in communication connection with the at least one processor; wherein

[0070] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0071] receive a binary file stream uploaded by a client, and call an API interface to a file service end according to the binary file stream;

[0072] receiving file information returned by the file server, the file information including a relative path address, a temporary absolute path address, and a file name of the file;

[0073] receiving an online preview viewing request initiated by the client for the file, calling an API interface of the file server, and sending the relative path address to the file server so that the file server generates a temporary absolute path address of the file at a current time according to the relative path address;

[0074] receiving response information returned by the file server; the response information including a file name, a file type, and the absolute path address of the file;

[0075] extracting a suffix of the absolute path address, and determining a file format of the file according to the suffix;

[0076] querying a file preview strategy corresponding to the file format;

[0077] displaying the file on a web page of the client according to the file preview strategy and the response information.

[0078] Some embodiments of the present application provide a non-volatile computer storage medium for online preview of a multi-format file on a web page, which stores computer executable instructions applied to a business server, and the computer executable instructions are configured to:

[0079] receiving a binary file stream uploaded by the client, and calling an API interface of a file server according to the binary file stream;

[0080] receiving file information returned by the file server, the file information including a relative path address, a temporary absolute path address, and a file name of the file;

[0081] receiving an online preview viewing request initiated by the client for the file, calling an API interface of the file server, and sending the relative path address to the file server so that the file server generates a temporary absolute path address of the file at a current time according to the relative path address;

[0082] receiving response information returned by the file server; the response information including a file name, a file type, and the absolute path address of the file;

[0083] extracting a suffix of the absolute path address, and determining a file format of the file according to the suffix;

[0084] query a file preview policy corresponding to the file format;

[0085] display the file according to the file preview policy and the response information on a web page of the client.

[0086] The various embodiments in the present application are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment mainly describes the difference from other embodiments. Especially, the device and medium embodiments are described simply because they are basically similar to the method embodiments, and the related parts can be referred to the description of the method embodiments.

[0087] The device and medium provided by the embodiments of the present application are one-to-one corresponding to the method, and therefore, the device and medium also have the similar beneficial technical effects as the method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device and medium will not be described here.

[0088] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0089] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams 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 apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus for performing the functions specified in one or more flows and / or blocks.

[0090] These computer program instructions can also be stored in a computer-readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1the function(s) specified in the block or blocks.

[0091] These computer program instructions can also be loaded into computer or other programmable data processing devices to cause a series of operational steps to be performed on the computer or other programmable devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable devices provide steps for implementing the flowchart block(s) or flowchart flow(s) and / or portions thereof. Figure 1 the flowchart flow(s) and / or portions thereof. Figure 1 the function(s) specified in the block or blocks.

[0092] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0093] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the computer stores information about an operating system, application software, and / or the like. Memory is an example of computer readable media.

[0094] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to computing devices. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.

[0095] It should also be noted that the terms "comprising", "including", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article or apparatus that includes the recited element.

[0096] The above merely provides an example of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the technical principles of the present application should fall into the protection scope of the present application.

Claims

1. A method for online previewing of multi-format files on a web page, characterized in that, The method comprises: The business service end receives the binary file stream uploaded by the client, calls the API interface of the file service end according to the binary file stream; Receiving the file information returned by the file service end for the file, the file information including the relative path address, the temporary absolute path address, the file name of the file; return the file information to the client; Receiving the online preview viewing request initiated by the client for the file, calling the API interface of the file service end, sending the relative path address to the file service end, so that the file service end generates the temporary absolute path address of the file at the current time according to the relative path address; Receiving the response information returned by the file service end; the response information includes the file name, file type and absolute path address of the file; Extracting the suffix of the absolute path address, and determining the file format of the file according to the suffix; Querying the file preview strategy corresponding to the file format; Displaying the file on the web page of the client according to the file preview strategy and the response information; After calling the API interface of the file service end according to the binary file stream, the method further comprises: The file service end generates a relative path address for the file according to the binary file stream, and file information containing the relative path address; the file information is sent to the business service end for the first time; Within a preset time period, it is judged whether the feedback information of the business service end is received; the feedback information is used to indicate whether the file information is received by the business service end; If not, the file information is sent to the business service end for the second time; If the feedback information of the business service end is not received for the second time within the preset time period, an exception notification information is generated and sent to the management user terminal; So that the file service end generates the temporary absolute path address of the file at the current time according to the relative path address, specifically comprising: The file service end matches the relative path address in the file database; If the matching is successful, the temporary absolute path address of the file at the current time is generated; the suffix of the absolute path address includes the current timestamp; Before querying the file preview strategy corresponding to the file format, the method further comprises: Determine a plurality of sample file formats; sample file formats include picture type, PDF type, word document type and excel document type; Constructing the file preview strategy corresponding to each sample file format respectively; Establishing the mapping relationship between each sample file format and the corresponding file preview strategy to construct the file preview strategy mapping relationship table; Querying the file preview strategy corresponding to the file format, specifically comprising: matching the file format in the file preview strategy mapping relationship table to obtain the matched file format; According to the matched file format, the file preview strategy is obtained. ​ 2. The method of claim 1, wherein, The file format is a picture type, and the online display of the file according to the file preview strategy and the response information specifically includes: The src attribute of the img tag is set to the absolute path address to call the file from the file server; Based on the response information, the file is displayed in a picture format.

3. The method of claim 1, wherein, The file format is a pdf type, and the display of the file according to the file preview strategy and the response information specifically includes: Obtaining the file page number of the file; The src attribute of the pre-constructed pdf component is set to the absolute path address to call the file from the file server; Based on the response information, the file is displayed in a PDF format, and the file is previewed according to the pdf component and the file page number.

4. The method of claim 1, wherein, The file format is a word type, and the display of the file according to the file preview strategy and the response information specifically includes: According to the absolute path address, the file is called from the file server, and the file is converted into a file in a preset bit type array format; By inputting the file in the preset bit type array format as an input parameter into the Convert to Html method provided by the mammoth plug-in, the file is converted into an html resource, and the file is displayed in a word format according to the response information.

5. The method of claim 1, wherein, The file format is an excel type, and the display of the file according to the file preview strategy and the response information specifically includes: According to the absolute path address, the file is called from the file server, and the file is converted into a file in a preset bit type array format according to the xlsx plug-in; The file in the preset bit type array format is parsed to obtain file content; According to the online table component and the response information, the file content is displayed in a client-side excel format.

6. An online preview device for a webpage-side multi-format file, characterized by, Applied to a business service end, comprising: At least one processor; and The memory is in communication connection with the at least one processor; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the online preview method of the multi-format file for the web end according to any one of claims 1-5. 7.A non-transitory computer storage medium storing computer-executable instructions for online previewing multi-format files on a web page, the computer-executable instructions comprising instructions for: receiving a request for a preview of a multi-format file; determining a format of the multi-format file; selecting a previewer corresponding to the format of the multi-format file; and causing the selected previewer to generate a preview of the multi-format file. Applied to a business service end, the computer executable instructions are set to execute the online preview method of the multi-format file for the web end according to any one of claims 1-5.

Citation Information

Patent Citations

  • File online preview method and device, computer equipment and storage medium

    CN114611459A

  • Method and device for quickly previewing file through label, network disk and storage medium

    CN116010356A