Highlighted text of hyperlink is lost after RTF to HTML conversion using Java

Issue-1) RTF text with link have url but not show as highlighted text in HTML.
Issue-2) Also, link text url is appended with program html output file path too.
i.e. for Below RTF text link should be : www.google.com
But comes as (Generated html File Output path + url) : file:///C:/Users/pprajapati/Desktop/9122/output/www.google.com

Below is the sample rtf text and its related image for reference.

Rtf text:
{\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 Tahoma;}{\f2\fnil\fcharset2 WingDings;}{\f3\fnil\fcharset2 Symbol;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{*\generator WPTools_7.000;}{\plain\f1\fs18\cf16{\field{*\fldinst{HYPERLINK “www.google.com”}}{*\fldtitle{www.google.com}}{\fldrslt{outside link}}}\li0\fi0\ri0\sb0\sa0\ql\vertalt\par
}}

Sample Image:
1_RtfImageWithLinkIssue.jpg (64.9 KB)

Sample java code used for reference:
Added following dependency and repository in pom.xml

com.aspose aspose-words 20.3 jdk17



AsposeJavaAPI
Aspose Java API
Aspose Repository Browser /java/repo/

============= Java code with input and output option ============
public static void main(String[] args) throws Exception {
License license = new License();
license.setLicense(“C:\Users\pprajapati\Desktop\9122\Aspose.Words.lic”);
// with options
RtfLoadOptions rtfOptions = new RtfLoadOptions();
rtfOptions.setRecognizeUtf8Text(true);

PdfSaveOptions pdfOptions = new PdfSaveOptions();
pdfOptions.setCompliance(PdfCompliance.PDF_17);

HtmlSaveOptions htmlOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlOptions.setPrettyFormat(true);
htmlOptions.setExportListLabels(ExportListLabels.BY_HTML_TAGS);

Document doc = new Document("C:\\Users\\pprajapati\\Desktop\\9122\\program\\AsposeTest.rtf", rtfOptions);
doc.save("C:\\Users\\pprajapati\\Desktop\\9122\\program\\outputAspose.pdf", pdfOptions);
doc.save("C:\\Users\\pprajapati\\Desktop\\9122\\program\\outputAspose.html", htmlOptions);
System.out.println("done");

}

@pprajapati

Unfortunately, the shared RTF does not display correct in MS Word. Please ZIP and attach the valid RTF for testing. Thanks for your cooperation.

This RTF is generated from WPTools(version v7.26) for Delphi, So this is valid RTF and it is working fine with that library.
Attached RTF in zip file : RtfTextWithURL.zip (537 Bytes)
Please check this RTF and let us know, Is there anything wrong in our RTF as per Aspose/RTF specification?

@rjethava

Aspose.Words mimics the behavior of MS Word. Please check your RTF documents using MS Word.

With Aspose.Words, you can modify your RTF document. Please ZIP and attach your expected output RTF. We will then provide you code example to get the desired output.