Adds CleanupDocument method to merge same formatted runs #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds CleanupDocument() method so one can apply the cleaning up of existing or new documents. Microsoft Word, when you add bold, change color or similar will create separate runs to keep text. This is expected and something that keeps documents nicely formatted. However Microsoft Word for unknown reasons also sometimes adds new Runs that have very same formatting. I guess it could be user changed their mind when it comes to formatting and what was bold now isn't bold anymore.
For example: This is very long line of text - that would most likely translate into 7 runs in Microsoft Word OpenXml. So even tho the text line of text is BOLD all the way, it would treat it as 3 separate Runs. While this is ok, most of the time, it becomes really complicated when trying to fine existence of "line of text" within document. Because you are not searching for a single Text, but text split over multiple WordParagraphs. This becomes even more problematic if you add bold, then remove bold and it still stays 7 Runs, while in the Word document it looks like a single line of text.