We seem to be facing an issue when we use the addCopy() method of the style API for applying styles from one document to another. The primary issues that we see are with the fonts associated with some styles. The main issue is the code applies formatting on the Windows environment, but doesn’t do so on the Linux environment.
To give more context, we have created a style comparator which compares two style objects by comparing all the getter attributes (and recursively doing the same for associated objects). After using the addCopy() method to apply styles, when we call our comparator, we get differing results in the font associated with different cases, with the common difference reported in the getLocaleIdBi()
getSize()
getSizeBi()
API’s of the font object (in our case, mostly for the default paragraph font). Also, there are cases where we have found that there is a difference in the ParagraphFormat object associated with the style object, wherein the difference pops up in one or more of the
getFirstLineIndent()
getSpaceBefore()
getSpaceAfter()
getLineSpacing()
API’s of the former. To be even more specific, we noticed this discrepancy occurring with documents created across different versions of Word - we saw that only the attributes that were changed from the defaults were re-applied (for instance, the default spacing after is set to 10 pt in office 2010 docs, but it is 0pt in 2007 docs. When I apply styles from the 2010 doc to the 2007 doc, the 2007 doc still shows 0pt spacing after, possibly because in the 2010 doc, the spacing was not changed from its default).
To add on to this, we had another concern - when we were copying table styles, we were detecting difference in font - the issue I could pinpoint this to was that most of the differing table styles were actually based on the Table Normal style, whose attributes were different from one version of Word to another, and the style itself was unmodifiable. For your reference, I’m attaching a picture, the document on the left hand side reflects the document to which we want to apply the table styles applicable in the document on the right-hand side.