How to use the exceljs.stream function in exceljs

To help you get started, we’ve selected a few exceljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openkfw / TruBudget / excel-export / src / excel.ts View on Github external
export async function writeXLSX(
  axios: AxiosInstance,
  token: string,
  res: ServerResponse,
  base: string,
): Promise {
  try {
    const options = {
      stream: res,
      useStyles: true,
      useSharedStrings: true,
    };
    const { userId } = jwtDecode(token);
    const workbook = new Excel.stream.xlsx.WorkbookWriter(options);
    workbook.creator = userId ? userId : "Unknown TruBudget User";
    workbook.created = new Date();

    // Prepare sheets
    const projectSheet = workbook.addWorksheet("Projects");
    const subprojectSheet = workbook.addWorksheet("Subprojects");
    const workflowitemSheet = workbook.addWorksheet("Workflowitems");
    const projectProjectedBudgetsSheet = workbook.addWorksheet("Project Projected Budgets");
    const subprojectProjectedBudgetsSheet = workbook.addWorksheet("Subproject Projected Budgets");
    const documentSheet = workbook.addWorksheet("Documents");

    projectSheet.columns = [
      { header: "Project ID", key: "id", width: mediumWidth },
      { header: "Project Name", key: "displayName", width: mediumWidth },
      { header: "Created", key: "creationUnixTs", width: mediumWidth },
      { header: "Status", key: "status", width: smallWidth },
github PsChina / convert-excel-js / excel.js View on Github external
filename = filename.join(".");
  }
  return filename;
}

let filename;

if (process.argv[3]) {
  filename = getName(process.argv[3]);
} else {
  filename = getName(filePath);
}

filename = `${filename}.xlsx`.replace("[time]", new Date().toLocaleString());

const workbook = new Excel.stream.xlsx.WorkbookWriter({
  filename
});
const worksheet = workbook.addWorksheet("Sheet");

worksheet.columns = [
  { header: "key", key: "header" },
  { header: "value", key: "value" }
];

const dataArray = [];

getTiledData(data, dataArray);

const length = dataArray.length;

// 当前进度
github tidepool-org / data-analytics / node-data-tools / index.js View on Github external
static xlsxStreamWriter(outStream) {
    const options = {
      stream: outStream,
      useStyles: true,
      useSharedStrings: true,
    };
    const wb = new Excel.stream.xlsx.WorkbookWriter(options);

    return es.through(
      (data) => {
        if (data.type) {
          let sheet = wb.getWorksheet(data.type);
          if (_.isUndefined(sheet)) {
            sheet = wb.addWorksheet(data.type);
            try {
              sheet.columns = Object.keys(config[data.type]).map(field => ({
                header: field,
                key: field,
              }));
            } catch (e) {
              console.warn(`Warning: configuration ignores data type: '${data.type}'`);
            }
          }
github commercetools / nodejs / packages / product-json-to-xlsx / src / product-excel.js View on Github external
static init(
    outputStream: stream$Writable,
    worksheetName: string
  ): ExcelConfig {
    const workbookOpts: Object = {
      stream: outputStream,
      useStyles: true,
      useSharedStrings: true,
    }

    const workbook = new Excel.stream.xlsx.WorkbookWriter(workbookOpts)
    const worksheet = workbook.addWorksheet(worksheetName)
    return { workbook, worksheet }
  }

exceljs

Excel Workbook Manager - Read and Write xlsx and csv Files.

MIT
Latest version published 8 months ago

Package Health Score

76 / 100
Full package analysis