joinRunsWithSameFormatting issue with .doc/docx

Considering the attached sample files, where the words in the second paragraph has been formatted together in a single select and the last two words are formatted with same font but in different times, we have found that 'joinTextRunsWithSameFormatting' does not work as expected when the above document is saved in .doc/docx format, while it works properly with .odt format.
From documentation, the above issue should be solved from version of Aspose.Words for java 11.11.0, but seems still there also on latest 15.7.

int runsBefore = sampleDocument.getChildNodes(NodeType.RUN, true).getCount();

int joinCount = sampleDocument.joinRunsWithSameFormatting();
sampleDocument.updatePageLayout();

int runsAfter = sampleDocument.getChildNodes(NodeType.RUN, true).getCount();

With .odt file format the above code returns:

Number of runs before:7, after:6, joined:1

with .doc/docx:

Number of runs before:8, after:8, joined:0

Thank you in advance for your support.

Hi Renato,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12332. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Renato,

Thanks for your patience.


It is to inform you that our product team has completed the work on the issue (WORDSNET-12332)
and has come to a conclusion that this issue and the
undesired behavior you’re observing is actually not a bug in
Aspose.Words. So, we have closed this issue as ‘Not a Bug’. I am quoting developer’s comments here for your reference:

When SimpleTest.docx is opened in Word it can be clearly seen that last two words are separated by space character with different formatting applied.

Word “formatted” has 15pt font size, followed by space character which has 12pt font size, followed by word “text” which again has 15pt.

So these run can not be joined and thus this is not a bug.

Hi Tahir and thanks for the quick response.
Ok, sharp clear, but then I need an explanation about why on one of the samples that I’ve attached ,the one in .odt format, the text runs that are formatted exactly the same as docx, are getting joined anyway in a single text run (including the spaces).
I would expect the same behavior on all formats.
Thanks.

Hi Renato,

Thanks for your inquiry. Please check the attached image which shows the styles of text “formatted” and “text”. Both have same style T3. This the reason joinRunsWithSameFormatting return 1 for Odt document. Please check the attached xml for Odt contents.

Hope this answers your query. Please let us know if you have any more queries.

Hi Tahir.

Thanks for your response. I’m not sure if this
explains everything. Please, see the attached image: opening the
content.xml file with a simple text viewer, we can detect easily the
spaces. Considering that the text formatted with styles T2 and T3 are
bounded by the span tag, the spaces pointed to by the blue arrows
actually have the style set in the span tag; instead, those pointed to
by the red arrows should be rendered using the P1 style, because they
are out of any span tag.
To confirm this, opening the odt file with LibreOffice, setting the cursor between the last space and the ‘t’ of the last ‘text’ word, it is easy to verify that the font height is 12, not 15 as the T3 style.

Thanks for your help.


Regards,

Renato

Hi Renato,

Thanks
for sharing the detail.

Word “formatted” has 15pt font size, followed by space character which has 12pt font size, followed by word “text” which again has 15pt. The space should be imported in separate Run node. Aspose.Words does not import this Run node correctly in DOM for your Odt document. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12367. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Tahir.

Any news about this issue?
Thank you.

Regards,

Renato

Hi Renato,

Thanks for your patience. We regret to share with you that the issue WORDSNET-12367 has been postponed. I am afraid, there is no estimate available at the moment. We will inform you via this forum thread as soon as there are any further developments.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-12367) have been fixed in this Aspose.Words for .NET 17.5 update and this Aspose.Words for Java 17.5 update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hello.

We experimented this new release and it woks: now the runs are kept separated as expected. Issue closed.
Thank you.

Regards,

Renato