當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
ExcelJS —— Node 的 Excel 读写扩展模块2
生活随笔
收集整理的這篇文章主要介紹了
ExcelJS —— Node 的 Excel 读写扩展模块2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ExcelJS 是一個 Node.js 模塊,可用來讀寫和操作 XLSX 和 JSON 電子表格數據和樣式。
https://yqfile.alicdn.com/7f79947b9c23e2893ed394ca275fab6d1f22b535.png" >
示例代碼:
// Add column headers and define column keys and widths // Note: these column structures are a workbook-building convenience only, // apart from the column width, they will not be fully persisted. worksheet.columns = [{ header: "Id", key: "id", width: 10 },{ header: "Name", key: "name", width: 32 },{ header: "D.O.B.", key: "DOB", width: 10 } ];// Access an individual columns by key, letter and 1-based column number var idCol = worksheet.getColumn("id"); var nameCol = worksheet.getColumn("B"); var dobCol = worksheet.getColumn(3);// set column properties// Note: will overwrite cell value C1 dobCol.header = "Date of Birth";// Note: this will overwrite cell values C1:C2 dobCol.header = ["Date of Birth", "A.K.A. D.O.B."];// from this point on, this column will be indexed by "dob" and not "DOB" dobCol.key = "dob";dobCol.width = 15;// iterate over all current cells in this column dobCol.eachCell(function(cell, rowNumber) {// ... });// iterate over all current cells in this column including empty cells dobCol.eachCell({ includeEmpty: true }, function(cell, rowNumber) {// ... });文章轉載自 開源中國社區 [http://www.oschina.net]
總結
以上是生活随笔為你收集整理的ExcelJS —— Node 的 Excel 读写扩展模块2的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 即将到来的 Android N 将具备这
- 下一篇: Socket-Client通信