Created attachment 35373 [details] Information indicated in Bug Description Hello, When addwe add custom properties to a Microsoft Office Word 97 - 2003 document with POI, it works fine. But when we try to open Word document with Office 2007, a warning about Office file validation appears. If we click on "Open", we can see our custom properties added. Is there a way to modify code to avoid this message when we open the file in Office ? We reproduce the issue with POI 3.15, 3.16 and 3.17. Currently, we use POI 3.10 and we don't have this issue but we need to upgrade POI to resolve other issues in our application. Also, we passed Office validation tool (BFFValidator) and we have the following results : - Before modify custom properties, file passed in validator - After modify custom properties, file failed in validator. As attachment, you can find in ZIP file : - Code that we use to reproduce the issue : PbWarningValidationOffice.java - The original file : beforePOI.doc - The file modified with custom properties : afterPOI.doc - XML File returned by Office validation tool when the validation failed : afterPOI.doc.bffvalidator.09-25-17_15-54-22.xml - Warning when we open file modified in Office : WarningOfficeValidation.jpg Thanks you for your help. Best Regards, Jonathan TRICHEREAU.
As far as I see the number of custom properties is mainly limited inside Word here. I.e. your sample works with 50 custom properties, but leads to a corrupt file with 100, the actual limit is somewhere between. I could not find anything in the spec detailing what the limit is exactly, though, so it is hard to put in some limits in Apache POI as it seems to be specific to Microsoft Word itself... Explorer does show 1000 properties fine, so I don't see anything that we can do inside Apache POI for now until there is some specification from Microsoft that explains how many properties are possible for certain types of documents.
Created attachment 35409 [details] Document that work with 1000 custom properties
Hello Dominik, Thanks you for your reply. For me, it doesn't look like a Word limitation but a issue with POI and NPOIFSFileSystem object: for example, with the document that I put in attachment (afterPOI.doc), if we open this document in Word, we have the Office validation warning. But if we do "save as" on this document in a new file (for example afterPOI2.doc), this file can be open in Word without warning and we have all the custom properties. Also, if we launch the java program with the file that I added in new attachment (docDoc03.doc), new file can be open without warning and we have all the custom properties. It seems that the structure of the new Word generated with POI does not necessarily follow the specifications checked in the Office validation module.