Hello,
If we insert the HTML without css it works.
Example (HTML and Docx are also in the attachment):
import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
/**
* Created on 15.12.2016.
*/
public class AsposeTest {
public static void main(String[] args) {
try {
String html = "\n" +
"<html lang=\"en-gb\">\n" +
" \n" +
" <meta charset=\"UTF-8\">\n" +
" Example - pure CSS\n" +
" \n" +
" label {\n" +
"\tdisplay: inline;\n" +
"}\n" +
"\n" +
".regular-checkbox {\n" +
"\tdisplay: none;\n" +
"}\n" +
"\n" +
".regular-checkbox + label {\n" +
"\tbackground-color: #fafafa;\n" +
"\tborder: 1px solid #cacece;\n" +
"\tbox-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05);\n" +
"\tpadding: 9px;\n" +
"\tborder-radius: 3px;\n" +
"\tdisplay: inline-block;\n" +
"\tposition: relative;\n" +
"}\n" +
"\n" +
".regular-checkbox + label:active, .regular-checkbox:checked + label:active {\n" +
"\tbox-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1);\n" +
"}\n" +
"\n" +
".regular-checkbox:checked + label {\n" +
"\tbackground-color: #e9ecee;\n" +
"\tborder: 1px solid #adb8c0;\n" +
"\tbox-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05), inset 15px 10px -12px rgba(255,255,255,0.1);\n" +
"\tcolor: #99a1a7;\n" +
"}\n" +
"\n" +
".regular-checkbox:checked + label:after {\n" +
"\tcontent: '\\2714';\n" +
"\tfont-size: 14px;\n" +
"\tposition: absolute;\n" +
"\ttop: 0px;\n" +
"\tleft: 3px;\n" +
"\tcolor: #99a1a7;\n" +
"}\n" +
"\n" +
".tag {\n" +
"\tfont-family: Arial, sans-serif;\n" +
"\twidth: 200px;\n" +
"\tposition: relative;\n" +
"\ttop: 5px;\n" +
"\tfont-weight: bold;\n" +
"\ttext-transform: uppercase;\n" +
"\tdisplay: block;\n" +
"\tfloat: left;\n" +
"}\n" +
"\n" +
".button-holder {\n" +
"\tfloat: left;\n" +
"}\n" +
"\n" +
" \n" +
" \n" +
" \n" +
"\n" +\n" +
"\t\t<div class=\"tag\">Checkbox Small
"\t\t<input type=\"checkbox\" id=\"checkbox-1-1\" class=\"regular-checkbox\" /><label for=\"checkbox-1-1\">\n" +
"\t
"\t
\n" +
"\t \n" +
"";
Document document = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(document);
documentBuilder.insertHtml(html);
document.save("C:\\temp\\testDocument.docx");
} catch (Exception e) {
e.printStackTrace();
}
}
}
"\t \n" +
"";
Document document = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(document);
documentBuilder.insertHtml(html);
document.save("C:\\temp\\testDocument.docx");
} catch (Exception e) {
e.printStackTrace();
}
}
}