43614

How do I override ODF Root RSID using the API

Question:

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>

and

<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[1]; lParams[0] = new PropertyValue(); lParams[0].Name = "nodepath"; lParams[0].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.

Recommend

  • test driven asynch tasks
  • Coverity and C++: heap (with new) vs. on-stack allocation
  • Save currently running script in Matlab
  • adding custom element to ngRepeat list
  • Detecting the presence of IDLE / How to tell if __file__ isn't set
  • maven-cobertura-plugion does not show the sources [closed]
  • Making public posts via Facebook App?
  • Javascript variables for Get http
  • How do I get rid of the Eclipse Find/Replace Bar
  • Getting a line that has the coordinates defined by the mouse location
  • Use preg_match to find if string contains script-tags
  • Titanium doesn't recognize Android SDK on Windows
  • C++/CLI Thread synchronization including managed and unmanaged code
  • Is is safe to use HSQLDB for production? (JBoss AS5.1)
  • How to move an element within a structure, possibly with zippers?
  • Reading space separated values file in c++ error
  • How to merge keras sequential models with same input?
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • How can Delete be both a DDL and a DML statement
  • android google indoor map
  • gspread or such: help me get cell coordinates (not value)
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • How do I get HTML corresponding to current DOM tree?
  • JQuery Internet Explorer and ajaxstop
  • JSON response opens as a file, but I can't access it with JavaScript
  • $wpdb not working in file of WordPress plugin
  • Q promise. Difference between .when and .then
  • Nant, Vault & Windows Integrated Authentication
  • RectangularRangeIndicator format like triangular using dojo
  • Bug in WPF DataGrid
  • Change an a tag attribute in JavaScript based on screen width
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • C# - Getting references of reference
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • Is there any way to bind data to data.frame by some index?
  • reshape alternating columns in less time and using less memory