Attempting to alter an existing style

I am trying to update the “Normal” style in a new document. However an exception is thrown “Cannot add a style because a style with the same name already exists”. What am I doing wrong?

Document doc = new Document();
doc.removeAllChildren();

StyleCollection styles = doc.getStyles();
Style style = styles.get("Normal");
if (style == null)
    style = styles.add(StyleType.PARAGRAPH, "Normal");
style.getFont().setSize(10);
style.getFont().setName("Helvetica");
style.getParagraphFormat().setSpaceAfter(10);

Thanks!

Hi

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (4.0.0). Which version do you use?
You can download the latest version of Aspose.Words for Java from here:
https://releases.aspose.com/words/java
Best regards,

Thanks, Mysteriously after turning on my computer this morning the problem has gone away! Oh well it works now.