Hello,
Thank you for your inquiry.
Please note that the unit of font size in Microsoft Word is "points" (pt), not pixels (px). Therefore, if you set a font size of 25px in HTML, it will be displayed as 19pt in Microsoft Word. If you wish to have consistent font sizes between your HTML and Microsoft Word documents, please modify the unit of the font size accordingly.
For example, you can modify the font size unit in your code as follows:
- Code: Select all
doc.addSection().addParagraph().appendHTML("<p style=\"font-size:25pt\">Test</p>");
By changing the unit to "pt," the font size set in the HTML will be correctly reflected in Microsoft Word.
Additionally, if you need to convert font sizes from pixels (px) to points (pt), you can use the following code snippet:
- Code: Select all
private static float ConvertPxToPt(float px){
float result = px *3 /4;
return result;
}
If you have any further questions or need additional assistance, please feel free to reach out to us.
Sincerely,
Annika
E-iceblue support team