Problem with css style at document creation

Hi,
we need to create .doc document from html page with linked the file of css style.
We are building a document with insertHtml, but linked style apply only for tag “body”.

What we should do to apply all our styles at new document?

var html = String.Format(" {1}", Directory, "<table class=‘article-table’> Категория плательщиков Порядок уплаты налога (представления расчета, декларации, подачи прочих отчетов) Как заполнить платежное поручение (каким документом утверждена форма бланка)

<tr class=‘row’>1 ФЕВРАЛЯ ЗЕМЕЛЬНЫЙ НАЛОГ
Организации и предприниматели — плательщики земельного налога Представляют декларацию за 2011 г. ");

var builder = new DocumentBuilder();
var pageSetup = builder.PageSetup;
builder.InsertHtml(html);
builder.Document.UpdatePageLayout();
builder.Document.Save(String.Format(Directory, @“Test.doc”), SaveFormat.Doc);

Content of css file:

html, body {
margin: 0;
padding: 0;
border: 0;
background: #363E42;
}
h3 {
font-weight:bold;
}
i{
font-style:italic;
}
b{
font-weight:bold;
}
.strong{
font-weight:bold;
}
.article-table{
border-collapse: collapse;
margin-bottom:2em;
font-size:10px;
}
.article-table .row{
font-family:Arial,sans-serif;
font-size:0.8125em;
}
.article-table .row td{
padding-top:0.8em;
padding-bottom:0.8em;
padding-right:2em;
}
.article-table .head th{
text-align:left;
font-weight: bold;
border-bottom: 10px solid #c40e0e;
color:#c40e0e;
padding-bottom:0.7em;
padding-right:2em;
font-family:Arial,sans-serif;
font-size:0.8em;
}
.article-table .row td.bold{
font-weight:bold;
}

Hi Ilyin,


Thanks for your inquiry and sorry for the delayed response. Aspose.Words fully supports reading external CSS sheets when loading or inserting HTML content. Also, please note that Aspose.Words originally is designed to work with Word documents. Some HTML features (Styles etc) may get lost during importing HTML into DOM or exporting Word document to HTML format. Please read more about the limitations below:
http://www.aspose.com/docs/display/wordsnet/Load+in+the+HTML+%28.HTML%2C+.XHTML%2C+.MHTML%29+Format
http://www.aspose.com/docs/display/wordsnet/Save+in+the+HTML+%28.HTML%2C+.XHTML%2C+.MHTML%29+Format

Moreover, I have attached the output Word document that is produced using your Html string with the latest version of Aspose.Words (11.9.0) here for your reference. Please note that if you import your Html into Microsoft Word, you’ll find that it is also not producing a perfect output.

Best Regards,