I am trying to read word docs and separate the style information from the styles applied directly to the text. This applies to both runs and paragraphs.
I can read the run formatting from the run.getFont information but it has no way of finding out which properties were inherited from the paragraph’s style or were applied directly to the run.
Same with paragraphs, I can read the paragraphFormat but cannot determine which properties are inherited.
I can get the overall style information from the documents, and I can tell when a run or paragraph has a style applied to them, but if the style and the text have the same formatting applied, I can’t tell if they are both set to the same thing or if the run/paragraph property is inherited from the master.
Is this future functionality or is there a workaround?
Hi
Thanks for your inquiry. It is an interesting question. I will play with run properties and let you know what I find.
May I ask you why you need to know what properties were inherited? Maybe there is an easier way to achieve what you need?
Best regards,
I am converting doc and docx files into an internal document format which also supports inherited styles. I can copy over the master style information already, but I need to be able to copy over only the style properties which are applied to the text itself for the inherited styles to work properly in the other format.
Otherwise, the resulting document looks correct, but if a user changes a master style, none of the other instances of that style are changed.
The answer to your question is “yes”. We are going to open up access to the raw formatting properties on all objects.
Currently Aspose.Words returns “fully calculated” properties in most places. E.g. Run.Font is a combination of properties that are inherited from the base styles and direct formatting.
Internally, Aspose.Words stores raw formatting attributes in collections on each object and we basically need to make them public. The API will essentially provide both ways - to access the fully calculated properties as well as raw attributes.
By the way, the process of calculating formatting properties in MS Word documents (and Aspose.Words follows exactly this model) is quite complex.
As for the question when we are going to release a version with exposed raw formatting - it can be Feb-Mar 2011. Let me know if that sounds acceptable. We need to make sure the new API is tidy enough so we don’t have to change it too often after making it public.
For now, I think I can work around this by comparing the local properties to the master. If they’re the same, then assume that that property is inherited.
Admittedly it’s not perfect, but should work for most cases.