How to use the html-to-xlsx.getXlsxStyleNames function in html-to-xlsx

To help you get started, we’ve selected a few html-to-xlsx 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 jsreport / jsreport-html-to-xlsx / lib / mergeXlsx.js View on Github external
const targetCell = newSheetInTemplateWorkbook.cell(cell.rowNumber(), cell.columnNumber())

        // applying formula if some exists in the cell
        if (cell.formula() != null && cell.formula() !== 'SHARED') {
          targetCell.formula(cell.formula())
        }

        // copying number format style to be able to preserve date format or some ther custom format
        if (cell.style('numberFormat') != null) {
          targetCell.style('numberFormat', cell.style('numberFormat'))
        }

        const stylesToApply = {}

        getXlsxStyleNames().forEach((styleName) => {
          if (cell.style(styleName) != null) {
            stylesToApply[styleName] = cell.style(styleName)
          }
        })

        if (mergedAddress != null) {
          const range = newSheetInTemplateWorkbook.range(mergedAddress).merged(true)

          if (Object.keys(stylesToApply).length > 0) {
            range.style(stylesToApply)
          }

          mergedCells[mergedAddress] = true
        } else {
          if (Object.keys(stylesToApply).length > 0) {
            targetCell.style(stylesToApply)