Free Support Forum - aspose.com

Problem with runs

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!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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:

http://www.aspose.com/community/forums/1/120232/highly-redundant-span-tags-in-output/showthread.aspx

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,

Your quick response is much appreciated. I can’t seem to access that link. Access denied error.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Sorry, this thread is private. Please expect the next release within few days.

Best regards.