Problem convert html to Aspose Document with <ins> html tag

Hello,

When converting html to Aspose document , if the html contains a <ins> tag inside , then converting the Document back to html, we can see a default color is applied (which is not dark by the way , but #b5082e) .
Even using the last version 24.1
Is there an option to fix that or is it a bug ?
Thank you
Here is a sample test to demonstrate :

final String html = """
	<html>
		<head></head>
		<body>
		<p>
			<span style="font-family: 'Arial Narrow',sans-serif; color: rgb(0,0,0);">
			<ins>example</ins>
			</span>
		</p>
		</body>
	</html>
	""";

final com.aspose.words.Document document = new com.aspose.words.Document();
final DocumentBuilder builder = new DocumentBuilder(document);
builder.getDocument().getCompatibilityOptions().setDoNotExpandShiftReturn(true);
builder.insertHtml(html, false);


final WordConverterAsposeLocal.NoBomByteArrayOutputStream bos = new WordConverterAsposeLocal.NoBomByteArrayOutputStream();
document.save(bos, new HtmlSaveOptions(SaveFormat.HTML));
String after = bos.toUtf8String();
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta name="generator" content="Aspose.Words for Java 24.1.0" />
		<title></title>
	</head>
	<body style="font-family:'Times New Roman'; font-size:12pt">
		<div>
			<p style="margin-top:0pt; margin-bottom:12pt">
				<ins style="color:#b5082e">
					<span style="font-family:Arial">example</span>
				</ins>
				<span style="font-family:Arial"> </span>
			</p>
			<p style="margin-top:0pt; margin-bottom:0pt">
				<span style="-aw-import:ignore">&#xa0;</span>
			</p>
		</div>
	</body>
</html>

@concord_tech This is not a bug, insert revision color is taken from RevisionOptions. So you change it using the following code:

Document doc = new Document("C:\\Temp\\in.html");
doc.getLayoutOptions().getRevisionOptions().setInsertedTextColor(RevisionColor.AUTO);
doc.save("C:\\Temp\\out.html");

Please note, Aspose.Words is designed to work with MS Word documents. HTML documents and MS Word documents object models are quite different and it is not always possible to provide 100% fidelity after conversion one format to another. So the original HTML structure might be changed after processing it using Aspose.Words.

great, I just tested and it works, thank you :+1:

1 Like