Free Support Forum - aspose.com

Border-collapse and border-spacing seems to be ignored

Hi,


we have a html with css. The table is formatted with border-collapse and border-spacing.

You can see that the word document has the required formatting. If we save the document as pdf, there is no border-spacing at all.

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

Here is a Test Project:

<pre style=“font-family: “Courier New”;”><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 09.11.2016.
*/

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

try {

String html = \n+
" #article {\n" +
" width: 100%;\n" +
" border-collapse: separate;\n" +
" border-spacing: 5px\n" +
" }\n" +
\n+
" #article td, #article th {\n" +
" font-size: 1em;\n" +
" border: 1px solid #98bf21;\n" +
" padding: 3px 7px 2px 7px;\n" +
" }\n" +
\n+
" #article th {\n" +
" font-size: 1.1em;\n" +
" text-align: left;\n" +
" padding-top: 5px;\n" +
" padding-bottom: 4px;\n" +
" background-color: #a7c942;\n" +
" color: #fff;\n" +
" }\n" +
\n+
" #article tr.alt td {\n" +
" color: #000;\n" +
" background-color: #eaf2d3;\n" +
" }\n" +
\n+
“<table id=article>\n+
" \n" +
" Position \n" +
" Article \n" +
" Desc \n" +
" Tax \n" +
" Amount \n" +
" Unitcost\n \n" +
" TotalPrice \n" +
"
\n" +
" <tr class=alt>\n" +
" 1 \n" +
" 0000001 \n" +
" Table \n" +
" 19,00 \n" +
" 1 ST \n" +
" 250 EUR \n" +
" 250 EUR \n" +
" \n" +
" \n" +
" 2 \n" +
" 0000002 \n" +
" Bench \n" +
" 19,00 \n" +
" 2 ST \n" +
" 100 EUR \n" +
" 200 EUR \n" +
"
\n" +
" <tr class=alt>\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" TotalPrice \n" +
" 450 EUR \n" +
" \n" +
\n;


Document document = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(document);

documentBuilder.insertHtml(html);

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


} catch (Exception e) {
e.printStackTrace();
}
}
}

Hi Cailun,


Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 16.11.0, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-14446. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Morning


Has this issue been resolved.

Border-Spacing seems to be ignored
Hi Cailun,

Thanks for your inquiry.

Unfortunately, your issue (WORDSNET-14446) is not resolved yet and there are no estimates available. Our product team has completed the analysis and the root cause of this issue has been identified. However, because of complexity, the implementation of the fix of this issue has been postponed till a later date (no ETA is available). We will inform you via this thread as soon as this issue will be resolved in future. We apologize for your inconvenience.

Best regards,