We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InsertHtml with CSS


Im trying to using words java version to go to a bookmark in my template and use inserthtml to insert some html with styling.

String looks like:

table.cfdump_udfarguments {
	font-size: xx-small;
	font-family: verdana, arial, helvetica, sans-serif;
	cell-spacing: 2px;

table.cfdump_wddx th,
table.cfdump_xml th,
table.cfdump_struct th,
table.cfdump_array th,
table.cfdump_query th,
table.cfdump_cfc th,
table.cfdump_object th,
table.cfdump_binary th,
table.cfdump_udf th,
table.cfdump_udfbody th,
table.cfdump_udfarguments th {
	text-align: left;
	color: white;
	padding: 5px;

table.cfdump_wddx td,
table.cfdump_xml td,
table.cfdump_struct td,
table.cfdump_array td,
table.cfdump_query td,
table.cfdump_cfc td,
table.cfdump_object td,
table.cfdump_binary td,
table.cfdump_udf td,
table.cfdump_udfbody td,
table.cfdump_udfarguments td {
	padding: 3px;
	background-color: #ffffff;
	vertical-align : top;

table.cfdump_wddx {
	background-color: #000000;
table.cfdump_wddx th.wddx {
	background-color: #444444;

table.cfdump_xml {
	background-color: #888888;
table.cfdump_xml th.xml {
	background-color: #aaaaaa;
table.cfdump_xml td.xml {
	background-color: #dddddd;

table.cfdump_struct {
	background-color: #0000cc ;
table.cfdump_struct th.struct {
	background-color: #4444cc ;
table.cfdump_struct td.struct {
	background-color: #ccddff;

table.cfdump_array {
	background-color: #006600 ;
table.cfdump_array th.array {
	background-color: #009900 ;
table.cfdump_array td.array {
	background-color: #ccffcc ;

table.cfdump_query {
	background-color: #884488 ;
table.cfdump_query th.query {
	background-color: #aa66aa ;
table.cfdump_query td.query {
	background-color: #ffddff ;

table.cfdump_cfc {
	background-color: #ff0000;
table.cfdump_cfc th.cfc{
	background-color: #ff4444;
table.cfdump_cfc td.cfc {
	background-color: #ffcccc;

table.cfdump_object {
	background-color : #ff0000;
table.cfdump_object th.object{
	background-color: #ff4444;

table.cfdump_binary {
	background-color : #eebb00;
table.cfdump_binary th.binary {
	background-color: #ffcc44;
table.cfdump_binary td {
	font-size: x-small;
table.cfdump_udf {
	background-color: #aa4400;
table.cfdump_udf th.udf {
	background-color: #cc6600;
table.cfdump_udfarguments {
	background-color: #dddddd;
	cell-spacing: 3;
table.cfdump_udfarguments th {
	background-color: #eeeeee;
	color: #000000;

div.boxtest { border:2px solid;
width:100%; color:#000; } .contentheader { color:#0099FF; } div { width:100%; }
.fieldheader { background-color:#000; color:#FFF; margin-top:0px; }



The content is wrtitten to the word doc but the styling isn’t shown. Please can you advise?



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The problem occurs because, currently, Aspose.Words does not support inheriting styles from parent elements.

Currently, Aspose.Words expects that font formatting is set in element, formatting of paragraph – in


elements etc…

I linked your request to the appropriate issue, you will be notified as soon as it is resolved.

Best regards.

Thanks for you response

Is it then possible to use something like below to achieve styling:

A new background and
font color with inline CSS



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You should specify text color on SPAN level like shown below:

builder.insertHtml(@"<p style='background: blue;'><span style='color: white;'>A new background and font color with inline CSS


Hope this helps.

Best regards.

The issues you have found earlier (filed as WORDSNET-2021) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.