CN103870441A - Method for converting webpage table data into Excel - Google Patents
Method for converting webpage table data into Excel Download PDFInfo
- Publication number
- CN103870441A CN103870441A CN201210538924.8A CN201210538924A CN103870441A CN 103870441 A CN103870441 A CN 103870441A CN 201210538924 A CN201210538924 A CN 201210538924A CN 103870441 A CN103870441 A CN 103870441A
- Authority
- CN
- China
- Prior art keywords
- excel
- property value
- storage unit
- row
- matrix data
- 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.)
- Granted
Links
Images
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a method for converting webpage table data into Excel. The method includes the following steps of a. browsing a webpage containing table labels through a browser; b. sequentially analyzing TD and TH label related content in the table labels into a cortege matrix data storage unit; c. calling an Excel software interface and sequentially writing content of storing units in the cortege matrix data storage unit into Excel. The method is suitable for information exchange of data tables and Excel in the current webpage, the implementing process is accurate, convenient and rapid, access to a database is not required, and meanwhile, the method is improved on the basis of methods in the prior art so that good user experience is provided.
Description
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method that webpage Table data-switching is become to Excel.
Background technology
Internet, according to the International Computer Network of certain communications protocol composition, is most widely used general, the most universal aspect of computer nowadays.Webpage is based on internet, and no matter where web page files leaves in, can access all over the world by internet.
Microsoft Excel is one of office software of Microsoft, is a spread sheet software that the computer that is Windows and AppleMacintosh operating system by Microsoft is write and moved.Excel is an important component part of Microsoft's office package software, and it can carry out processing, statistical study and the aid decision making operation of various data, is widely used in the various fields such as management, statistics finance and economics, finance.
User online browsing is to available valuable tables of data information, need to transfer Excel to personal is very common mode of operation, generally directly to copy webpage Table content to paste in the Excel opening, need between webpage and the Excel page, switch, if particularly have other guide interval between the more and table of Table and table in webpage, so selecting and just cumbersome when switching, required time is more, efficiency is low, and may have the problem of format mismatching, need to again adjust.
Application number is that 201010268261.3 patent of invention has been announced a kind of method and apparatus that web data is imported to Excel form in August, 2010, its way is on web browser, to open the webpage that includes data form, in webpage, select data form, web browser resolves to described webpage label the data that obtain data form, the Excel worksheet page of calling excel Software Create blank, read data are write the generated Excel worksheet page by web browser.This invention dynamically captures list data on webpage, realizes the operating in a key of web data to Excel, has improved user's work efficiency.But through research, this invention exists certain defect, if the data form in webpage does not comprise Colspan or Rowspan attribute, this invention can be effective really; In the time comprising Colspan or Rowspan attribute in the data form Table label in webpage, directly resolve Table to Excel and can exist original form ranks content is presented to the problem in other cells.
Summary of the invention
For above problem, the present invention proposes a kind of method that webpage Table data-switching is become to Excel, browse the webpage that includes Table label by browser, TD in Table label and TH label related content are resolved to a line column matrix data-carrier store, calling excel software interface, writes Excel by ranks matrix data memory content.
For realizing foregoing invention content, the present invention has adopted a kind of method that webpage Table data-switching is become to Excel, and the performing step of the method is as follows:
A. browse by browser the webpage that includes Table label;
B. the TD in Table label and TH label related content are resolved successively to a line column matrix data-carrier store;
C. calling excel software interface, writes Excel successively by the memory cell content in ranks matrix data storer.
Described ranks matrix data storer is dynamic generation of ranks value that goes out Table label according to browser resolves, the ranks of Table are corresponding one by one with the ranks of ranks matrix data storer, when initialization, in its storage unit, be marked with general labeling, represent to allow to write.
When described step b resolves to ranks matrix data storer by the TD in Table label and TH label substance successively, first to judge the mark of ranks matrix data Memory Storage Unit, if general labeling, the content of writing direct, writes rear mark and no longer exists; If specific markers represents not allow to write, need find train value minimum in current line and be labeled as generally labelled storage unit and write, if do not find, then look for train value minimum in next line and be labeled as generally labelled storage unit and write.
When described step b resolves to ranks matrix data storer by the TD in Table label and TH label substance successively, browser judges Colspan, the Rowspan property value of TD or TH label successively, if Colspan and Rowspan property value do not exist or are all less than or equal to 1, by the storage unit of TD or TH label related content writing line column matrix data-carrier store; If Rowspan property value does not exist or is less than or equal to 1, Colspan property value is greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, in the storage unit of the ensuing Colspan of this row property value-1, change general labeling into specific markers simultaneously; If Colspan property value does not exist or is less than or equal to 1, Rowspan property value is greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, in the storage unit of the ensuing Rowspan of these row property value-1, change general labeling into specific markers simultaneously; If Colspan and Rowspan property value are all greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, change the general labeling of other storage unit in the Colspan property value * Rowspan property value form forming taking this storage unit as starting point into specific markers simultaneously.
In the substantial storage unit of described ranks matrix data storer, contain Colspan property value, Rowspan property value and the data under former TD or TH label.
When described step c writes Excel successively by the memory cell content in ranks matrix data storer, if storage unit Colspan and Rowspan property value do not exist or be all less than or equal to 1, directly data are write to Excel; If not existing or be less than or equal to 1, Colspan property value, Rowspan property value is greater than 1, when data being write to Excel and next Colspan property value-1 cell span of this row; If not existing or be less than or equal to 1, Rowspan property value, Colspan property value is greater than 1, when data being write to Excel and next Rowspan property value-1 cell span of these row; If Colspan and Rowspan property value are all greater than 1, merge the Colspan property value * Rowspan property value form forming taking this cell as starting point simultaneously.
When described step c writes Excel successively by the memory cell content in ranks matrix data storer, ignore if run into specific markers, start again to write Excel until run into containing substantial storage unit.
When described step c writes Excel successively by the memory cell content in ranks matrix data storer, can write according to the order of row, also can write according to the order of row; Storage unit in ranks matrix data storer is corresponding one by one with Excel specific region cell.
Data Table and Excel that the present invention is suitable in current web page carry out message exchange, and implementation procedure is accurate, convenient, without accessing database; Meanwhile, the present invention, as improvements over the prior art, provides better user to experience.
Brief description of the drawings
Fig. 1 is a kind of embodiment process flow diagram that webpage Table data-switching is become to the method for Excel provided by the present invention;
Fig. 2 a is that the Table in the webpage of a kind of method that webpage Table data-switching is become to Excel provided by the present invention shows example;
Fig. 2 b is the procedure chart that the browser of a kind of method that webpage Table data-switching is become to Excel provided by the present invention is written to Table in webpage ranks matrix data Memory Storage Unit;
Fig. 3 is the procedure chart that the browser of a kind of method that webpage Table data-switching is become to Excel provided by the present invention is written to ranks matrix data Memory Storage Unit content Excel.
Embodiment
For make that the present invention mentions a kind of by webpage Table data-switching become the method for Excel and advantage more explicit, referring to accompanying drawing, the present invention is further described in detail.
Fig. 1 is a kind of embodiment process flow diagram that webpage Table data-switching is become to the method for Excel provided by the present invention.As shown in Figure 1, the main flow process of the method is as follows:
Step 1, browses the webpage that includes Table label.
User browses to the relevant Table page by browser.
Step 2, resolves the TD in Table label and TH label related content to ranks matrix data storer.
The ranks number of Table is resolved and counted to browser first, dynamically generates a line column matrix data-carrier store that ranks number is identical with Table; Initialization ranks matrix data storer is unified mark with general labeling in storage unit, represents to allow to write; Browser resolves the TD in Table label and TH label related content successively to ranks matrix data storer.
Ranks matrix data storer is used for depositing TD and the TH label related content of Table in webpage temporarily, and when the content of ranks matrix data Memory Storage Unit writes after Excel, this ranks matrix data storer discharges automatically.
Step 3, browser calling excel software interface, writes Excel by the content of ranks matrix store storage unit.
For the more than one situation of Table in webpage, can give tacit consent to and read in the Excel worksheet sheet2 page, the like, other modes also can be set and select for user.
Fig. 2 a is that the Table in the webpage of a kind of method that webpage Table data-switching is become to Excel provided by the present invention shows example.Listing Fig. 2 a is how to read in ranks matrix data storer for the clearer Table of expressing data.
Fig. 2 b is the procedure chart that the browser of a kind of method that webpage Table data-switching is become to Excel provided by the present invention is written to Table in webpage ranks matrix data Memory Storage Unit.In this example, this implementation procedure comprises the following steps as an example of the table in Fig. 2 a example:
It should be noted that in Table data writing line column matrix data-carrier store storage unit, if the property value that cell contains Colspan property value, Rowspan, writing line column matrix data-carrier store storage unit in the lump.
Fig. 3 is the procedure chart that the browser of a kind of method that webpage Table data-switching is become to Excel provided by the present invention is written to ranks matrix data Memory Storage Unit content Excel.
The storage unit of ranks matrix data storer is one to one with the ranks of the Excel cell reading in, and it is the same that browser reads principle to ranks matrix data Memory Storage Unit according to the order of row, does not repeat them here.
The above is to preferably embodiment of the present invention, and the art personnel should be appreciated that described embodiment non-limiting protection scope of the present invention.Not departing under Spirit Essence of the present invention and principle, aspect details, can change or revise, within all should being encompassed in claim scope of the present invention.
Claims (8)
1. a method that webpage Table data-switching is become to Excel, is characterized in that, said method comprising the steps of:
A. browse by browser the webpage that includes Table label;
B. the TD in Table label and TH label related content are resolved successively to a line column matrix data-carrier store;
C. calling excel software interface, writes Excel successively by the memory cell content in ranks matrix data storer.
2. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, described ranks matrix data storer is dynamic generation of ranks value that goes out Table label according to browser resolves, the ranks of Table are corresponding one by one with the ranks of ranks matrix data storer, when initialization, in its storage unit, be marked with general labeling, represent to allow to write.
3. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, when described step b resolves to ranks matrix data storer by the TD in Table label and TH label substance successively, first to judge the mark of ranks matrix data Memory Storage Unit, if general labeling, the content of writing direct, writes rear mark and no longer exists; If specific markers represents not allow to write, need find train value minimum in current line and be labeled as generally labelled storage unit and write, if do not find, then look for train value minimum in next line and be labeled as generally labelled storage unit and write.
4. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, when described step b resolves to ranks matrix data storer by the TD in Table label and TH label substance successively, browser judges Colspan, the Rowspan property value of TD or TH label successively, if Colspan and Rowspan property value do not exist or are all less than or equal to 1, by the storage unit of TD or TH label related content writing line column matrix data-carrier store; If Rowspan property value does not exist or is less than or equal to 1, Colspan property value is greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, in the storage unit of the ensuing Colspan of this row property value-1, change general labeling into specific markers simultaneously; If Colspan property value does not exist or is less than or equal to 1, Rowspan property value is greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, in the storage unit of the ensuing Rowspan of these row property value-1, change general labeling into specific markers simultaneously; If Colspan and Rowspan property value are all greater than 1,, by the storage unit of TD or TH label related content writing line column matrix data-carrier store, change the general labeling of other storage unit in the Colspan property value * Rowspan property value form forming taking this storage unit as starting point into specific markers simultaneously.
5. a kind of method that webpage Table data-switching is become to Excel as described in claim 1 or 4, it is characterized in that, in the substantial storage unit of described ranks matrix data storer, contain Colspan property value, Rowspan property value and the data under former TD or TH label.
6. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, when described step c writes Excel successively by the memory cell content in ranks matrix data storer, if storage unit Colspan and Rowspan property value do not exist or be all less than or equal to 1, directly data are write to Excel; If not existing or be less than or equal to 1, Colspan property value, Rowspan property value is greater than 1, when data being write to Excel and next Colspan property value-1 cell span of this row; If not existing or be less than or equal to 1, Rowspan property value, Colspan property value is greater than 1, when data being write to Excel and next Rowspan property value-1 cell span of these row; If Colspan and Rowspan property value are all greater than 1, merge the Colspan property value * Rowspan property value form forming taking this cell as starting point simultaneously.
7. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, when described step c writes Excel successively by the memory cell content in ranks matrix data storer, ignore if run into specific markers, start again to write Excel until run into containing substantial storage unit.
8. a kind of method that webpage Table data-switching is become to Excel as claimed in claim 1, it is characterized in that, when described step c writes Excel successively by the memory cell content in ranks matrix data storer, can write according to the order of row, also can write according to the order of row; Storage unit in ranks matrix data storer is corresponding one by one with Excel specific region cell.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210538924.8A CN103870441B (en) | 2012-12-14 | A kind of method that webpage Table data are converted into Excel |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210538924.8A CN103870441B (en) | 2012-12-14 | A kind of method that webpage Table data are converted into Excel |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103870441A true CN103870441A (en) | 2014-06-18 |
CN103870441B CN103870441B (en) | 2016-11-30 |
Family
ID=
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105354302A (en) * | 2015-11-04 | 2016-02-24 | 国云科技股份有限公司 | Method for automatically acquiring list data from Web |
CN106202005A (en) * | 2015-05-08 | 2016-12-07 | 珠海金山办公软件有限公司 | A kind of web page conversion method and device |
CN106202348A (en) * | 2016-07-04 | 2016-12-07 | 中山大学 | A kind of web page form information extraction method |
CN109213818A (en) * | 2018-08-15 | 2019-01-15 | 平安科技(深圳)有限公司 | Table deriving method, device, computer equipment and storage medium |
CN110019441A (en) * | 2017-08-31 | 2019-07-16 | 北京京东尚科信息技术有限公司 | It is a kind of by method and apparatus derived from data in webpage |
EP3862358A1 (en) | 2020-02-06 | 2021-08-11 | Evonik Operations GmbH | A process for the production of sulfur containing silanes by utilization of phase transfer catalysis |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1834966A (en) * | 2005-03-16 | 2006-09-20 | 日本电气株式会社 | Display conversion device,display conversion method and program of watch |
CN1862543A (en) * | 2006-06-21 | 2006-11-15 | 千乡万才科技(中国)有限公司 | Method for leading-in and deriving data in browser/servicer system |
CN101576891A (en) * | 2008-05-05 | 2009-11-11 | 北京瑞佳晨科技有限公司 | Method for analyzing web page form object nodes |
CN101908078A (en) * | 2010-08-30 | 2010-12-08 | 深圳市五巨科技有限公司 | Method and device for importing webpage data to EXCEL sheet |
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1834966A (en) * | 2005-03-16 | 2006-09-20 | 日本电气株式会社 | Display conversion device,display conversion method and program of watch |
CN1862543A (en) * | 2006-06-21 | 2006-11-15 | 千乡万才科技(中国)有限公司 | Method for leading-in and deriving data in browser/servicer system |
CN101576891A (en) * | 2008-05-05 | 2009-11-11 | 北京瑞佳晨科技有限公司 | Method for analyzing web page form object nodes |
CN101908078A (en) * | 2010-08-30 | 2010-12-08 | 深圳市五巨科技有限公司 | Method and device for importing webpage data to EXCEL sheet |
Non-Patent Citations (1)
Title |
---|
E_ZHIWEN: "Javascript实现把网页中table的内容导入到excel中的几种方法", 《HTTP://BLOG.CSDN.NET/E_ZHIWEN/ARTICLE/DETAILS/5974644》, 29 October 2010 (2010-10-29) * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106202005A (en) * | 2015-05-08 | 2016-12-07 | 珠海金山办公软件有限公司 | A kind of web page conversion method and device |
CN105354302A (en) * | 2015-11-04 | 2016-02-24 | 国云科技股份有限公司 | Method for automatically acquiring list data from Web |
CN105354302B (en) * | 2015-11-04 | 2019-03-22 | 国云科技股份有限公司 | A method of obtaining table data automatically from Web |
CN106202348A (en) * | 2016-07-04 | 2016-12-07 | 中山大学 | A kind of web page form information extraction method |
CN110019441A (en) * | 2017-08-31 | 2019-07-16 | 北京京东尚科信息技术有限公司 | It is a kind of by method and apparatus derived from data in webpage |
CN109213818A (en) * | 2018-08-15 | 2019-01-15 | 平安科技(深圳)有限公司 | Table deriving method, device, computer equipment and storage medium |
EP3862358A1 (en) | 2020-02-06 | 2021-08-11 | Evonik Operations GmbH | A process for the production of sulfur containing silanes by utilization of phase transfer catalysis |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102508784B (en) | Data storage method of flash memory card in video monitoring equipment, and system thereof | |
CN104239298B (en) | Text message recommends method, server, browser and system | |
CN102622348B (en) | Method and device enabling plurality of windows to perform analytical display on network page simultaneously | |
CN103488732A (en) | Generation method and device of static pages | |
CN106886544A (en) | A kind of data processing method and device | |
CN103049224A (en) | Method, device and system for importing data into physical tape | |
CN102982127A (en) | Method of replacing characters in batch to achieve multi-language version and batch processing device | |
CN101727270A (en) | Method for constructing soft keyboard, device for inputting character information and method thereof | |
CN112084342A (en) | Test question generation method and device, computer equipment and storage medium | |
CN109446506A (en) | A kind of method and apparatus that electronic spreadsheet table reproduces automatically | |
CN102385606B (en) | The access method of a kind of Distributed Data Warehouse and device | |
CN110347390A (en) | A kind of method quickly generating WEB page, storage medium, equipment and system | |
CN103377246B (en) | Bookmark processing method and terminal browser | |
CN102014023B (en) | VB Script based automatic testing method of network equipment products | |
CN112130733A (en) | Thumbnail-based document display method and equipment | |
CN102479074B (en) | A kind of method, device and application system of following the tracks of GUI list refreshing content | |
CN106951531A (en) | Data query method and device | |
CN104899208A (en) | Caching method and apparatus for browser | |
CN103870441A (en) | Method for converting webpage table data into Excel | |
CN101777077A (en) | Method for implementing file system of embedded device | |
US20230409235A1 (en) | File system improvements for zoned storage device operations | |
CN103210389B (en) | A kind for the treatment of method and apparatus of metadata | |
CN103870441B (en) | A kind of method that webpage Table data are converted into Excel | |
CN102567366A (en) | Method for realizing webpage resetting | |
CN106933970A (en) | A kind of fast writing data to EXT subregions method and apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |