Need solution for following:
Need help here! While saving the final document, I need all the text to have font as “Arial”.
Need solution for following:
Hi,
Thanks for your query. Please use the following code snippet to change the font name to “Arial” in whole document.
Document doc = new Document("D:\\Test.docx");
// Retrieve all Runs in the document.
Node[] runs = doc.getChildNodes(NodeType.RUN, true).toArray();
for (int j = 0; j < runs.length; j++)
{
Run run = (Run)runs[j];
run.getFont().setName("Arial");
run.getFont().setSize(12.0);
}
doc.save("D:\\Out.docx");
The solution works just fine, thanks