I am using Aspose for converting RTF to HTML.But it gives me different format

@tarun823,

You do not need to write any additional code to be able to perform RTF to HTML conversion. By default, Aspose.Words will produce an HTML output similar to what MS Word would have produced. Aspose.Words copies the behavior of MS Word. However, you have an option to use Aspose.Words Document Object Model (DOM) objects to modify document elements before converting to HTML.

Secondly, please note that we do not provide support for older released versions of Aspose.Words. We also do not provide any fixes or patches for old versions of Aspose APIs. All fixes and new features are always added into new versions of our APIs. So please upgrade to the latest 21.1 version of Aspose.Words. If the problem still remains with this New RTF Document.zip (2.6 KB), then as requested in my previous post, please provide a standalone simple Console application here for testing.

How can i convert RTF to HTML by using Aspose.Words Document Object Model (DOM) objects.

Can you share me the code.How i can convert RTF to HTML by using Aspose.Words DOM object.

It will be helpfull.

@tarun823,

What I meant was, after loading RTF document with Aspose.Words’, you may use DOM classes to manipulate/edit properties/attributes of different elements (like Tables, Paragraphs, Shapes) and then save to HTML format.

// Load RTF file into Aspose.Words
Document doc = new Document("C:\\Temp\\input.rtf");

// Do Modifications using DOM classes
// Generally speaking, the operations, that you can perform by using MS Word, can also be performed by using Aspose.Words for .NET API programmatically.
// For example, let's change color of first Paragarph's text
foreach (Run run in doc.FirstSection.Body.FirstParagraph.Runs)
    run.Font.Color = Color.Green;

// Specify additional options when saving to HTML
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);
options.ExportImagesAsBase64 = true; // etc

doc.Save("C:\\Temp\\21.1.html", options);

If you do not want to do any modifications, then the following code will convert RTF to HTML (Aspose.Words will mimic the behavior of MS Word).

// Load RTF file into Aspose.Words
Document doc = new Document("C:\\Temp\\input.rtf");
// Save to HTML
doc.Save("C:\\Temp\\21.1.html");

Is this code will give inline space?

@tarun823,

There are different ways to get different types of spacings. For example, please check: