|
1 | | -## GExcelAPI |
| 1 | +GExcelAPI |
| 2 | +========= |
2 | 3 |
|
3 | | -GExcelAPI is a thin wrapper library powered by Groovy of Apache POI, not JExcelAPI. |
| 4 | +GExcelAPI is a thin Groovy-ish wrapper library of not JExcelAPI but Apache POI. |
4 | 5 |
|
5 | | -## Usage |
6 | 6 |
|
7 | | -About its usage, see a following article: |
| 7 | +Getting Started |
| 8 | +--------------- |
8 | 9 |
|
9 | | -* <http://nobeans-en.blogspot.jp/2011/11/gexcelapi-for-groovyist-using-ms-excel.html> |
| 10 | +It's difficult to read and write when using Apache POI directly. |
| 11 | +Especially, an identification of a cell to use an index is too complicated and ugly. |
10 | 12 |
|
11 | | -and a test code: |
| 13 | +```groovy |
| 14 | +File inputFile = ... |
| 15 | +def book = new HSSFWorkbook(new POIFSFileSystem(new FileInputStream(inputFile))) |
| 16 | +def sheet = book.getSheetAt(0) // 1st sheet |
| 17 | +println "A1: " + sheet.getRow(0)?.getCell((short) 0) |
| 18 | +println "A2: " + sheet.getRow(1)?.getCell((short) 0) |
| 19 | +println "B1: " + sheet.getRow(0)?.getCell((short) 1) |
| 20 | +``` |
12 | 21 |
|
13 | | -* <https://github.com/nobeans/gexcelapi/raw/master/src/test/groovy/org/jggug/kobo/gexcelapi/GExcelTest.groovy> |
| 22 | +By using GExcelAPI, you can write the above sample like this: |
14 | 23 |
|
15 | | -## Code Status |
| 24 | +```groovy |
| 25 | +File inputFile = ... |
| 26 | +def book = GExcel.open(inputFile) |
| 27 | +def sheet = book[0] // 1st sheet |
| 28 | +println "A1: " sheet.A1.value |
| 29 | +println "A2: " sheet.A2.value |
| 30 | +println "B1: " sheet.B1.value |
| 31 | +``` |
16 | 32 |
|
17 | | -* [](https://drone.io/github.com/nobeans/gexcelapi/latest) |
18 | 33 |
|
19 | | -## License |
| 34 | +How to get |
| 35 | +----------- |
| 36 | + |
| 37 | +### Grape |
| 38 | + |
| 39 | +```groovy |
| 40 | +@GrabResolver(name="bintray", root="http://dl.bintray.com/nobeans/maven") |
| 41 | +@GrabConfig(systemClassLoader=true) // necessary if you invoke it by GroovyServ |
| 42 | +@Grab("org.jggug.kobo:gexcelapi:0.4") |
| 43 | +import org.jggug.kobo.gexcelapi.GExcel |
| 44 | +
|
| 45 | +// example... |
| 46 | +def book = GExcel.open(args[0]) |
| 47 | +def sheet = book[0] |
| 48 | +println sheet.A1.value |
| 49 | +``` |
| 50 | + |
| 51 | + |
| 52 | +Test as Documentation |
| 53 | +--------------------- |
| 54 | + |
| 55 | +* <https://github.com/nobeans/gexcelapi/blob/master/src/test/groovy/org/jggug/kobo/gexcelapi/GExcelTest.groovy> |
| 56 | + |
| 57 | + |
| 58 | +Code Status |
| 59 | +----------- |
| 60 | + |
| 61 | +[](https://travis-ci.org/nobeans/gexcelapi) |
| 62 | + |
| 63 | + |
| 64 | +License |
| 65 | +------- |
20 | 66 |
|
21 | 67 | GExcelAPI is released under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0) |
0 commit comments