Để viết một tệp
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]6, người ta phải cung cấp
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]0 — một mảng các hàng. Mỗi hàng phải là một mảng ô
Mỗi ô phải có một
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]1, một
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]2 và, tùy chọn, các tham số ô khác
Nếu một ô không có
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]2 thì nó sẽ tự động được phát hiện từ
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]1 hoặc mặc định là
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]5
Một ô trống có thể được đại diện bởi
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]6 hoặc
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]7
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
API
trình duyệt
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]
Sử dụng
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]8 để lưu tệp
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]6 từ trình duyệt web
Nếu tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]30 không được truyền thì
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]31 được trả về sẽ phân giải thành "đốm màu" với nội dung của tệp
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]6
Nút. js
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
Nếu tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]33 không được truyền, nhưng tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]34 được truyền, thì nó sẽ trả về một giá trị
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]35
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]3
Nếu cả tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]33 và tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]34 đều không được truyền, thì nó sẽ trả về một giá trị có thể đọc được là
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]38
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]4AWS S3 có thể từ chối chấp nhận
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]39
AWS S3 có thể ném
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]40
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]7
Lý do là AWS S3 chỉ chấp nhận các luồng có độ dài đã biết và không thể biết trước độ dài của tệp zip
Giải pháp thay thế cho AWS SDK v2. ghi vào
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]35 thay vì một luồng
Giải pháp thay thế cho AWS SDK v3. sử dụng hoạt động
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]42
Lược đồ
Ngoài ra, thay vì cung cấp
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]0, người ta có thể cung cấp danh sách
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]44 và
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]45 mô tả từng cột
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]3
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]4
Khi sử dụng
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]45, cần có cột
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]2 [không được tự động phát hiện]
API lược đồ
trình duyệt
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]7
Nút. js
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]0
Thông số ô
Ngoài việc có một
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]2 và một
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]1, mỗi ô [hoặc cột lược đồ] cũng có thể có
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
70 — Căn ngang nội dung ô. giá trị có sẵn.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
71,const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
72,const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
73const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
74 — Căn dọc nội dung ô. giá trị có sẵn.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
75,const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
72,const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
77const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
78 — Chiều cao hàng, tính bằng "điểm"const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
79 — Nhịp cột. Ngay cả khi một ô kéo dài ________ 330 cột, nó vẫn phải được biểu diễn dưới dạng ________ 330 ô riêng lẻ trongconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
0. Trong trường hợp đó, tất cả các ô ngoại trừ ô ngoài cùng bên trái sẽ bị bỏ qua. Người ta có thể sử dụngconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
6 hoặcconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
7 để đại diện cho các ô bị bỏ qua như vậy. Ví dụ: nếu ô đầu tiên trong một hàng kéo dài 3 cột, thì hàng đó sẽ trông giống nhưconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
35const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
36 — Khoảng cách hàng. Ngay cả khi một ô kéo dài ________ 330 hàng, nó vẫn phải được biểu diễn dưới dạng ________ 330 ô riêng lẻ trongconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
0. Trong trường hợp đó, tất cả các ô ngoại trừ ô trên cùng sẽ bị bỏ qua. Người ta có thể sử dụngconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
6 hoặcconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
7 để đại diện cho các ô bị bỏ qua như vậy. Ví dụ: nếu ô trên cùng bên trái kéo dài 2 hàng, thì hàng đầu tiên sẽ trông giống nhưconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
42 và hàng thứ hai sẽ giống nhưconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
43const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
44 — Đặt thànhconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
45 để "ngăn" văn bản khi nó tràn ôconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
46 — Có thể được sử dụng để in văn bản trong họ phông chữ tùy chỉnh. Thí dụ.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
47const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
48 — Có thể được sử dụng để in văn bản ở cỡ chữ tùy chỉnh. Thí dụ.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
49const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
70 — Có thể dùng để in đậm văn bản. giá trị có sẵn.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
71const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
72 — Có thể được sử dụng để in nghiêng văn bản. giá trị có sẵn.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
73________ 374 — Màu văn bản của ô [ở định dạng thập lục phân]. Thí dụ.
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
75________ 376 — Màu nền của ô [ở định dạng thập lục phân]. Thí dụ.
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
75const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
78 — Màu viền ô. Thí dụ.const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
75const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
00 — Kiểu viền ô. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
01const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
02const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
03const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
04const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
05const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
06const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
07const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
08const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
09
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
10 — Định dạng dữ liệu di động. Chỉ có thể được sử dụng trên các ôconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
11 hoặcconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
12. Có nhiều định dạng được hỗ trợ trong tiêu chuẩnimport writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]
6. Một số cái phổ biếnconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
14 — Số dấu phẩy động có 2 chữ số thập phân. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
15const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
16 — Số dấu phẩy động có 3 chữ số thập phân. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
17const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
18 — Số có dấu phẩy ở phân cách hàng nghìn, như được sử dụng ở hầu hết các quốc gia nói tiếng Anh. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
19const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
20 — Tiền tệ, như ở hầu hết các quốc gia nói tiếng Anh. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
21const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
22 — Phần trăm. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
23const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
24 — Phần trăm có 2 chữ số thập phân. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
25Tất cả các ô
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
11 [hoặc cột lược đồ] đều yêu cầu mộtconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
27 [trừ khi đặt giá trị mặc định làconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
28]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
29 — Định dạng ngày tháng của Hoa Kỳ. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
30 cho ngày 31 tháng 12 năm 2000const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
31 — Ví dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
32const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
33 — Ví dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
34const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
35 — Định dạng ngày giờ của Hoa Kỳ. Thí dụ.const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
36hoặc bất kỳ định dạng nào khác trong đó
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
37 — Hai chữ số cuối của số nămconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
38 — Bốn chữ số của một số nămconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
39 — Số tháng không có đầuconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40- ________ 941 — Số tháng có ________ 940 đứng đầu [khi nhỏ hơn ________ 943]
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
44 — Tên tháng [ngắn]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
45 — Tên tháng [dài]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
46 — Số ngày không có đầuconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
48 — Số ngày cóconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40 đứng đầu [khi nhỏ hơnconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
43]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
51 — Số giờ không có số đứng đầuconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
53 — Số giờ cóconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40 dẫn đầu [khi nhỏ hơnconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
43]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
41 — Phút cóconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40 dẫn trước [khi nhỏ hơnconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
43]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
59 — Giây cóconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
40 dẫn trước [khi nhỏ hơnconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
43]const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
62 — Hoặc làconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
63 hoặc làconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
64, tùy thuộc vào thời điểm
Tiêu đề bảng
Lược đồ
Khi sử dụng
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]45, tiêu đề cột có thể được đặt thông qua thuộc tính
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]66 trên mỗi cột. Nó sẽ được in ở đầu bảng
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]1
Nếu thuộc tính
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]66 bị thiếu thì tiêu đề cột sẽ không được in
Kiểu tiêu đề bảng mặc định là ________ 968 và ________ 969 giống như các cột lược đồ ________ 969. Người ta có thể cung cấp kiểu tiêu đề bảng tùy chỉnh bằng cách cung cấp tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]71
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]2
Dữ liệu di động
Khi không sử dụng lược đồ, người ta có thể in tiêu đề cột bằng cách cung cấp chúng dưới dạng hàng đầu tiên của
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]0
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]3
Chiều rộng cột
Chiều rộng cột cũng có thể được chỉ định [bằng "ký tự"]
Lược đồ
Để chỉ định chiều rộng cột khi sử dụng
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]45, hãy đặt
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]74 trên cột lược đồ
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]4
Dữ liệu di động
Khi không sử dụng lược đồ, người ta có thể cung cấp tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]75 riêng để chỉ định độ rộng cột
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]5
Nét chữ
Phông chữ mặc định là
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]76 tại
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]77. Để thay đổi phông chữ mặc định, truyền tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]78 và
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]79 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]6
Định hướng
Để chỉ định hướng tùy chỉnh [cho tất cả các trang tính], hãy chuyển tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]81 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]7
Định dạng ngày tháng
Để đặt định dạng ngày mặc định, hãy chuyển tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]28 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]8
hàng dính
Để làm cho một số hàng trên cùng "dính" [Excel gọi chúng là "đóng băng"], hãy chuyển tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]85 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]9
Cột dính
Để làm cho một số cột ở đầu "dính" [Excel gọi chúng là "đóng băng"], hãy chuyển tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]87 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]0
Tên trang tính
Để đặt tên trang tính mặc định, hãy chuyển tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]89 khi gọi
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]80
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]1
Nhiều trang tính
Lược đồ
Để tạo tệp
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]6 có nhiều trang tính
- Truyền tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
92 — một mảng tên trang tính - Đối số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
44 phải là một mảng củaconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
44 cho mỗi trang tính - Tham số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
45 phải là một mảng gồm cácconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
45 cho mỗi trang tính
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]2
Dữ liệu di động
Để tạo tệp
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]6 có nhiều trang tính
- Truyền tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
92 — một mảng tên trang tính - Đối số
const writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
0 phải là một mảng củaconst writeXlsxFile = require['write-excel-file/node'] await writeXlsxFile[data, { columns, // [optional] column widths, etc. filePath: '/path/to/file.xlsx' }]
0 cho mỗi trang tính - [tùy chọn] Tham số
const HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
75 phải là một mảng củaconst HEADER_ROW = [ { value: 'Name', fontWeight: 'bold' }, { value: 'Date of Birth', fontWeight: 'bold' }, { value: 'Cost', fontWeight: 'bold' }, { value: 'Paid', fontWeight: 'bold' } ] const DATA_ROW_1 = [ // "Name" { type: String, value: 'John Smith' }, // "Date of Birth" { type: Date, value: new Date[], format: 'mm/dd/yyyy' }, // "Cost" { type: Number, value: 1800 }, // "Paid" { type: Boolean, value: true } ] const data = [ HEADER_ROW, DATA_ROW_1, ... ]
75 cho mỗi trang tính
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]3
bản đánh máy
Thư viện này đi kèm với TypeScript "types". Nếu bạn tình cờ tìm thấy bất kỳ lỗi nào trong đó, hãy tạo một vấn đề
CDN
Người ta có thể sử dụng bất kỳ dịch vụ CDN npm nào, e. g. giải nén. com hoặc jsdelivr. mạng lưới
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]4
Người giới thiệu
Dự án này được lấy cảm hứng từ gói
import writeXlsxFile from 'write-excel-file' await writeXlsxFile[data, { columns, // [optional] column widths, etc. fileName: 'file.xlsx' }]03
GitHub
Vào ngày 9 tháng 3 năm 2020, GitHub, Inc. âm thầm cấm tài khoản của tôi [xóa tất cả các kho lưu trữ, các vấn đề và nhận xét của tôi, ngay cả trong các kho lưu trữ riêng tư của chủ nhân của tôi] mà không có bất kỳ thông báo hay lời giải thích nào. Do đó, tất cả các mã nguồn phải được chuyển ngay sang GitLab. Repo GitHub hiện chỉ được sử dụng làm bản sao lưu [bạn cũng có thể gắn dấu sao cho repo ở đó] và repo chính hiện là GitLab. Các vấn đề có thể được báo cáo trong bất kỳ repo nào