Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function downloadXLSX(
gettext_provider: VueGettextProvider,
milestone_title: string,
report: ExportReport
): void {
const book = utils.book_new();
const sheet = transformAReportIntoASheet(report);
utils.book_append_sheet(book, sheet);
writeFile(
book,
gettext_provider.$gettextInterpolate(
gettext_provider.$gettext("Test Report %{ milestone_title }"),
{ milestone_title }
) + ".xlsx",
{ bookSST: true }
);
}
exportFile(type: 'csv' | 'xlsx', all = true) {
const wb = utils.book_new();
let ws: WorkSheet;
if (all) {
ws = utils.json_to_sheet(this.rows);
} else {
ws = utils.json_to_sheet(this.nzTable.data);
}
utils.book_append_sheet(wb, ws, 'Sheet1');
writeFile(wb, `export.${type}`);
}
createContent(worksheet, options) {
/** @type {?} */
const workBook = utils.book_new();
if (!options) {
options = (/** @type {?} */ ({}));
}
this.correctType(options);
utils.book_append_sheet(workBook, worksheet, options.sheet);
return write(workBook, options);
}
/**
function (worksheet, options) {
/** @type {?} */
var workBook = utils.book_new();
if (!options) {
options = (/** @type {?} */ ({}));
}
this.correctType(options);
utils.book_append_sheet(workBook, worksheet, options.sheet);
return write(workBook, options);
};
/**
exportFile(type: 'csv' | 'tsv'): void {
if (this.tableData && this.tableData.rows) {
const wb = utils.book_new();
let ws: WorkSheet;
ws = utils.json_to_sheet(this.tableData.rows);
utils.book_append_sheet(wb, ws, 'Sheet1');
writeFile(wb, `export.${type}`, {
bookType: 'csv',
FS: type === 'tsv' ? '\t' : ','
} as WritingOptions);
}
}