We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Background color not converted from HTML to RTF

Hello, I am testing the conversion from RTF to HTML and back to RTF. Everything seems fine, I have only found one problem: When converting from HTML to RTF, the backgsound color of a text is lost.
You can see an example in the attached file ‘background-color-error.png’: the column on the left contains the original RTF text, the large column on the right contains the HTML converted from the original RTF, and the column in the center contains the RTF converted back from the HTML. As you can see, the gray background color is gone (this happens with other examples too). Here is the code (C#) I use to convert from HTML to RTF:

public static string ToRtfTest(this Document document)
{
using (var memoryStream = new MemoryStream())
{
var saveOptions = new Aspose.Words.Saving.RtfSaveOptions();
saveOptions.ExportImagesForOldReaders = false;

document.TrimBlankParagraphs();
document.Save(memoryStream, saveOptions);
var rtf = new StringBuilder(Encoding.Default.GetString(memoryStream.ToArray()));
return rtf.ToString();
}
}

I am also attaching the original RTF and the converted HTML.
I have gone through the save options but have found nothing, nor on the internet or the forum.
Am I missing something or is this a bug? In this case, can it be fixed?
Thank you

Hi there,


Thanks for your inquiry. I have tested the scenario and have not found the shared issue in output RTF file while using latest version of Aspose.Words for .NET. I would suggest you please upgrade to the latest version (v13.7.0) from here and let us know how it goes on your side.

I have attached the output RTF file with this post for your kind reference. Please let us know if you have any more queries.

Hello Tahir
thank you for your investigation. I had forgotten to mention I am using version 11.11.0.0, thus I will try using the latest version and will let you know if the same problem occurs.
Thank you again
Mirko

Hi Mirko,


Thanks for your feedback. Please note that every new release of Aspose.Words comes up with some new features, enhancements in the existing features and bug fixes. We always encourage our customers to use the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that are reported earlier. Please download the latest version of Aspose.Words for .NET 13.7.0 from here:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/entry487066.aspx