Hi there,
I’m trying to use the document visitor object to parse a word document. Whenever I hit the Visitrun method I get unpredictable results. Sometimes it correctly returns the entire run of similarly formatted text. Other times, for example, I get one word, followed by a space and a word followed two words, etc.
Example:
run.Text = "The" (first run)
run.Text = " quick" (second run)
run.Text = " brown fox " (third run)
These runs are all one sentence and in the same font.
It seems to me this could be bug? It rather defeats the purpose of having ‘Runs’ if I still have to check the font properties of each run due to this behaviour.
Can you please shed some light on this problem? Thanks.
Hello!
Thank you for your interest in Aspose.Words.
Runs can be really redundant in MS Word documents by design. This is usually because of keeping revision history and some other attributes that are not seen. The redundancy problem was already addressed and fixed in the current codebase. Update will be available in a few days and there will be the following method: Document.JoinRunsWithSameFormatting
Please see this thread for details: https://forum.aspose.com/t/110629
Utilizing DocumentVisitor is considered as advanced usage. I appreciate your experience and expect you are solving some complex task. We are always ready to help you. Please welcome to provide any feedback. It could be very important for us.
Regards,
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.