Free Support Forum - aspose.com

'Keep with next' property is changed after RTF to DOCX conversion using .NET

Hi,
keepn.zip (23.6 KB)

We are having the following problem when we use Aspose.Words for .NET (V.20.8) to load RTF files and eventually save them into DOCX documents:

Suppose the RTF document contains three paragraphs, the first and third of which have the \keepn tag (which means they should be kept together with the following paragraph), the second, however, has \keepn0 (in order to switch off keeping together). Each paragraph starts with a \pard tag. The relevant part of the RTF file is,

\pard\s0\keepn{\plain This is paragraph 1.\par}
\pard\s0\keepn0{\plain This is paragraph 2.\par}
\pard\s0\keepn{\plain This is paragraph 3.\par}

You can see this in the ‘Simple_keepn.rtf’ file in the attached ZIP file.

If we create a new Aspose.Words.Document object with this RTF file and save it to some DOCX file immediately afterwards, we can see that in the resulting DOCX file all three paragraphs have “Keep with next paragraph” switched ON.

If we leave out \keepn0 in the second paragraph, everything works fine. Aspose seems to ignore the “0” part and always set the property to “true”. By the way, the same problem appears with the \keep tag.

In the attached ZIP archive, please find the following files:
– This description
– Sample RTF document ‘Simple_keepn.rtf’
– Sample project ‘TestRtfKeep’ including ‘TestRtfKeep.docx’
– Document ‘Simple_keepn.docx’ created from ‘Simple_keepn.rtf’ using ‘TestRtfKeep.docx’

Our questions:

  1. Do you consider this behavior a bug in current versions of Aspose.Words for .NET?
  2. If so, in which release will this bug be fixed?

Thank you very much for your cooperation.

Best regards,

@FK1

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20986 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

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