Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomiacannondale/wrap_excel
WrapExcel is a wrapper library that specializes in the operation of Excel win32ole.
https://github.com/tomiacannondale/wrap_excel
Last synced: 3 months ago
JSON representation
WrapExcel is a wrapper library that specializes in the operation of Excel win32ole.
- Host: GitHub
- URL: https://github.com/tomiacannondale/wrap_excel
- Owner: tomiacannondale
- License: mit
- Created: 2011-11-08T08:06:09.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-03-15T17:10:41.000Z (over 11 years ago)
- Last Synced: 2024-03-18T03:03:17.772Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 148 KB
- Stars: 13
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.ja.rdoc
- License: LICENSE
Lists
- awesome-ruby - wrap_excel - WrapExcel is to wrap the win32ole, and easy to use Excel operations with ruby. Detailed description please see the README. (Spreadsheets)
README
= WrapExcel
== 概要
WrapExcelはwin32oleをラップし、rubyによるExcelオペレーションを簡単にします。
== 必要なもの
* ruby 1.9.2以上 (プラットフォームはwindowsです)
== インストール
gem install wrap_excel
== 使い方
=== bookへのアクセスブロックを使用する場合
WrapExcel::Book.open('./sample.xls') do |book|
# do something
endブロックを使用しない場合
book = WrapExcel::Book.open('./sample.xls')
book.closeオプションは以下の通りです。
[read_only] boolean(default true)
[displayalerts] boolean(default false)
[visible] boolean(default false)=== sheetへのアクセス
sheetオブジェクトへは Book#[] メソッドでアクセス出来ます。
sheet = book[0]
シート名でのアクセス
book['Sheet1']
=== 行または列へのアクセス
sheetオブジェクトはenumerableをインクルードしています。Sheet#each_column or Sheet#each_row or Sheet#each メソッドが使用できます。
sheet.each do |cell|
# do something with cell
# read every row every column
endsheet.each_row do |row|
# do something with row_range
endsheet.each_column do |column_range|
# do something with column_range
end=== セルへのアクセス
sheetオブジェクトからのアクセス。
sheet[0, 0] => first cell.
rangeオブジェクトからのアクセス。
row_range[0] => first cell in row_range
column_range[1] => second cell in column_range=== ファイルの保存
既存のファイルは保存可能です。
WrapExcel::Book.open('./sample.xls', :read_only => false) do |book|
# do something
book.save
endもしくは
book = WrapExcel::Book.open('./sample.xls', :read_only => false)
book.save
book.close別のファイル名を保存することができます。
WrapExcel::Book.open('./sample.xls', :read_only => false) do |book|
# do something
book.save './another_file.xls'
endanother_file.xlsに保存します。
新規ファイルの保存は出来ません。
=== Want to do more things
全てのWrapExcelオブジェクトはwin32oleインスタンスを含んでいます。もし、あなたが、WrapExcelライブラリが提供していない機能を使用したい場合、win32oleのメソッドが使用出来ます。
== サポート
問題を報告したり、機能追加の要望する場合はgithubのIssuesに登録してください。 https://github.com/tomiacannondale/wrap_excel/issues
== 共同作業
githubのpull requestをしてください。
== 開発者
tomi mailto:[email protected]
== ライセンス
MITライセンスです。詳細は LICENSE を参照してください。