本文整理汇总了TypeScript中xlsx.write函数的典型用法代码示例。如果您正苦于以下问题:TypeScript write函数的具体用法?TypeScript write怎么用?TypeScript write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: printBalance
printBalance(data: Balance[]): any {
const wb = new Workbook();
const COLUMNS = [
{title: 'Institution', att: ['coe', 'institution', 'name']},
{title: 'Student', att: ['coe', 'student', 'name']},
{title: 'Expected Commission', att: ['expectedCommission']},
{title: 'Expected Gts', att: ['expectedGts']},
{title: 'Total Expected', att: ['expectedAmount']},
{title: 'Received Amount', att: ['receivedAmount']},
{title: 'Remaining Amount', att: ['remainingAmount']}
];
const ws = this.getSheetFromData(COLUMNS, data);
/* add worksheet to workbook */
const ws_name = 'balance';
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
/* write file */
const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: true, type: 'binary'});
return wbout;
}
开发者ID:australdev,项目名称:app,代码行数:25,代码来源:xlsx_service.ts
示例2: printPayments
printPayments(data: Payment[]): any {
const wb = new Workbook();
const COLUMNS = [
{title: 'Institution', att: ['studyPeriod', 'coe', 'institution', 'name']},
{title: 'Student', att: ['studyPeriod', 'coe', 'student', 'name']},
{title: 'Course Fee', att: ['coursePayment']},
{title: 'Commission (%)', att: ['commPerc']},
{title: 'Gts', att: ['dataToPrintGts']},
{title: 'Expected Commission', att: ['expectedComm']},
{title: 'Expected Value', att: ['expectedValue']},
{title: 'Due To', att: ['expectedDate'], date: true },
{title: 'Received Value', att: ['receivedValue']},
{title: 'Invoice #', att: ['invoice']}
];
const ws = this.getSheetFromData(COLUMNS, data);
/* add worksheet to workbook */
const ws_name = 'students';
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
/* write file */
const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: true, type: 'binary'});
return wbout;
}
开发者ID:australdev,项目名称:app,代码行数:28,代码来源:xlsx_service.ts
示例3: exportAsExcelFile
public exportAsExcelFile(json: any[], excelFileName: string): void {
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
console.log('worksheet',worksheet);
const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
//const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'buffer' });
this.saveAsExcelFile(excelBuffer, excelFileName);
}
开发者ID:abuabbas1991365,项目名称:cashgift,代码行数:9,代码来源:excel.service.ts
示例4: exportReport
///export report 3 sheets
public exportReport(json, excelFileName: string): void {
let worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json[0]);
let worksheet1: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json[1]);
let worksheet2: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json[2]);
// tslint:disable-next-line:max-line-length
let workbook: XLSX.WorkBook = { Sheets: { 'report1': worksheet, 'report2': worksheet1 , 'report3': worksheet2}, SheetNames: ['report1','report2', 'report3'] };
let excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
this.saveAsExcelFile(excelBuffer, excelFileName);
}
开发者ID:Sysarksteam,项目名称:RecipeManagementUI,代码行数:12,代码来源:excel.service.ts
示例5:
bookType: "xlsx",
sheet: "Sheet1",
compression: false,
Props: {
Author: "Someone",
Company: "SheetJS LLC"
}
};
const wb1 = XLSX.readFile("sheetjs.xls", read_opts);
XLSX.writeFile(wb1, "sheetjs.new.xlsx", write_opts);
read_opts.type = "binary";
const wb2 = XLSX.read("1,2,3\n4,5,6", read_opts);
write_opts.type = "binary";
const out2 = XLSX.write(wb2, write_opts);
read_opts.type = "buffer";
const wb3 = XLSX.read(fs.readFileSync("sheetjs.xlsx"), read_opts);
write_opts.type = "base64";
const out3 = XLSX.write(wb3, write_opts);
write_opts.type = "array";
const out4 = XLSX.write(wb3, write_opts);
const ws1 = XLSX.utils.aoa_to_sheet([
"SheetJS".split(""),
[1,2,3,4,5,6,7],
[2,3,4,5,6,7,8]
], {
dateNF: "yyyy-mm-dd",
cellDates: true,
开发者ID:CareerFairPlus,项目名称:js-xlsx,代码行数:31,代码来源:doc.ts
示例6:
import * as XLSX from 'xlsx';
console.log(XLSX.version);
const bookType: string = "xlsb";
const fn: string = "sheetjsfbox." + bookType
const sn: string = "SheetJSFBox";
const aoa: any[][] = [ ["Sheet", "JS"], ["Fuse", "Box"], [72, 62] ];
var wb: XLSX.WorkBook = XLSX.utils.book_new();
var ws: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(aoa);
XLSX.utils.book_append_sheet(wb, ws, sn);
var payload: string = "";
var w2: XLSX.WorkBook;
if(typeof process != 'undefined' && process.versions && process.versions.node) {
/* server */
XLSX.writeFile(wb, fn);
w2 = XLSX.readFile(fn)
} else {
/* client */
payload = XLSX.write(wb, {bookType: "xlsb", type:"binary"});
w2 = XLSX.read(payload, {type:"binary"});
}
var s2: XLSX.WorkSheet = w2.Sheets[sn];
console.log(XLSX.utils.sheet_to_csv(s2));
开发者ID:CareerFairPlus,项目名称:js-xlsx,代码行数:28,代码来源:sheetjs.ts
注:本文中的xlsx.write函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论