CN112347737A - Method and device for previewing excel file online, electronic equipment and storage medium - Google Patents

Method and device for previewing excel file online, electronic equipment and storage medium Download PDF

Info

Publication number
CN112347737A
CN112347737A CN202011302184.9A CN202011302184A CN112347737A CN 112347737 A CN112347737 A CN 112347737A CN 202011302184 A CN202011302184 A CN 202011302184A CN 112347737 A CN112347737 A CN 112347737A
Authority
CN
China
Prior art keywords
file
excel file
excel
content
sheet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011302184.9A
Other languages
Chinese (zh)
Inventor
张依
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202011302184.9A priority Critical patent/CN112347737A/en
Publication of CN112347737A publication Critical patent/CN112347737A/en
Priority to PCT/CN2021/123177 priority patent/WO2022105478A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a big data technology, and discloses a method for previewing an excel file on line, which comprises the following steps: acquiring an excel file to be previewed; analyzing the content of the excel file to obtain content data corresponding to the excel file; storing the content data of the excel file into a database; receiving a file online preview request; and searching in a database according to the file online preview request to obtain the content data of the corresponding excel file, and displaying the content data on a pre-constructed page according to a preset format. The invention also provides a device for previewing the excel file online, electronic equipment and a computer readable storage medium. In addition, the invention also relates to a block chain technology, and the content data of the excel file can be stored in the block chain node. The method can realize the function of quickly and efficiently previewing the excel file on line.

Description

Method and device for previewing excel file online, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of big data, in particular to a method and a device for previewing an excel file on line, electronic equipment and a computer readable storage medium.
Background
In a computer network, many data are stored in files, and a user needs a file online preview function in order to ensure that data required by the user is in the files or only needs to view certain data.
The method is characterized in that excel files are important basic files among various files, the existing online preview method of the excel files is mainly characterized in that the excel files are converted into html, PDF and the like and then displayed on a front-end page, other plug-ins need to be loaded for auxiliary display, the efficiency is low, only one excel file can be displayed during display, if a plurality of sheets exist in the excel files, all sheet tables can be displayed in one webpage instead of being displayed in the form of the excel files, and the data viewing by users is not facilitated.
Disclosure of Invention
The invention provides a method and a device for previewing an excel file online, electronic equipment and a computer readable storage medium, and mainly aims to provide a method for previewing an excel file online more quickly and efficiently.
In order to achieve the above object, the method for previewing an excel file on line provided by the invention comprises the following steps:
acquiring an excel file to be previewed;
analyzing the content of the excel file to obtain content data corresponding to the excel file;
storing the content data of the excel file into a database;
receiving a file online preview request;
and searching in a database according to the file online preview request to obtain the content data of the corresponding excel file, and displaying the content data on a pre-constructed page according to a preset format.
Optionally, the analyzing the content of the excel file to obtain the content data corresponding to the excel file includes:
converting the excel file into a binary byte stream;
creating a corresponding object class according to the type of the excel file;
and writing the binary byte stream into the object class, and acquiring the content data of the excel according to the object class.
Optionally, the obtaining content data of the excel according to the object class includes:
circularly traversing a plurality of sheets of the excel by using the object class;
setting a cell style in each sheet page, and reading the content of each sheet page line by line to obtain a plurality of sheet contents corresponding to the plurality of sheets;
collecting the plurality of sheet contents, and inserting a preset separator into each sheet content to obtain the sheet contents of the excel;
acquiring all sheet names of the excel by using the object class, and adding a preset separator behind each sheet name to obtain the sheet name of the excel;
and collecting the sheet content and the sheet name to obtain the content data of the excel.
Optionally, before creating the corresponding object class according to the type of the excel file, the method further includes:
acquiring the file name of the excel file;
acquiring a suffix name of the excel file according to the file name;
when the suffix name is xls, determining that the excel file is an xls file;
when the suffix name is xlsx, determining the excel file as an xlsx file
Optionally, the searching for the corresponding excel file content in the database according to the file online preview request includes:
acquiring a file name in the file online preview request;
searching in a database according to the file name to obtain a result data set;
cutting the sheet name and the sheet content in each piece of data in the result data set according to a preset separator to obtain a plurality of sheet name arrays and a plurality of corresponding sheet content arrays;
and combining the plurality of sheet name arrays and the corresponding plurality of sheet content arrays to obtain the excel file content data.
Optionally, the displaying on the pre-constructed page according to the preset format includes:
acquiring the content data of the excel file;
using preset tags of a double-layer nested loop to perform layout and rendering a page;
and correspondingly displaying the content data of the excel file on a pre-constructed page through a preset label of the double-layer nested loop.
Optionally, the obtaining an excel file to be previewed includes:
when the excel file needing to be previewed is an excel file stored in a server, acquiring a path of the excel file needing to be previewed, and acquiring the excel file needing to be previewed according to the path;
and when the excel file needing to be previewed is the excel file uploaded by the user, acquiring the excel file needing to be previewed by receiving the excel file uploaded by the user.
In order to solve the above problem, the present invention further provides an apparatus for previewing an excel file online, which includes:
the file acquisition module is used for acquiring an excel file to be previewed;
the content analysis module is used for carrying out content analysis on the excel file to obtain content data corresponding to the excel file;
the data storage module is used for storing the content data of the excel file into a database;
the request receiving module is used for receiving a file online preview request;
and the content display module is used for searching and obtaining the content data of the corresponding excel file in a database according to the file online preview request and displaying the content data on a pre-constructed page according to a preset format.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one computer program instruction; and
and the processor executes the computer program instructions stored in the memory to realize the method for previewing the excel file online.
In order to solve the above problem, the present invention further provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the method for previewing an excel file online.
According to the embodiment of the invention, the excel file to be previewed is obtained in advance, the content of the excel file is analyzed to obtain the content data corresponding to the excel file, and the content data of the excel file is stored in the database, so that the excel file is prevented from being analyzed every time, the working efficiency is improved, and the computer resources are saved; meanwhile, after a file online preview request is received, corresponding contents can be directly searched from a database, the method is simple and convenient, multiple excel files can be obtained at one time by obtaining data through the database, multiple sheet page contents in one excel file are obtained, display is performed according to a preset format, the method is clear and concise, and development efficiency can be improved. Therefore, the method, the device and the computer readable storage medium for previewing the excel file online provided by the invention can achieve the purpose of previewing the excel file online quickly and efficiently.
Drawings
Fig. 1 is a schematic flow chart of a method for previewing an excel file online according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of an apparatus for online previewing an excel file according to an embodiment of the present invention;
fig. 3 is a schematic view of an internal structure of an electronic device implementing a method for previewing an excel file online according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a method for previewing an excel file on line. The execution body of the online preview excel file includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the application. In other words, the method for previewing the excel file online can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a schematic flow chart of a method for previewing an excel file on line according to an embodiment of the present invention is shown. In this embodiment, the method for previewing an excel file online includes:
and S1, acquiring the excel file needing to be previewed.
The excel files needing to be previewed in the embodiment of the invention comprise excel files stored in a server and excel files uploaded by a user.
In detail, the acquiring an excel file needing to be previewed includes:
when the excel file needing to be previewed is an excel file stored in a server, acquiring a path of the excel file needing to be previewed, and acquiring the excel file needing to be previewed according to the path;
and when the excel file needing to be previewed is the excel file uploaded by the user, acquiring the excel file needing to be previewed by receiving the excel file uploaded by the user.
In an actual business system, sometimes a user needs to determine that an uploaded file is correct through online preview when uploading the excel file, and sometimes the user needs to determine that a downloaded file is correct when downloading the excel file, so that the excel file to be previewed needs to be acquired respectively according to two conditions.
Optionally, before obtaining the excel file to be previewed, determining the type of the excel file to be previewed further includes: judging the type of the excel file to be previewed through parameters, and when the parameters comprise the excel file, determining the excel file to be previewed as the excel file uploaded by a user; otherwise, determining the excel file needing to be previewed as the excel file stored in the server. Wherein the parameter is parameter data sent by the client.
And S2, analyzing the content of the excel file to obtain content data corresponding to the excel file.
In detail, the S2 includes:
converting the excel file into a binary byte stream;
creating a corresponding object class according to the type of the excel file;
and writing the binary byte stream into the object class, and acquiring the content data of the excel according to the object class.
The type of the excel file comprises an xls file and an xlsx file, and different object classes and different methods are used for obtaining the excel content according to different requirements of the type of the excel file. The object class is an object class which can directly operate an excel file type in java and comprises HSSFWorkBook for operating an xls file and XSSFWorkBook for operating an xlsx file.
Optionally, before creating the corresponding object class according to the type of the excel file, the method further includes: and determining the type of the excel file. The determining the type of the excel file specifically comprises the following steps: acquiring the file name of the excel file; acquiring a suffix name of the excel file according to the file name; when the suffix name is xls, determining that the excel file is an xls file; and when the suffix name is xlsx, determining that the excel file is an xlsx file.
Further, the obtaining of the content data of the excel according to the object class includes:
circularly traversing a plurality of sheets of the excel by using the object class;
setting a cell style in each sheet page, and reading the content of each sheet page line by line to obtain a plurality of sheet contents corresponding to the plurality of sheets;
collecting the plurality of sheet contents, and inserting a preset separator into each sheet content to obtain the sheet contents of the excel;
acquiring all sheet names of the excel by using the object class, and adding a preset separator behind each sheet name to obtain the sheet name of the excel;
and collecting the sheet content and the sheet name to obtain the content data of the excel.
Wherein the preset separator is a preset specified character string, such as "| @ @ @ @ |".
According to the embodiment of the invention, when the excel file is analyzed, the multiple sheet contents of the excel file are stored by using the separators, so that the subsequent display on the front-end page is facilitated.
And S3, storing the content data of the excel file into a database.
Optionally, before the content data of the excel file is stored in the database, the embodiment of the present invention further includes: creating a data table in a database, wherein the data table comprises fields of a table name, a sheet name and excel contents.
In detail, the storing the content data of the excel file into a database according to the embodiment of the present invention includes: and correspondingly storing the excel file content data into a database according to the fields of the pre-established data table.
When there are multiple excel files, the above operations may be cycled, and the multiple excel files are stored in the database, where one piece of data in the database represents one excel file and the corresponding excel file content.
Optionally, in order to ensure the privacy and security of the content data of the excel file, the content data of the excel file may also be stored in a node of a blockchain.
According to the embodiment of the invention, the contents and the styles of the multiple sheet pages of the multiple excels are analyzed, and the analyzed contents are stored in the database in a specific mode, so that the front-end page can directly acquire data from the database, and the efficiency can be improved.
And S4, receiving the online file preview request.
In detail, the file online preview request in the embodiment of the present invention is a data request generated by a user clicking a file online function on a front-end page under a corresponding file, and the file online preview request includes a data request generated by the user when uploading a file and a data request generated by the user when downloading a file.
Further, the online file preview request includes parameters such as a file name and a file address.
S5, searching and obtaining corresponding excel file content data in a database according to the file online preview request, and displaying the content data on a pre-constructed page according to a preset format.
Optionally, in the embodiment of the present invention, the file analysis content is stored in the database in advance, and after the online file preview request is received, the corresponding file content data can be directly obtained from the database and displayed on the pre-constructed page in a certain format.
The page is a display page of the client, is used for displaying the excel file, and can be constructed by utilizing various front-end frames.
In detail, the searching for the corresponding excel file content data in the database according to the file online preview request includes:
acquiring a file name in the file online preview request;
searching in a database according to the file name to obtain a result data set;
cutting the sheet name and the sheet content in each piece of data in the result data set according to a preset separator to obtain a plurality of sheet name arrays and a plurality of corresponding sheet content arrays;
and combining the plurality of sheet name arrays and the plurality of corresponding sheet content arrays to obtain excel file content data, and returning the excel file content data.
Further, the displaying the content data on a pre-constructed page according to a preset format includes:
acquiring the content data of the excel file;
using preset tags of a double-layer nested loop to perform layout and rendering a page;
and correspondingly displaying the content data of the excel file on a pre-constructed page through a preset label of the double-layer nested loop.
In detail, the correspondingly displaying the content data of the excel file on a pre-constructed page through the preset tag of the double-layer nested loop comprises:
displaying an excel file name and excel content corresponding to one excel file in the excel file contents by utilizing each label in outer layer circulation preset labels;
and displaying each sheet name in the sheet name array corresponding to the current excel file and each sheet content in the sheet content array by utilizing each label in the inner layer circulation preset labels.
Wherein the preset tag is a specific tag for displaying a front page, such as < el-tabs >.
The embodiment of the invention can simultaneously preview a plurality of excel files on line, wherein the excel files can contain a plurality of sheet pages and can be displayed on the pages in the form of a plurality of tab pages, instead of displaying all the sheet pages on one page, a user can conveniently view data in the excel files.
According to the embodiment of the invention, the excel file to be previewed is obtained in advance, the content of the excel file is analyzed to obtain the content data corresponding to the excel file, and the content data of the excel file is stored in the database, so that the excel file is prevented from being analyzed every time, the working efficiency is improved, and the computer resources are saved; meanwhile, after a file online preview request is received, corresponding contents can be directly searched from a database, the method is simple and convenient, multiple excel files can be obtained at one time by obtaining data through the database, multiple sheet page contents in one excel file are obtained, display is performed according to a preset format, the method is clear and concise, and development efficiency can be improved. Therefore, the method and the device can achieve the purpose of quickly and efficiently previewing the excel file on line.
FIG. 2 is a functional block diagram of the device for online previewing of excel files according to the present invention.
The device 100 for previewing the excel file online can be installed in electronic equipment. According to the realized functions, the device for previewing the excel file on line can comprise a file acquisition module 101, a target content analysis module 102, a data storage module 103, a request receiving module 104 and a content display module 105. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the file obtaining module 101 is configured to obtain an excel file to be previewed.
The excel files needing to be previewed in the embodiment of the invention comprise excel files stored in a server and excel files uploaded by a user.
In detail, when acquiring an excel file needing to be previewed, the file acquisition module 101 executes the following operations:
when the excel file needing to be previewed is an excel file stored in a server, acquiring a path of the excel file needing to be previewed, and acquiring the excel file needing to be previewed according to the path;
and when the excel file needing to be previewed is the excel file uploaded by the user, acquiring the excel file needing to be previewed by receiving the excel file uploaded by the user.
In an actual business system, sometimes a user needs to determine that an uploaded file is correct through online preview when uploading the excel file, and sometimes the user needs to determine that a downloaded file is correct when downloading the excel file, so that the excel file to be previewed needs to be acquired respectively according to two conditions.
Optionally, before obtaining the excel file to be previewed, determining the type of the excel file to be previewed further includes: judging the type of the excel file to be previewed through parameters, and when the parameters comprise the excel file, determining the excel file to be previewed as the excel file uploaded by a user; otherwise, determining the excel file needing to be previewed as the excel file stored in the server. Wherein the parameter is parameter data sent by the client.
The content analysis module 102 is configured to perform content analysis on the excel file to obtain content data corresponding to the excel file.
In detail, the content parsing module 102 is specifically configured to:
converting the excel file into a binary byte stream;
creating a corresponding object class according to the type of the excel file;
and writing the binary byte stream into the object class, and acquiring the content data of the excel according to the object class.
The type of the excel file comprises an xls file and an xlsx file, and different object classes and different methods are used for obtaining the excel content according to different requirements of the type of the excel file. The object class is an object class which can directly operate an excel file type in java and comprises HSSFWorkBook for operating an xls file and XSSFWorkBook for operating an xlsx file.
Optionally, before creating the corresponding object class according to the type of the excel file, the method further includes: and determining the type of the excel file. The determining the type of the excel file specifically comprises the following steps: acquiring the file name of the excel file; acquiring a suffix name of the excel file according to the file name; when the suffix name is xls, determining that the excel file is an xls file; and when the suffix name is xlsx, determining that the excel file is an xlsx file.
Further, when the content data of the excel is obtained according to the object class, the content analysis module 102 is specifically configured to:
circularly traversing a plurality of sheets of the excel by using the object class;
setting a cell style in each sheet page, and reading the content of each sheet page line by line to obtain a plurality of sheet contents corresponding to the plurality of sheets;
collecting the plurality of sheet contents, and inserting a preset separator into each sheet content to obtain the sheet contents of the excel;
acquiring all sheet names of the excel by using the object class, and adding a preset separator behind each sheet name to obtain the sheet name of the excel;
and collecting the sheet content and the sheet name to obtain the content data of the excel.
Wherein the preset separator is a preset specified character string, such as "| @ @ @ @ |".
According to the embodiment of the invention, when the excel file is analyzed, the multiple sheet contents of the excel file are stored by using the separators, so that the subsequent display on the front-end page is facilitated.
The data storage module 103 is configured to store the content data of the excel file into a database.
Optionally, before the content data of the excel file is stored in the database, the embodiment of the present invention further includes: creating a data table in a database, wherein the data table comprises fields of a table name, a sheet name and excel contents.
In detail, when the content data of the excel file is stored in the database in the embodiment of the present invention, the data storage module 103 is specifically configured to: and correspondingly storing the excel file content data into a database according to the fields of the pre-established data table.
When there are multiple excel files, the above operations may be cycled, and the multiple excel files are stored in the database, where one piece of data in the database represents one excel file and the corresponding excel file content.
Optionally, in order to ensure the privacy and security of the content data of the excel file, the content data of the excel file may also be stored in a node of a blockchain.
According to the embodiment of the invention, the contents and the styles of the multiple sheet pages of the multiple excels are analyzed, and the analyzed contents are stored in the database in a specific mode, so that the front-end page can directly acquire data from the database, and the efficiency can be improved.
The request receiving module 104 is configured to receive a file online preview request.
In detail, the file online preview request in the embodiment of the present invention is a data request generated by a user clicking a file online function on a front-end page under a corresponding file, and the file online preview request includes a data request generated by the user when uploading a file and a data request generated by the user when downloading a file.
Further, the online file preview request includes parameters such as a file name and a file address.
The content display module 105 is configured to search for corresponding excel file content data in a database according to the file online preview request, and display the content data on a pre-constructed page according to a preset format.
Optionally, in the embodiment of the present invention, the file analysis content is stored in the database in advance, and after the online file preview request is received, the corresponding file content data can be directly obtained from the database and displayed on the pre-constructed page in a certain format.
The page is a display page of the client, is used for displaying the excel file, and can be constructed by utilizing various front-end frames.
In detail, when the corresponding excel file content data is found in the database according to the file online preview request, the content display module 105 specifically executes the following operations:
acquiring a file name in the file online preview request;
searching in a database according to the file name to obtain a result data set;
cutting the sheet name and the sheet content in each piece of data in the result data set according to a preset separator to obtain a plurality of sheet name arrays and a plurality of corresponding sheet content arrays;
and combining the plurality of sheet name arrays and the plurality of corresponding sheet content arrays to obtain excel file content data, and returning the excel file content data.
Further, when the content data is displayed on a pre-constructed page according to a preset format, the content display module 105 specifically executes the following operations:
acquiring the content data of the excel file;
using preset tags of a double-layer nested loop to perform layout and rendering a page;
and correspondingly displaying the content data of the excel file on a pre-constructed page through a preset label of the double-layer nested loop.
In detail, when the content data of the excel file is correspondingly displayed on a pre-constructed page through the preset tag of the double-layer nested loop, the content display module 105 is specifically configured to:
displaying an excel file name and excel content corresponding to one excel file in the excel file contents by utilizing each label in outer layer circulation preset labels;
and displaying each sheet name in the sheet name array corresponding to the current excel file and each sheet content in the sheet content array by utilizing each label in the inner layer circulation preset labels.
Wherein the preset tag is a specific tag for displaying a front page, such as < el-tabs >.
The embodiment of the invention can simultaneously preview a plurality of excel files on line, wherein the excel files can contain a plurality of sheet pages and can be displayed on the pages in the form of a plurality of tab pages, instead of displaying all the sheet pages on one page, a user can conveniently view data in the excel files.
Fig. 3 is a schematic structural diagram of an electronic device for implementing a method for previewing an excel file online according to the present invention.
The electronic device 1 may include a processor 10, a memory 11 and a bus, and may further include a computer program, such as an online preview excel file program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used to store not only the application software installed in the electronic device 1 and various data, such as the code of the online preview excel file program 12, but also temporarily store data that has been output or will be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the whole electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, executing an online preview excel file program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The online preview excel file program 12 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, and when running in the processor 10, can implement:
acquiring an excel file to be previewed;
analyzing the content of the excel file to obtain content data corresponding to the excel file;
storing the content data of the excel file into a database;
receiving a file online preview request;
and searching in a database according to the file online preview request to obtain the content data of the corresponding excel file, and displaying the content data on a pre-constructed page according to a preset format.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any accompanying claims should not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for previewing an excel file on line is characterized by comprising the following steps:
acquiring an excel file to be previewed;
analyzing the content of the excel file to obtain content data corresponding to the excel file;
storing the content data of the excel file into a database;
receiving a file online preview request;
and searching in a database according to the file online preview request to obtain the content data of the corresponding excel file, and displaying the content data on a pre-constructed page according to a preset format.
2. The method for previewing an excel file on line according to claim 1, wherein the analyzing the content of the excel file to obtain the content data corresponding to the excel file comprises:
converting the excel file into a binary byte stream;
creating a corresponding object class according to the type of the excel file;
and writing the binary byte stream into the object class, and acquiring the content data of the excel according to the object class.
3. The method for previewing an excel file on line according to claim 2, wherein the obtaining the content data of the excel according to the object class comprises:
circularly traversing a plurality of sheets of the excel by using the object class;
setting a cell style in each sheet page, and reading the content of each sheet page line by line to obtain a plurality of sheet contents corresponding to the plurality of sheets;
collecting the plurality of sheet contents, and inserting a preset separator into each sheet content to obtain the sheet contents of the excel;
acquiring all sheet names of the excel by using the object class, and adding a preset separator behind each sheet name to obtain the sheet name of the excel;
and collecting the sheet content and the sheet name to obtain the content data of the excel.
4. The method for previewing an excel file on line according to claim 2, wherein before creating the corresponding object class according to the type of the excel file, further comprising:
acquiring the file name of the excel file;
acquiring a suffix name of the excel file according to the file name;
when the suffix name is xls, determining that the excel file is an xls file;
and when the suffix name is xlsx, determining that the excel file is an xlsx file.
5. The method for previewing the excel file online according to any one of claims 1 to 4, wherein the step of finding the corresponding excel file content in the database according to the file online preview request comprises:
acquiring a file name in the file online preview request;
searching in a database according to the file name to obtain a result data set;
cutting the sheet name and the sheet content in each piece of data in the result data set according to a preset separator to obtain a plurality of sheet name arrays and a plurality of corresponding sheet content arrays;
and combining the plurality of sheet name arrays and the corresponding plurality of sheet content arrays to obtain the excel file content data.
6. The method for previewing the excel file on line according to any one of claims 1 to 4, wherein the displaying on the pre-constructed page according to the preset format comprises:
acquiring the content data of the excel file;
using preset tags of a double-layer nested loop to perform layout and rendering a page;
and correspondingly displaying the content data of the excel file on a pre-constructed page through a preset label of the double-layer nested loop.
7. The method for previewing the excel file on line according to any one of claims 1 to 4, wherein the obtaining the excel file to be previewed comprises:
when the excel file needing to be previewed is an excel file stored in a server, acquiring a path of the excel file needing to be previewed, and acquiring the excel file needing to be previewed according to the path;
and when the excel file needing to be previewed is the excel file uploaded by the user, acquiring the excel file needing to be previewed by receiving the excel file uploaded by the user.
8. An apparatus for previewing an excel file online, the apparatus comprising:
the file acquisition module is used for acquiring an excel file to be previewed;
the content analysis module is used for carrying out content analysis on the excel file to obtain content data corresponding to the excel file;
the data storage module is used for storing the content data of the excel file into a database;
the request receiving module is used for receiving a file online preview request;
and the content display module is used for searching and obtaining the content data of the corresponding excel file in a database according to the file online preview request and displaying the content data on a pre-constructed page according to a preset format.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing at least one computer program instruction; and
a processor executing computer program instructions stored in the memory to perform the online preview excel file method of any of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method for online previewing an excel file according to any one of claims 1 to 7.
CN202011302184.9A 2020-11-19 2020-11-19 Method and device for previewing excel file online, electronic equipment and storage medium Pending CN112347737A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011302184.9A CN112347737A (en) 2020-11-19 2020-11-19 Method and device for previewing excel file online, electronic equipment and storage medium
PCT/CN2021/123177 WO2022105478A1 (en) 2020-11-19 2021-10-12 Method and apparatus for previewing excel file online, and electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011302184.9A CN112347737A (en) 2020-11-19 2020-11-19 Method and device for previewing excel file online, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112347737A true CN112347737A (en) 2021-02-09

Family

ID=74364412

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011302184.9A Pending CN112347737A (en) 2020-11-19 2020-11-19 Method and device for previewing excel file online, electronic equipment and storage medium

Country Status (2)

Country Link
CN (1) CN112347737A (en)
WO (1) WO2022105478A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861486A (en) * 2021-04-25 2021-05-28 成都淞幸科技有限责任公司 Data integration method, device, equipment and storage medium of semi-structured file
WO2022105478A1 (en) * 2020-11-19 2022-05-27 深圳壹账通智能科技有限公司 Method and apparatus for previewing excel file online, and electronic device, and storage medium
CN117787251A (en) * 2024-02-28 2024-03-29 江苏中威科技软件系统有限公司 Method for combining or merging and reading EXCEL hidden contents by multi-format files

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9442903B2 (en) * 2014-02-06 2016-09-13 Facebook, Inc. Generating preview data for online content
US10133710B2 (en) * 2014-02-06 2018-11-20 Facebook, Inc. Generating preview data for online content
CN107241227B (en) * 2017-06-29 2020-04-14 浪潮集团有限公司 Configuration and generation method of network data report
CN110688595B (en) * 2019-09-09 2022-08-16 上海斑马来拉物流科技有限公司 File online preview method, device, equipment and storage medium
CN110990345A (en) * 2019-11-28 2020-04-10 中国银行股份有限公司 Method and device for online preview of Excel file
CN111833981A (en) * 2020-04-30 2020-10-27 宁波市科技园区明天医网科技有限公司 Structured report making and compiling method
CN112347737A (en) * 2020-11-19 2021-02-09 深圳壹账通智能科技有限公司 Method and device for previewing excel file online, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022105478A1 (en) * 2020-11-19 2022-05-27 深圳壹账通智能科技有限公司 Method and apparatus for previewing excel file online, and electronic device, and storage medium
CN112861486A (en) * 2021-04-25 2021-05-28 成都淞幸科技有限责任公司 Data integration method, device, equipment and storage medium of semi-structured file
CN117787251A (en) * 2024-02-28 2024-03-29 江苏中威科技软件系统有限公司 Method for combining or merging and reading EXCEL hidden contents by multi-format files
CN117787251B (en) * 2024-02-28 2024-05-07 江苏中威科技软件系统有限公司 Method for combining or merging and reading EXCEL hidden contents by multi-format files

Also Published As

Publication number Publication date
WO2022105478A1 (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN112347737A (en) Method and device for previewing excel file online, electronic equipment and storage medium
CN105988996B (en) Index file generation method and device
CN106648569B (en) Target serialization realization method and device
CN113094674B (en) Page display method and device, electronic equipment and storage medium
RU2595524C2 (en) Device and method for processing content of web resource in browser
CN112506910A (en) Multi-source data acquisition method and device, electronic equipment and storage medium
CN109558123B (en) Method for converting webpage into electronic book, electronic equipment and storage medium
CN112486490B (en) Front-end code packaging method and device, electronic equipment and storage medium
CN112732567B (en) Mock data testing method and device based on ip, electronic equipment and storage medium
CN113282854A (en) Data request response method and device, electronic equipment and storage medium
CN115408399A (en) Blood relationship analysis method, device, equipment and storage medium based on SQL script
CN112527291A (en) Webpage generation method and device, electronic equipment and storage medium
CN114020256A (en) Front-end page generation method, device and equipment and readable storage medium
CN112650909A (en) Product display method and device, electronic equipment and storage medium
CN112702228A (en) Service current limiting response method and device, electronic equipment and readable storage medium
CN115129753A (en) Data blood relationship analysis method and device, electronic equipment and storage medium
CN113127776A (en) Breadcrumb path generation method and device and terminal equipment
CN114169303A (en) Method, device, equipment and medium for editing table based on vue.js
CN112328656B (en) Service query method, device, equipment and storage medium based on middle platform architecture
CN113360139A (en) Integration method and device of front-end frame, electronic equipment and storage medium
CN113051224A (en) File transmission method and device, electronic equipment and computer readable storage medium
CN107643892B (en) Interface processing method, device, storage medium and processor
CN114611046A (en) Data loading method, device, equipment and medium
CN113139145A (en) Page generation method and device, electronic equipment and readable storage medium
CN114741077A (en) Page effect preview method, device, equipment and medium based on field granularity

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination