1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Node.jsでmerged cellしたり色塗ったりしたExcelを出力する

Posted at

以下のエントリーではofficegenをおすすめしている。

しかしofficegenはmerged cellしたり色塗ったりすることができないっぽい。
いろいろ触った結果、exceljsがよさそう。

  • 日本語出力できた
  • モデル的な操作もできる
const Excel = require('exceljs')
const workbook = new Excel.Workbook()
const sheet = workbook.addWorksheet('2017')

sheet.columns = [
  { header: 'Id', key: 'id', width: 10 },
  { header: 'Name', key: 'name', width: 32 },
  { header: 'D.O.B.', key: 'DOB', width: 10 }
]

sheet.addRow({id: 1, name: '太郎', dob: new Date(1970,1,1)})
sheet.addRow({id: 2, name: '二郎', dob: new Date(1965,1,7)})
  • merged cellもできる
sheet.mergeCells('A1:B5')
  • 色塗ったりテキストスタイルを指定したりもできる

ということで非常に多機能だし使いやすい。

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?