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

Free Support Forum - aspose.com

HTML-Cell with two background-colors will be transformed wrong into docx

We have a HTML (see file) with a table and cells. Some of these cells have a different css-class. If you open the file in your browser you will see just one background-color.


But after we are inserting the html into a new document and save it as docx or pdf you will see a border around the color with the other background-color.

We are using Aspose.Words 16.6.0
2x Windows 10 64 Bit 1x Windows 7 64 Bit
Word 2013

Here is a Test Project:

<pre style=“color: rgb(0, 0, 0); font-family: “Courier New”;”>import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;

/**
* Created by Alexander.Joerg on 03.08.2016.
*/

public class AsposeTest {
public static void main(String[] args) {

try {
Document document = new Document();

DocumentBuilder documentBuilder = new DocumentBuilder(document);
documentBuilder.insertHtml("\n" +
“<html lang=en>\n+
\n+
" <meta charset=UTF-8>\n" +
" CSS-Test\n" +
\n+
“.Plan\n+
“{\n+
\twidth: 109%;\n+
\tfont-size: 8pt;\n+
\ttext-align: right;\n+
\tborder-collapse: collapse;\t\n+
“}\n+
\n+
“.Plan thead\n+
“{\n+
\ttext-align: center;\n+
\tborder: 1px solid #C8C8C8;\n+
“}\n+
\n+
“.Plan th\n+
“{\n+
\tborder-left: 1px solid #C8C8C8;\n+
\tborder-right: 1px solid #C8C8C8;\n+
“}\n+
\n+
“.Plan td\n+
“{\n+
\tborder: 1px solid #C8C8C8;\t\n+
“}\n+
\n+
“.PlanCurrentYear\n+
“{\n+
\tbackground-color: #E6E6E6;\n+
“}\n+
\n+
“.PlanSubtotal\n+
“{\n+
\tfont-weight: bold;\n+
\tbackground-color: lightgreen;\n+
“}\n+
\n+
“.PlanSum\n+
“{\n+
\tfont-weight: bold;\n+
\tbackground-color: lightblue;\n+
“}\n+
\n+
\n+
\n+
\n+
\n+
\n+
\t<table class=Plan >\n+
\t\t\n+
\t\t\n+
\t\t<col class=PlanCurrentYear>\n+
\t\t\n+
\t\t\n+
\t\t \n+
\t\t\t \n+
\t\t\t\tHeadline \n+
\t\t\t\tHeadline \n+
\t\t\t\tHeadline \n+
\t\t\t\tHeadline \n+
\t\t\t\tHeadline \n+
\t\t\t
\n+
\t\t
\n+
\t\t \n+
\t\t\t Text Text Text Text Text \n+
\t\t\t Text Text Text Text Text \n+
\t\t\t<tr class=PlanSubtotal>Text Text Text Text Text \n+
\t\t\t<tr class=PlanSum>Text Text Text Text Text \n+
\t\t\t Text Text Text Text Text \n+
\t\t\t Text Text Text Text Text \n+
\t\t\t
\n+
\t\n+
\n+
\n+
“”);

document.save(“C:\temp\testDocument.docx”);
document.save(“C:\temp\testDocument.pdf”);


} catch (Exception e) {
e.printStackTrace();
}
}
}
Hi Alexander,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13993. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-13993) have been fixed in this Aspose.Words for .NET 17.2.0 update and this Aspose.Words for Java 17.2.0 update.


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