I'm currently working on moving a set of tools from a JAXB based document processor to the Aspose.Words package, and I am running into some difficulties. Some of the tools require that a “plain text” version of a particular paragraph object be generated on-the-fly. By plain text I mean that everything that is relative is rendered (auto-numbering, etc.), and that only text that will be visible when printed to paper is stored (delete revisions, comments, etc. are not stored). The two main issues I'm facing are rendering the auto-numbering numbers, and properly filtering out all “non-visible” text.
For filtering out the text I have tried several techniques, including those posted on this forum. If I filter by NodeType most of the non-visible text is removed, however there are still some comments that appear in the text. If I use the DocumentVisitor I get the same results. Since the tools generate and delete paragraphs dynamically, I have not tried converting the document to text first, as this will de-synchronize the text with the Aspose objects.
I think the issue with comments appearing in the text is due the below type of "comment run" found in document.xml:
pairing at least one object to a corresponding first modifier that modifies access to said object;
It may be possible that the above “comment run” is getting parsed into a Run object as if it were a “text run”. A method to determine the sub-type of a Run would be very helpful.
As for the auto-numbering, I'm not sure where to start. I see that there is all of the styling and formatting data for the list available in the Paragraph object. This is useful but there doesn't seem to be a method that renders and returns the actual number. Any suggestions?
Any assistance is much appreciated,