Giter Club home page Giter Club logo

kexcelapi's Introduction

KExcelAPI Build Status Coverage Status

English

KExcelAPIの紹介サイトです。

Kotlin用のApache POIのラッパーです。皆さん大好きなExcelをできるだけ簡単にアクセスできるように考えています。

このライブラリーはGExcelAPIから影響を受けて作成しています。

使い方

シートから、セル名かセルのインデックスを指定してCellオブジェクトを取得することができます。 セルオブジェクトからのデータの取得には型が必要なので、toInt、toDouble、toStr等のメソッドで値を取得します。 データのセットの場合には型が自明なため、「=」でExcel上に値をセットできます。

使い方の基本としては、拡張関数を使用しているため link.arata.kexcelapi.* パッケージをimportします。

import link.webarata3.kexcelapi.*

これだけで準備は完了です。これで、次のようにExcelへアクセスできます。

// 簡単にファイルオープン、クローズ
KExcel.open("file/book1.xlsx").use { workbook ->
    val sheet = workbook[0]

    // セルの読み込み
    // セル名でのアクセス
    println("""B7=${sheet["B7"].toStr()}""")
    // セルのインデックスでのアクセス [x, y]
    println("B7=${sheet[1, 6].toDouble()}")
    println("B7=${sheet[1, 6].toInt()}")

    // セルの書き込み
    sheet["A1"] = "あいうえお"
    sheet[3, 7] = 123

    // ファイルの書き込みも簡単に
    KExcel.write(workbook, "file/book2.xlsx")
}

Maven

Mavenのリポジトリ(Gradleの設定)は次のとおりです。

dependencies {
    compile 'link.webarata3.kexcelapi:kexcelapi:0.5.1'
}

ライセンス

MIT

kexcelapi's People

Contributors

webarata3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.