Hi Team,
I am extracting html from word document. The output html does not contain complete information about content controls.It does not specify the type of content control. I want to write this html in another document and want content control nodes to be preserved.
Code used :
public static void main(String... args) throws Exception {
com.aspose.words.License license = new com.aspose.words.License();
license.setLicense("/home/saurabharora/aspose-licence.xml");
Document document = new Document("/home/saurabharora/Downloads/CL06906-null-2022-09-28.docx");
//String docHtml = document.toString(SaveFormat.HTML);
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setPrettyFormat(true);
String docHtml = document.toString(opts);
System.out.println(docHtml);
}
Document :
test_html.zip (15.5 KB)
Html output :
<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 22.2.0" />
<title>
</title>
</head>
<body style="font-family:'Times New Roman'; font-size:12pt">
<div>
<p style="margin-top:0pt; margin-bottom:0pt; font-size:13pt">
<span style="font-weight:bold; -aw-import:ignore"> </span>
</p>
<h2 style="margin-top:0pt; margin-left:36pt; margin-bottom:14.95pt; text-indent:-18pt">
<span style="font-style:italic; -aw-import:ignore"> </span>
</h2>
<p style="margin-top:12pt; margin-bottom:12pt">
<span style="font-family:Arial">In computer programming, characters are pieced together to form strings, which are data types that are often implemented into bytes of data that can be read by computers. With online activity and the</span><span style="font-family:Arial"> </span><span style="-aw-sdt-tag:'BASIC__101__15045__206__206'; -aw-sdt-title:'ankush Currency FieldCDR'"><span style="font-family:Arial; background-color:#00ffff">ankush Currency FieldCDR</span></span><span style="font-family:Arial"> </span><span style="-aw-sdt-tag:'BASIC__101__15548__206__206'; -aw-sdt-title:'AnkushNumerictag'"><span style="background-color:#00ffff">AnkushNumerictag</span></span><span> </span><span style="-aw-sdt-tag:'BASIC__101__15577__206__206'; -aw-sdt-title:'Ankush TestField'"><span style="background-color:#00ffff">Ankush TestField</span></span><span> </span><span style="-aw-sdt-tag:'BASIC__101__14886__206__206'; -aw-sdt-title:'Akki Text Field test'"><span style="background-color:#00ffff">Akki Text Field test</span></span><span> </span>
</p>
<p style="margin-top:12pt; margin-bottom:12pt">
<br /><span style="-aw-import:ignore"> </span>
</p>
<p style="margin-top:0pt; margin-bottom:6pt">
<span style="-aw-import:ignore"> </span>
</p>
</div>
</body>
</html>
Please help.