I am using custom properties in a word document and fill the properties value through a custom java application. The code works and the output written without errors.
But when I open the word document I do not see the updated values until I right click on those property fields and update them. Not able to figure out why.
I have given my code below. Am I need to do any update or refresh the values in the code ?
Thanks and Regards
DRG
WordprocessingMLPackage wordMLPackage=null;
org.docx4j.openpackaging.parts.DocPropsCustomPart docPropsCustomPart=null;
try
{
// Load the docx package
wordMLPackage = WordprocessingMLPackage.load(new java.io.File(strFullFileName));
docPropsCustomPart = wordMLPackage.getDocPropsCustomPart();
docPropsCustomPart.setProperty("EmpFName", "RichieRich");
docPropsCustomPart.setProperty("BankAccountLongName", "GreeceNationalBank:00123456789012");
System.out.println("AfLongName Value is:"+docPropsCustomPart.getProperty("EmpFName")); // This line prints the value correctly.
wordMLPackage.save(new java.io.File("D://TemplSubst.docx"));
}
catch(Exception ex)
{
System.out.println("Big Error: "+ex.toString());
}