I am generating ODT documents using the openoffice/libreoffice API, and I want the files to come out to be 100% identical every time (by MD5 comparison).
At this point I can unzip the two files generated at different times and check all the files within the zip file and they all match 100%, except for the Settings.xml which has two unique differences (both RSID related).
<config:config-item config:name="Rsid" config:type="int">1835643</config:config-item>
<config:config-item config:name="RsidRoot" config:type="int">1835643</config:config-item>
I learned this is for the purpose of merging and tracking back to the original document, but I want them to be a fixed value that I control, as I don't plan to merge these anyway, but I can't locate where to set these properties.
I have tried a few options (below) and outputting the properties, but been unable to find it so far. Is there a way to override the RSID, without me (coding) unzipping the file, and modifying the XML, which I have done for now, but feels a bit awkward so still looking for this.
// Looking for RSID in all the wrong places - test 1 XPropertySet xSettings = (XPropertySet) xRemoteServiceManager.createInstanceWithContext("com.sun.star.document.Settings", componentContext); // Looking for RSID in all the wrong places - test 2 Object configProvider = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", componentContext); XMultiServiceFactory xConfigProvider = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, configProvider); PropertyValue lParams = new PropertyValue; lParams = new PropertyValue(); lParams.Name = "nodepath"; lParams.Value = "/"; Object xAccess = xConfigProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess" , lParams); XNameAccess xNameAccess = (com.sun.star.container.XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xAccess);Answer1:
The simple solution is to simply delete the settings.xml part in the package Zip. This is all implementation-dependent material and it should not matter for a document you are generating.
If you are concerned that it is still in the manifest, although not in the package, an alternative is to replace settings.xml with a standard one of your creation that honors the schema and is the least needed to accomplish that.
Note that there are conditions under which different runs of openoffice/libreoffice may embed different UUIDs and UIID-based identifiers in the content.xml and in the names of package parts. It appears that your generation via the API does not lead to any of those.