CN108763505A - List data exchange method, device, computer equipment and storage medium - Google Patents

List data exchange method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN108763505A
CN108763505A CN201810539608.XA CN201810539608A CN108763505A CN 108763505 A CN108763505 A CN 108763505A CN 201810539608 A CN201810539608 A CN 201810539608A CN 108763505 A CN108763505 A CN 108763505A
Authority
CN
China
Prior art keywords
data
cell
lattice
value
cell lattice
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
CN201810539608.XA
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201810539608.XA priority Critical patent/CN108763505A/en
Publication of CN108763505A publication Critical patent/CN108763505A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/174Form filling; Merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the present application discloses a kind of list data exchange method, device, computer equipment and storage medium.This method includes:Initialization data table;The creating unit lattice in data form, setting gauge outfit are placed in the middle;The importing data for obtaining data form to be imported will import data and be inserted into data form, obtain importing data form;The data manipulation type for obtaining user according to the action type of data and imports data form acquisition operating result corresponding with data manipulation type.The method achieve in the journey that automatic test is crossed, between interface by be arranged action type can mutual operation data form, without writing complicated database script.

Description

List data exchange method, device, computer equipment and storage medium
Technical field
This application involves data-manipulation techniques fields more particularly to a kind of list data exchange method, device, computer to set Standby and storage medium.
Background technology
If currently, when calling another interface there are one interface with operation data table during the test, typically lead to It crosses tester and writes database script to realize the operation to data form, this results in the process of data interaction complicated, and And inefficiency.
Invention content
This application provides a kind of list data exchange method, device, computer equipment and storage mediums, it is intended to solve existing Have in technology and database script is write to realize the operation to data form by tester, this results in the mistake of data interaction Journey is complicated, and the problem of inefficiency.
In a first aspect, this application provides a kind of list data exchange methods comprising:
Initialization data table;
The creating unit lattice in data form, setting gauge outfit are placed in the middle;
The importing data for obtaining data form to be imported will import data and be inserted into data form, obtain importing tables of data Lattice;
The data manipulation type for obtaining user according to the action type of data and imports data form acquisition and data manipulation The corresponding operating result of type.
Second aspect, this application provides a kind of list data interactive devices comprising:
Table initialization unit is used for initialization data table;
Cell creating unit, for the creating unit lattice in data form, setting gauge outfit is placed in the middle;
Data write unit, the importing data for obtaining data form to be imported will import data and are inserted into tables of data Lattice obtain importing data form;
Operating result feedback unit, the data manipulation type for obtaining user, according to the action type of data and importing Data form obtains operating result corresponding with data manipulation type.
The third aspect, the application provide a kind of computer equipment again, including memory, processor and are stored in described deposit On reservoir and the computer program that can run on the processor, the processor realize this when executing the computer program Any one of them list data exchange method provided is provided.
Fourth aspect, present invention also provides a kind of storage mediums, wherein the storage medium is stored with computer program, The computer program includes program instruction, and described program instruction makes the processor execute the application when being executed by a processor Any one of them list data exchange method of offer.
A kind of list data exchange method of the application offer, device, computer equipment and storage medium.This method passes through just Beginningization data form;The creating unit lattice in data form, setting gauge outfit are placed in the middle;Obtain the importing number of data form to be imported According to, by import data be inserted into data form, obtain import data form;The data manipulation type for obtaining user, according to data Action type and import data form and obtain corresponding with data manipulation type operating result.The method achieve automating In the journey tested, between interface by be arranged action type can mutual operation data form, without writing complicated data Library script.
Description of the drawings
It, below will be to needed in embodiment description in order to illustrate more clearly of the embodiment of the present application technical solution Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is some embodiments of the present application, general for this field For logical technical staff, without creative efforts, other drawings may also be obtained based on these drawings.
Fig. 1 is a kind of schematic flow diagram of list data exchange method provided by the embodiments of the present application;
Fig. 2 is a kind of sub-process schematic diagram of list data exchange method provided by the embodiments of the present application;
Fig. 3 is a kind of another sub-process schematic diagram of list data exchange method provided by the embodiments of the present application;
Fig. 4 is a kind of another sub-process schematic diagram of list data exchange method provided by the embodiments of the present application;
Fig. 5 is a kind of another sub-process schematic diagram of list data exchange method provided by the embodiments of the present application;
Fig. 6 is a kind of schematic block diagram of list data interactive device provided by the embodiments of the present application;
Fig. 7 is a kind of subelement schematic block diagram of list data interactive device provided by the embodiments of the present application;
Fig. 8 is a kind of another subelement schematic block diagram of list data interactive device provided by the embodiments of the present application;
Fig. 9 is a kind of another subelement schematic block diagram of list data interactive device provided by the embodiments of the present application;
Figure 10 is a kind of another subelement schematic block diagram of list data interactive device provided by the embodiments of the present application;
Figure 11 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific implementation mode
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation describes, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen Please in embodiment, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall in the protection scope of this application.
It should be appreciated that ought use in this specification and in the appended claims, term " comprising " and "comprising" instruction Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded Body, step, operation, element, component and/or its presence or addition gathered.
It is also understood that the term used in this present specification is merely for the sake of the mesh for describing specific embodiment And be not intended to limit the application.As present specification and it is used in the attached claims, unless on Other situations are hereafter clearly indicated, otherwise " one " of singulative, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is Refer to any combinations and all possible combinations of one or more of associated item listed, and includes these combinations.
Referring to Fig. 1, Fig. 1 is a kind of schematic flow diagram of list data exchange method provided by the embodiments of the present application.It should Method is applied in the terminals such as desktop computer, laptop computer, tablet computer.As shown in Figure 1, the method comprising the steps of S101~ S104。
S101, initialization data table.
In one embodiment, as shown in Fig. 2, the step S101 includes:
S1011, establishment are used to open the Workbook objects of Excel books;
S1012, blank form is added in Workbook objects;
S1013, initial row is added in blank form.
In the present embodiment, during carrying out automatic test, a certain function module (it is denoted as the first function module, Its external interface is denoted as first interface) it needs (to be denoted as the second function module, external interface is denoted as with another function module Second interface) it interacts, if there is data that need to be transmitted to the progress of the second function module by second interface in the first function module When write-in, the first initialization data table in the second function module is needed, to receive the data transmitted by the first function module.Its In, the first function module can be considered as the first virtual functions module built in automated test frame, the second function module The the second virtual functions module built in automated test frame can be considered as.For example, when building automated test frame, It needs to build each API module (to be specifically that interface calls API module, database API module, Excel Form Handles API module, day Phase handle API module), data management module, interface administration module, journal output module, exception processing module, concurrent processing mould Block, distributed processing modules, case management module, result report output module.
Wherein, interface calls API module, and encapsulating http, https, esg agreement, (esg agreements are Zookeeper agreements A kind of warping protocols) the interface requests mode such as GET, POST, support multi-thread concurrent request.It is based on Httpclient.jar, java multithreading, and processed thread-safe problem therein.In automatic test course In, frequent calling interface is needed, this interface calls all kinds of API in API module that can meet testing requirement.
Database API module encapsulates and carries out additions and deletions to oracle database and change to look into and the methods of automatic regular polling, number C3P0 (C3P0 is a kind of Thread Pool Technology), the letters such as configurableization managed database, usemame/password are used according to source control Breath, performance is splendid, in automatic test course, needs frequent Accessing Oracle Database, in this database API module API can meet demand.
Excel Form Handle API modules encapsulate to Excel2003,2007 reading, input API, are based on POI.jar (POI.jar is the jar packets that Tentative Study of Achievement of Manipulation on Excel is used in java), mould API in the block can support to prompt to read according to left-most cell lattice Right cell lattice value prompts to read lower unit lattice value according to upper cell, and entire area unit is obtained according to diagonal cell Lattice value.
Date handle API module, encapsulate related API handle the date, be based on Date, Calendar, For the tool-class such as SimpleDateFormat, it can be achieved that the date compares, acquisition is arbitrary as unit difference using year, month, day, hour, min, second Time, can according to the time obtain current year which week what day needed to date frequent processing operation in automatic test course, This module can meet demand.
Data management module, for carrying out Classification Management to test data.
Interface administration module, for multiple api interfaces in management automation test frame, because in automatic test mistake Cheng Zhong, there are many called number of repetition of the same interface, are simplified code, shorten later maintenance workload, interface needs list Solely management is called, and the later stage is when changing a plurality of test cases, it is only necessary to safeguard an interface.
Journal output module, encapsulation are based on LOG4J.jar to the API such as daily record outgoing management in automatic test course, can Four ranks such as error, log, stdout, info are arranged to daily record, phase is flexibly called for different daily record output levels Close API.
Exception processing module, encapsulation to occur in automatic test course it is abnormal the API such as how to handle, be based on Exception interfaces encapsulate a large amount of self-defined exceptions, convenient for the quick positioning question root when occurring abnormal.
Concurrent processing module, encapsulation automate the API such as case to needing to execute using multithreading in automatic test course, Basic java multithreadings, this module provide initialization thread pond, calling, hang-up, destroying threads API, and pass through Lock technology has handled thread-safe problem.
Distributed processing modules, in automatic test course, if case is excessive, the efficiency of an execution machine is too low, It needs fractionation case to be executed on more execution machines, at this time needs the configuration packet in testng.xml files, pass through difference It is grouped to specify unique execution machine, improves execution efficiency.
Case management module, this module is to execute the module of test cases, and by testng frames ,@Test explain to mark Show, assert static methods assert case implementing result.
As a result report output module, this module are after management test cases has executed, to be exported in the form of report, test case Example sum is executed through number, percent of pass, the displaying of failure testing case, and failure cause displaying is sent out with mail he.
First function module can be above-mentioned cited mould any one module in the block, and the second function module is then above-mentioned Any one module and module is differed with the first function module in cited module.
Wherein, it creates after being used to open the Workbook objects of Excel books, passes through in the second function module Blank form is added in wb.createSheet instructions in Workbook objects, then passes through sheet.createRow ((int) 0) initial row is added in instruction in blank form.After carrying out aforesaid operations, i.e., automatically quickly created in the second function module Table is built to store data.
S102, the creating unit lattice in data form, setting gauge outfit are placed in the middle.
In the present embodiment, in data form after creating unit lattice, need to first create the attribute of a configuration placed in the middle, and gauge outfit is set The title respectively arranged.Wherein,
Format placed in the middle is created by style.setAlignment (HSSFCellStyle.ALIGN_CENTER);
By setSheetHeader (row, style), the title that gauge outfit respectively arranges is set;
Such as pass through:
cell.setEncoding(HSSFCell.ENCODING_UTF_16);Cell.setCellValue (" student number ");
To create this row of entitled student number in gauge outfit and it is necessary to pass through cell.setEncoding (HSSFCell.ENCODING_UTF_16) exports coding is carried out to be arranged to prevent Chinese Random Code.By above-mentioned setting, can ensure that Every attribute of the data form created is rapidly initialized, and can be reduced the stand-by period before data import, be improved data Interactive efficiency.
S103, the importing data for obtaining data form to be imported will import data and are inserted into data form, obtain importing number According to table.
In the present embodiment, by insertDatasToSheet (sheet, list) by the importing of data form to be imported Data are inserted into data form, obtain importing data form;The read-write of database and data form (such as Excel tables) passes through POI.JAR packets realize that Apache POI are the open source code function libraries of Apache Software Foundation, and POI provides API to Java The function that program is read and write to Microsoft Office format archives.
POI.JAR packets include HSSF patterns, and HSSF is the abbreviation of Horrible SpreadSheetFormat, is passed through HSSF user can read, be written, change Excel file by pure Java code.HSSF provides two classes for read operation API:Usermodel and eventusermodel, i.e. " user model " and " event-user model ".Such as:HSSFWorkbook Indicate Excel document object;HSSFName indicates title;HSSFCellStyle indicates the pattern of cell; HSSFErrorConstants indicates erropr message list etc..
S104, the data manipulation type for obtaining user according to the action type of data and import data form acquisition and number According to the corresponding operating result of action type.
In the present embodiment, it when carrying out various operations to the importing data imported in data form, need to first pass through FileInputStream (i.e. file byte reading flow) obtains the Excel flow data in data form to be imported, then passes through " Workbook.getWorkbook (in) " obtains all importing data in data form to be imported, finally according to data form The Sheet indexes or Sheet name acquiring Sheet objects of (i.e. Excel tables), that is, pass through " Sheet sheet= Workbook.getSheet (sheetIndex/sheetName) " obtains the Sheet objects of Excel tables.
In one embodiment, as shown in figure 3, the step S104 includes:
If the data manipulation type of S1041a, user are to obtain right sided cell lattice value according to left cell lattice, according to importing Current left cell lattice obtain left cell lattice object in data form;
S1042a, the columns of left cell lattice object is added one, obtains right sided cell lattice object;
S1043a, value included in right sided cell lattice object is read, obtains right sided cell lattice value.
In the present embodiment, as the first embodiment of data manipulation, " CellleftCell=is first passed through Sheet.findCell (left_Name) " obtains current left cell lattice object, and wherein leftCell indicates a current left side Side unit lattice object, left_Name indicate that left cell lattice value, sheet.findCell (left_Name) indicate positioning Excel Cell object corresponding with left_Name in table.
Then by " Cell rightCell=sheet.getCell (leftCell.getColumn ()+1, LeftCell.getRow ()) ", wherein rightCell indicates right sided cell lattice object, [leftCell.getColumn ()+1, LeftCell.getRow ()] columns of left cell lattice object is added one for expression and line number remains unchanged, sheet.getCell (leftCell.getColumn ()+1, leftCell.getRow ()) indicate location data table in The corresponding cell object of leftCell.getColumn ()+1, leftCell.getRow ().
The right side is obtained finally by " String rightValue=rightCell.getContents () .trim () " Side unit lattice value, wherein rightValue indicate right sided cell lattice value, and right sided cell lattice value is particular by .getContents () .trim () method obtains.It is obtained according to left cell lattice during interface calls by the above-mentioned means, realizing Right cell lattice value.
In one embodiment, as shown in figure 4, the step S104 includes:
If the data manipulation type of S1041b, user are to obtain full line cell value according to left cell lattice, according to importing Current left cell lattice obtain left cell lattice object in data form;
S1042b, the line number and row number for obtaining left cell lattice object, and obtain total columns in data form to be imported;
S1043b, traversal have the row that identical line number and row number are located at left cell lattice object with left cell lattice object Cell number between total columns reads the value of cell obtained by traversal, obtains the full line list that left cell lattice are expert at First lattice value.
In the present embodiment, as the second embodiment of data manipulation, " CellleftCell=is first passed through Sheet.findCell (left_Name) " obtains left cell lattice object, and wherein leftCell indicates left cell lattice pair As, left_Name indicates left cell lattice value, sheet.findCell (left_Name) indicate in positioning Excel tables with The corresponding cell objects of left_Name.Then, the line number and row number of left cell lattice object are obtained, and obtains importing data Total columns in table.Finally traversal has identical line number with left cell lattice object and row number is located at left cell lattice object Cell between row number and total columns reads the value of cell obtained by traversal, obtains the full line that left cell lattice are expert at Cell value.By the above-mentioned means, realizing full line cell value is obtained according to left cell lattice during interface calls.
In one embodiment, as shown in figure 5, the step S104 includes:
If the data manipulation type of S1041c, user are to be obtained to specify territory element lattice value, root according to diagonal cell The upper left corner cell value in region is specified to obtain upper left corner cell object according to importing in data form;
S1042c, lower right corner cell object is obtained according to the lower right corner cell value in specified region;
S1043c, traversal line number be located at upper left corner cell object line number and lower right corner cell object line number it Between, row number be located at the cell between the row number of upper left corner cell object and the row number of lower right corner cell object, read time The value of cell obtained by going through obtains specified territory element lattice value.
In the present embodiment, as the 3rd embodiment of data manipulation, " CellleftupCell=is first passed through Sheet.findCell (leftup_Name) " obtains the upper left corner cell object in specified region, wherein leftup_Name It is the upper left corner cell value in specified region, leftupCell is the upper left corner cell object in specified region.
Then pass through Cell rightdownCell=sheet.findCell (rightdown_Name) " it is specified to obtain The lower right corner cell object in region, wherein rightdown_Name are the lower right corner cell values in specified region, LrightdownCell is the lower right corner cell object in specified region.
Finally, pass through " int leftupRow=leftupCell.getRow (), int leftupColumn= LeftupCell.getColumn (), int rightdown Row=rightdown Cell.getRow (), Intrightdown Column=rightdown Cell.getColumn () " obtain upper left corner cell object respectively The line number of line number leftupRow, the row number leftupColumn of upper left corner cell object, lower right corner cell object The row number rightdown Column of rightdown Row, lower right corner cell object then specify the line number in region to be located at data Between the middle leftupRow to rightdown Row of table, the row number in specified region is located at the middle leftup of data form Between Column to rightdown Column.By for searching loop line numbers be located at the line number of upper left corner cell object with Between the line number of lower right corner cell object, row number be located at the row number of upper left corner cell object and lower right corner cell object Cell between row number reads the value of cell obtained by traversal, obtains specified territory element lattice value.By the above-mentioned means, It realizes and cell value in the entire area for specifying region is obtained according to diagonal cell during interface calls.
As it can be seen that the method achieve in the journey that automatic test is crossed, it can phase by the way that action type is arranged between interface Interoperability data table, without writing complicated database script.
The embodiment of the present application also provides a kind of list data interactive device, and the list data interactive device is aforementioned for executing Any embodiment of list data exchange method.Specifically, referring to Fig. 6, Fig. 6 is a kind of table provided by the embodiments of the present application The schematic block diagram of data interaction device.List data interactive device 100 can be configured at desktop computer, tablet computer, portable Computer, etc. in terminals.
As shown in fig. 6, list data interactive device 100 include table initialization unit 101, cell creating unit 102, Data write unit 103 and operating result feedback unit 104.
Wherein, table initialization unit 101 is used for initialization data table.
In one embodiment, as shown in fig. 7, the table initialization unit 101 includes:
Object Creation unit 1011, for creating the Workbook objects for being used to open Excel books;
Table adding unit 1012, for adding blank form in Workbook objects;
Initial row adding unit 1013, for adding initial row in blank form.
In the present embodiment, during carrying out automatic test, a certain function module (it is denoted as the first function module, Its external interface is denoted as first interface) it needs (to be denoted as the second function module, external interface is denoted as with another function module Second interface) it interacts, if there is data that need to be transmitted to the progress of the second function module by second interface in the first function module When write-in, the first initialization data table in the second function module is needed, to receive the data transmitted by the first function module.
Wherein, it creates after being used to open the Workbook objects of Excel books, is existed by wb.createSheet instructions Blank form is added in Workbook objects, is then added in blank form by sheet.createRow ((int) 0) instructions Add initial row.After carrying out aforesaid operations, i.e., table is automatically quickly created in the second function module to store data.
Cell creating unit 102, for the creating unit lattice in data form, setting gauge outfit is placed in the middle.
In the present embodiment, in data form after creating unit lattice, need to first create the attribute of a configuration placed in the middle, and gauge outfit is set The title respectively arranged.Wherein,
Format placed in the middle is created by style.setAlignment (HSSFCellStyle.ALIGN_CENTER);
By setSheetHeader (row, style), the title that gauge outfit respectively arranges is set;
Such as pass through:
cell.setEncoding(HSSFCell.ENCODING_UTF_16);Cell.setCellValue (" student number ");
To create this row of entitled student number in gauge outfit and it is necessary to pass through cell.setEncoding (HSSFCell.ENCODING_UTF_16) exports coding is carried out to be arranged to prevent Chinese Random Code.By above-mentioned setting, can ensure that Every attribute of the data form created is rapidly initialized, and can be reduced the stand-by period before data import, be improved data Interactive efficiency.
Data write unit 103, the importing data for obtaining data form to be imported will import data and are inserted into data Table obtains importing data form.
In the present embodiment, by insertDatasToSheet (sheet, list) by the importing of data form to be imported Data are inserted into data form, obtain importing data form;The read-write of database and data form (such as Excel tables) passes through POI.JAR packets realize that Apache POI are the open source code function libraries of Apache Software Foundation, and POI provides API to Java The function that program is read and write to Microsoft Office format archives.
POI.JAR packets include HSSF patterns, and HSSF is the abbreviation of Horrible SpreadSheetFormat, is passed through HSSF user can read, be written, change Excel file by pure Java code.HSSF provides two classes for read operation API:Usermodel and eventusermodel, i.e. " user model " and " event-user model ".Such as:HSSFWorkbook Indicate Excel document object;HSSFName indicates title;HSSFCellStyle indicates the pattern of cell; HSSFErrorConstants indicates erropr message list etc..
Operating result feedback unit 104, the data manipulation type for obtaining user according to the action type of data and are led Enter data form and obtains operating result corresponding with data manipulation type.
In the present embodiment, it when carrying out various operations to the importing data imported in data form, need to first pass through FileInputStream (i.e. file byte reading flow) obtains the Excel flow data in data form to be imported, then passes through " Workbook.getWorkbook (in) " obtains all importing data in data form to be imported, finally according to data form The Sheet indexes or Sheet name acquiring Sheet objects of (i.e. Excel tables), that is, pass through " Sheet sheet= Workbook.getSheet (sheetIndex/sheetName) " obtains the Sheet objects of Excel tables.
In one embodiment, as shown in figure 8, the operating result feedback unit 104 includes:
First left cell lattice object acquisition unit 1041a, if the data manipulation type for user is according to left side list First lattice obtain right sided cell lattice value, and left cell lattice object is obtained according to left cell lattice current in data form are imported;
It is single to obtain right side for the columns of left cell lattice object to be added one by right sided cell lattice object acquisition unit 1042a First lattice object;
Right sided cell lattice value acquiring unit 1043a obtains right side for reading value included in right sided cell lattice object Cell value.
In the present embodiment, as the first embodiment of data manipulation, " CellleftCell=is first passed through Sheet.findCell (left_Name) " obtains current left cell lattice object, and wherein leftCell indicates a current left side Side unit lattice object, left_Name indicate that left cell lattice value, sheet.findCell (left_Name) indicate positioning Excel Cell object corresponding with left_Name in table.
Then by " Cell rightCell=sheet.getCell (leftCell.getColumn ()+1, LeftCell.getRow ()) ", wherein rightCell indicates right sided cell lattice object, [leftCell.getColumn ()+1, LeftCell.getRow ()] columns of left cell lattice object is added one for expression and line number remains unchanged, sheet.getCell (leftCell.getColumn ()+1, leftCell.getRow ()) indicate location data table in The corresponding cell object of leftCell.getColumn ()+1, leftCell.getRow ().
The right side is obtained finally by " String rightValue=rightCell.getContents () .trim () " Side unit lattice value, wherein rightValue indicate right sided cell lattice value, and right sided cell lattice value is particular by .getContents () .trim () method obtains.It is obtained according to left cell lattice during interface calls by the above-mentioned means, realizing Right cell lattice value.
In one embodiment, as shown in figure 9, the operating result feedback unit 104 includes:
Second left cell lattice object acquisition unit 1041b, if the data manipulation type for user is according to left side list First lattice obtain full line cell value, and left cell lattice object is obtained according to left cell lattice current in data form are imported;
Columns acquiring unit 1042b, line number and row number for obtaining left cell lattice object, and obtain data to be imported Total columns in table;
Row Traversal Unit 1043b with left cell lattice object there is identical line number and row number to be located at left side list for traversing Cell between the row number and total columns of first lattice object reads the value of cell obtained by traversal, obtains left cell lattice institute The full line cell value being expert at.
In the present embodiment, as the second embodiment of data manipulation, " CellleftCell=is first passed through Sheet.findCell (left_Name) " obtains left cell lattice object, and wherein leftCell indicates left cell lattice pair As, left_Name indicates left cell lattice value, sheet.findCell (left_Name) indicate in positioning Excel tables with The corresponding cell objects of left_Name.Then, the line number and row number of left cell lattice object are obtained, and obtains importing data Total columns in table.Finally traversal has identical line number with left cell lattice object and row number is located at left cell lattice object Cell between row number and total columns reads the value of cell obtained by traversal, obtains the full line that left cell lattice are expert at Cell value.By the above-mentioned means, realizing full line cell value is obtained according to left cell lattice during interface calls.
In one embodiment, as shown in Figure 10, the operating result feedback unit 104 includes:
Upper left corner cell object acquisition unit 1041c, if the data manipulation type for user is according to diagonal line list First lattice, which obtain, specifies territory element lattice value, specifies the upper left corner cell value in region to obtain the upper left corner according to importing in data form Cell object;
Lower right corner cell object acquisition unit 1042c, for right according to specifying the lower right corner cell value in region to obtain Inferior horn cell object;
Specified territory element lattice value acquiring unit 1043c, the line number of upper left corner cell object is located at for traversing line number Between the line number of lower right corner cell object, row number be located at the row number and lower right corner cell object of upper left corner cell object Row number between cell, read the value of cell obtained by traversal, obtain specified territory element lattice value.
In the present embodiment, as the 3rd embodiment of data manipulation, " CellleftupCell=is first passed through Sheet.findCell (leftup_Name) " obtains the upper left corner cell object in specified region, wherein leftup_Name It is the upper left corner cell value in specified region, leftupCell is the upper left corner cell object in specified region.
Then pass through Cell rightdownCell=sheet.findCell (rightdown_Name) " it is specified to obtain The lower right corner cell object in region, wherein rightdown_Name are the lower right corner cell values in specified region, LrightdownCell is the lower right corner cell object in specified region.
Finally, pass through " int leftupRow=leftupCell.getRow (), int leftupColumn= LeftupCell.getColumn (), int rightdown Row=rightdown Cell.getRow (), Intrightdown Column=rightdown Cell.getColumn () " obtain upper left corner cell object respectively The line number of line number leftupRow, the row number leftupColumn of upper left corner cell object, lower right corner cell object The row number rightdown Column of rightdown Row, lower right corner cell object then specify the line number in region to be located at data Between the middle leftupRow to rightdown Row of table, the row number in specified region is located at the middle leftup of data form Between Column to rightdown Column.By for searching loop line numbers be located at the line number of upper left corner cell object with Between the line number of lower right corner cell object, row number be located at the row number of upper left corner cell object and lower right corner cell object Cell between row number reads the value of cell obtained by traversal, obtains specified territory element lattice value.By the above-mentioned means, It realizes and cell value in the entire area for specifying region is obtained according to diagonal cell during interface calls.
As it can be seen that the arrangement achieves in the journey that automatic test is crossed, it can phase by the way that action type is arranged between interface Interoperability data table, without writing complicated database script.
Above table data interaction device can be implemented as a kind of form of computer program, which can be It is run on computer equipment as shown in figure 11.
Please refer to Fig.1 the schematic block diagram that 1, Figure 11 is a kind of computer equipment provided by the embodiments of the present application.The calculating 500 equipment of machine equipment can be terminal.The terminal can be tablet computer, laptop, desktop computer, personal digital assistant Equal electronic equipments.
Refering to fig. 11, which includes processor 502, memory and the net connected by system bus 501 Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program 5032 include program instruction, which is performed, and processor 502 may make to execute a kind of list data exchange method.
The processor 502 supports the operation of entire computer equipment 500 for providing calculating and control ability.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should When computer program 5032 is executed by processor 502, processor 502 may make to execute a kind of list data exchange method.
The network interface 505 such as sends the task dispatching of distribution for carrying out network communication.Those skilled in the art can manage It solves, structure is not constituted only with the block diagram of the relevant part-structure of application scheme to the application side shown in Figure 11 The restriction for the computer equipment 500 that case is applied thereon, specific computer equipment 500 may include more than as shown in the figure Or less component, it either combines certain components or is arranged with different components.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following work( Energy:Initialization data table;The creating unit lattice in data form, setting gauge outfit are placed in the middle;Obtain leading for data form to be imported Enter data, data will be imported and be inserted into data form, obtain importing data form;The data manipulation type for obtaining user, according to The action type and importing data form of data obtain operating result corresponding with data manipulation type.
In one embodiment, processor 502 also executes following operation:Establishment is used to open Excel books Workbook objects;Blank form is added in Workbook objects;Initial row is added in blank form.
In one embodiment, processor 502 also executes following operation:If the data manipulation type of user is according to left side list First lattice obtain right sided cell lattice value, and left cell lattice object is obtained according to left cell lattice current in data form are imported;It will The columns of left cell lattice object adds one, obtains right sided cell lattice object;Value included in right sided cell lattice object is read, is obtained To right sided cell lattice value.
In one embodiment, processor 502 also executes following operation:If the data manipulation type of user is according to left side list First lattice obtain full line cell value, and left cell lattice object is obtained according to left cell lattice current in data form are imported;It obtains The line number and row number of left cell lattice object are taken, and obtains total columns in data form to be imported;Traversal and left cell lattice pair As being located at the cell between the row number and total columns of left cell lattice object with identical line number and row number, traversal institute is read The value of cell is obtained, the full line cell value that left cell lattice are expert at is obtained.
In one embodiment, processor 502 also executes following operation:If the data manipulation type of user is according to diagonal line Cell, which obtains, specifies territory element lattice value, specifies the upper left corner cell value in region to obtain upper left according to importing in data form Angle cell object;Lower right corner cell object is obtained according to the lower right corner cell value in specified region;It traverses line number and is located at a left side Between the line number and the line number of lower right corner cell object of upper angle cell object, row number be located at the row of upper left corner cell object Cell number between the row number of lower right corner cell object reads the value of cell obtained by traversal, obtains specified region Cell value.
It will be understood by those skilled in the art that the embodiment of computer equipment shown in Figure 11 is not constituted to computer The restriction of equipment specific composition, in other embodiments, computer equipment may include components more more or fewer than diagram, or Person combines certain components or different components arrangement.For example, in some embodiments, computer equipment can only include depositing Reservoir and processor, in such embodiments, the structure and function of memory and processor are consistent with embodiment illustrated in fig. 11, Details are not described herein.
It should be appreciated that in the embodiment of the present application, processor 502 can be central processing unit (CentralProcessing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit (Application Specific IntegratedCircuit, ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or Person other programmable logic device, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor Can be microprocessor or the processor can also be any conventional processor etc..
A kind of storage medium is provided in another embodiment of the application.The storage medium can be computer-readable storage Medium.The storage medium is stored with computer program, and wherein computer program includes program instruction.The program instruction is by processor It is realized when execution:Initialization data table;The creating unit lattice in data form, setting gauge outfit are placed in the middle;Obtain data to be imported The importing data of table will import data and be inserted into data form, obtain importing data form;Obtain the data manipulation class of user Type according to the action type of data and imports data form acquisition operating result corresponding with data manipulation type.
In one embodiment, it is realized when which is executed by processor:Establishment is used to open Excel books Workbook objects;Blank form is added in Workbook objects;Initial row is added in blank form.
In one embodiment, it is realized when which is executed by processor:If according to the data manipulation type of user Left cell lattice obtain right sided cell lattice value, and left cell lattice pair are obtained according to left cell lattice current in data form are imported As;The columns of left cell lattice object is added one, obtains right sided cell lattice object;Included by reading in right sided cell lattice object Value, obtains right sided cell lattice value.
In one embodiment, it is realized when which is executed by processor:If according to the data manipulation type of user Left cell lattice obtain full line cell value, and left cell lattice pair are obtained according to left cell lattice current in data form are imported As;The line number and row number of left cell lattice object are obtained, and obtains total columns in data form to be imported;Traversal and left cell Lattice object has identical line number and row number is located at the cell between the row number and total columns of left cell lattice object, reading time The value of cell, obtains the full line cell value that left cell lattice are expert at obtained by going through.
In one embodiment, it is realized when which is executed by processor:If according to the data manipulation type of user Diagonal cell, which obtains, specifies territory element lattice value, specifies the upper left corner cell value in region to obtain according to importing in data form Take upper left corner cell object;Lower right corner cell object is obtained according to the lower right corner cell value in specified region;Traverse line number Between the line number and the line number of lower right corner cell object of upper left corner cell object, row number be located at upper left corner cell pair Cell between the row number and the row number of lower right corner cell object of elephant reads the value of cell obtained by traversal, is referred to Determine territory element lattice value.
The storage medium can be the internal storage unit of aforementioned device, such as the hard disk or memory of equipment.It is described to deposit Storage media can also be the plug-in type hard disk being equipped on the External memory equipment of the equipment, such as the equipment, intelligent storage Block (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc.. Further, the storage medium can also both include the equipment internal storage unit and also including External memory equipment.
It is apparent to those skilled in the art that for convenience of description and succinctly, foregoing description is set The specific work process of standby, device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein. Those of ordinary skill in the art may realize that units and algorithm described in conjunction with the examples disclosed in the embodiments of the present disclosure Step can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and software Interchangeability generally describes each exemplary composition and step according to function in the above description.These functions are studied carefully Unexpectedly the specific application and design constraint depending on technical solution are implemented in hardware or software.Professional technician Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed The scope of the present invention.
In several embodiments provided herein, it should be understood that disclosed unit and method, it can be with It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit It divides, only a kind of division of logic function, formula that in actual implementation, there may be another division manner can also will have identical work( The unit set of energy can be combined or can be integrated into another system at a unit, such as multiple units or component, or Some features can be ignored or not executed.In addition, shown or discussed mutual coupling or direct-coupling or communication link It can be INDIRECT COUPLING or communication connection by some interfaces, device or unit to connect, and can also be electricity, mechanical or other Form connection.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple In network element.Some or all of unit therein can be selected according to the actual needs to realize the embodiment of the present invention Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also It is that each unit physically exists alone, can also be during two or more units are integrated in one unit.It is above-mentioned integrated The form that hardware had both may be used in unit is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can be stored in a storage medium.Based on this understanding, technical scheme of the present invention is substantially in other words to existing The all or part of part or the technical solution that technology contributes can be expressed in the form of software products, should Computer software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be Personal computer, server or network equipment etc.) execute all or part of step of each embodiment the method for the present invention Suddenly.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disc or The various media that can store program code such as person's CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right It is required that protection domain subject to.

Claims (10)

1. a kind of list data exchange method, which is characterized in that including:
Initialization data table;
The creating unit lattice in data form, setting gauge outfit are placed in the middle;
The importing data for obtaining data form to be imported will import data and be inserted into the corresponding unit lattice of data form, obtain Import data form;
The data manipulation type for obtaining user according to the action type of data and imports data form acquisition and data manipulation type Corresponding operating result.
2. list data exchange method according to claim 1, which is characterized in that the initialization data table, including:
Create the Workbook objects for being used to open Excel books;
Blank form is added in Workbook objects;
Initial row is added in blank form.
3. list data exchange method according to claim 1, which is characterized in that the data manipulation class for obtaining user Type according to the action type of data and imports data form acquisition operating result corresponding with data manipulation type, including:
If the data manipulation type of user be according to left cell lattice obtain right sided cell lattice value, according to import data form in when Preceding left cell lattice obtain left cell lattice object;
The columns of left cell lattice object is added one, obtains right sided cell lattice object;
Value included in right sided cell lattice object is read, right sided cell lattice value is obtained.
4. list data exchange method according to claim 1, which is characterized in that the data manipulation class for obtaining user Type according to the action type of data and imports data form acquisition operating result corresponding with data manipulation type, including:
If the data manipulation type of user be according to left cell lattice obtain full line cell value, according to import data form in when Preceding left cell lattice obtain left cell lattice object;
The line number and row number of left cell lattice object are obtained, and obtains total columns in data form to be imported;
Traversal and left cell lattice object have identical line number and row number be located at left cell lattice object row number and total columns it Between cell, read traversal obtained by cell value, obtain the full line cell value that left cell lattice are expert at.
5. list data exchange method according to claim 1, which is characterized in that the data manipulation type of user is obtained, According to the action type of data and data form acquisition operating result corresponding with data manipulation type is imported, including:
If the data manipulation type of user is to be obtained to specify territory element lattice value according to diagonal cell, according to importing tables of data The upper left corner cell value in region is specified to obtain upper left corner cell object in lattice;
Lower right corner cell object is obtained according to the lower right corner cell value in specified region;
Traversal line number is located between the line number of upper left corner cell object and the line number of lower right corner cell object, row number is located at a left side Cell between the row number and the row number of lower right corner cell object of upper angle cell object reads cell obtained by traversal Value, obtain specified territory element lattice value.
6. a kind of list data interactive device, which is characterized in that including:
Table initialization unit is used for initialization data table;
Cell creating unit, for the creating unit lattice in data form, setting gauge outfit is placed in the middle;
Data write unit, the importing data for obtaining data form to be imported will import data and are inserted into data form, obtain To importing data form;
Operating result feedback unit, the data manipulation type for obtaining user according to the action type of data and import data Table obtains operating result corresponding with data manipulation type.
7. list data interactive device according to claim 6, which is characterized in that the operating result feedback unit, packet It includes:
First left cell lattice object acquisition unit, if the data manipulation type for user is to obtain the right side according to left cell lattice Side unit lattice value obtains left cell lattice object according to left cell lattice current in data form are imported;
Right sided cell lattice object acquisition unit obtains right sided cell lattice object for the columns of left cell lattice object to be added one;
Right sided cell lattice value acquiring unit obtains right sided cell lattice value for reading value included in right sided cell lattice object.
8. list data interactive device according to claim 6, which is characterized in that the operating result feedback unit, packet It includes:
Second left cell lattice object acquisition unit, if the data manipulation type for user is whole according to the acquisition of left cell lattice Row cell value obtains left cell lattice object according to left cell lattice current in data form are imported;
Columns acquiring unit, line number and row number for obtaining left cell lattice object, and obtain total in data form to be imported Columns;
Row Traversal Unit has identical line number with left cell lattice object for traversal and row number is located at left cell lattice object Row number and total columns between cell, read traversal obtained by cell value, obtain left cell lattice be expert at it is whole Row cell value.
9. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor The computer program of operation, which is characterized in that the processor is realized when executing the computer program as in claim 1-5 Any one of them list data exchange method.
10. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, the computer program packet Program instruction is included, described program instruction makes the processor execute such as any one of claim 1-5 institutes when being executed by a processor The list data exchange method stated.
CN201810539608.XA 2018-05-30 2018-05-30 List data exchange method, device, computer equipment and storage medium Pending CN108763505A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810539608.XA CN108763505A (en) 2018-05-30 2018-05-30 List data exchange method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810539608.XA CN108763505A (en) 2018-05-30 2018-05-30 List data exchange method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN108763505A true CN108763505A (en) 2018-11-06

Family

ID=64004163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810539608.XA Pending CN108763505A (en) 2018-05-30 2018-05-30 List data exchange method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108763505A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442854A (en) * 2019-08-13 2019-11-12 北京源清慧虹信息科技有限公司 Generation method, device, computer equipment and the readable storage medium storing program for executing of report
CN110647566A (en) * 2019-09-03 2020-01-03 平安科技(深圳)有限公司 Intelligent importing method and device of template table and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193782A (en) * 2010-03-01 2011-09-21 北京中企开源信息技术有限公司 Method for operating table model
CN103914438A (en) * 2012-12-30 2014-07-09 航天信息股份有限公司 Template and tag implementation based excel display and export method and system
CN104503955A (en) * 2014-12-03 2015-04-08 中建材国际贸易有限公司 Method for generating personalized excel form
CN104991776A (en) * 2015-07-09 2015-10-21 国云科技股份有限公司 Excel reading and writing method based on configuration

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102193782A (en) * 2010-03-01 2011-09-21 北京中企开源信息技术有限公司 Method for operating table model
CN103914438A (en) * 2012-12-30 2014-07-09 航天信息股份有限公司 Template and tag implementation based excel display and export method and system
CN104503955A (en) * 2014-12-03 2015-04-08 中建材国际贸易有限公司 Method for generating personalized excel form
CN104991776A (en) * 2015-07-09 2015-10-21 国云科技股份有限公司 Excel reading and writing method based on configuration

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WEIXIN_30741653: "数据导入到excel表中", 《HTTPS://BLOG.CSDN.NET/WEIXIN_30741653/ARTICLE/DETAILS/99745050》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442854A (en) * 2019-08-13 2019-11-12 北京源清慧虹信息科技有限公司 Generation method, device, computer equipment and the readable storage medium storing program for executing of report
CN110442854B (en) * 2019-08-13 2023-04-07 北京源清慧虹信息科技有限公司 Report generation method and device, computer equipment and readable storage medium
CN110647566A (en) * 2019-09-03 2020-01-03 平安科技(深圳)有限公司 Intelligent importing method and device of template table and computer readable storage medium
CN110647566B (en) * 2019-09-03 2023-04-14 平安科技(深圳)有限公司 Intelligent importing method and device of template table and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN107656914B (en) Configurable table generation method and device, terminal equipment and storage medium
CN107967316A (en) A kind of method of data synchronization, equipment and computer-readable recording medium
CN108762955A (en) Interface call method, device, computer equipment and storage medium
CN104376043B (en) Log recording and display methods and device
CN109657215A (en) Document structure tree method, equipment, storage medium and device based on template
CN108363566A (en) File configuration method, intelligent terminal and storage medium in a kind of project development process
CN102663103A (en) Configurable method for automatically generating database and accessing data
CN108664396A (en) Bank's interactive interface verification method, device, computer equipment and storage medium
CN110648138A (en) Transaction query and transaction data processing method, device and equipment based on block chain
CN108763505A (en) List data exchange method, device, computer equipment and storage medium
CN108228551B (en) excel data import method, device, equipment and computer readable storage medium
CN108388515A (en) Test data generating method, device, equipment and computer readable storage medium
CN109145055A (en) A kind of method of data synchronization and system based on Flink
CN108446326B (en) A kind of isomeric data management method and system based on container
US9886243B2 (en) Declarative configuration and execution of card content management operations for trusted service manager
CN103440198A (en) Method for calibrating form
US10496423B2 (en) Method for opening up data and functions of terminal application based on reconstruction technology
CN104346407B (en) Form and the method and its device of XML file data interaction in data reporting system
US20180374047A1 (en) Computing framework for compliance report generation
CN107943455A (en) A kind of list rendering system based on JSON data formats
CN109101229A (en) A kind of code automatic generation method of object-oriented, device and equipment
CN114443039A (en) Input parameter verification method and device, electronic equipment and storage medium
CN107885644A (en) It is a kind of based on the method that BIOS default values are quickly checked under linux system
CN110110295A (en) Large sample grinds report information extracting method, device, equipment and storage medium
CN115480748A (en) Service arrangement method, device and storage medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181106