Skip to content

Instantly share code, notes, and snippets.

@natergj
Created July 25, 2019 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natergj/0ddb5c287cbba42c7cff614728c47337 to your computer and use it in GitHub Desktop.
Save natergj/0ddb5c287cbba42c7cff614728c47337 to your computer and use it in GitHub Desktop.
excel4node background color and font
const xl = require("excel4node");
const wb = new xl.Workbook();
const ws = wb.addWorksheet("Background Color");
const greenBgColumnsRows = wb.createStyle({
font: { color: "black", size: 12 },
fill: {
type: "pattern",
patternType: "solid",
bgColor: "#33FF35",
fgColor: "#33FF35"
}
});
const textStyle = wb.createStyle({
font: { color: "black", size: 16, bold: true }
});
ws.cell(11, 4, 13, 13)
.string("default text")
.style(greenBgColumnsRows);
ws.cell(11, 7)
.string("10 Min-Mittelwerte")
.style(textStyle);
wb.write("BG_Color_Font.xlsx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment