docx icon indicating copy to clipboard operation
docx copied to clipboard

Font size dont match style

Open MarthinBergs opened this issue 4 years ago • 2 comments
trafficstars

When i set the font size in code the actual word document i generate is not matching the size

Example:

}, heading1: { run: { font: "Calibri", size: 36, bold: true, color: "#1f4e79" } }, heading2: { run: { font: "Calibri", size: 36, bold: true }, paragraph: { spacing: { line: 340 } } },

This will result in word document where h1 size is 16 and h2 size is 15.

Is there a definition of size that im missing or is this a bug?

MarthinBergs avatar Mar 08 '21 08:03 MarthinBergs

Just had this issue myself--turns out you have to double the size value.

From the docs: size(halfPts): Set the font size, measured in half-points

https://docx.js.org/#/usage/styling-with-js?id=run-formatting

sampl avatar Mar 08 '21 16:03 sampl

@sampl So is this issue a non-issue?

dolanmiu avatar Mar 08 '21 18:03 dolanmiu