Is there a bug tracker where I can formally submit this bug? It should be easy to fix and add it to the regular battery of tests.
here is my unit test to verify my results:
- Code: Select all
package test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.docx4j.convert.in.xhtml.XHTMLImporterImpl;
import org.docx4j.openpackaging.exceptions.Docx4JException;
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.junit.Test;
public class Docx4jCssComplianceTest {
@Test
public void testTableInheritsStrikeThru() throws Docx4JException, IOException {
String html = "<html><head><style>\n .change_type_D, .change_type_D *, .change_type_D td {"
+"text-decoration: line-through; "
+"}\n "
+".change_type_D table, .change_type_D td, .change_type_D H1 {\n"
+" text-decoration: inherit;\n"
+"}\n</style></head><body><section>no styled </section><section class=\"change_type_D\"><H1>Should be strikenthru text</H1><p>styled paragraph text</p><table><tbody><tr><td>hello</td><td><a href=\"#\">link</a></td></tr></tbody></table></section></body></html>";
FileUtils.writeStringToFile(new File("target/docx4j_css_test.html"), html);
FileOutputStream fos = new FileOutputStream(new File("target/docx4j_css_test.docx"));
WordprocessingMLPackage doc = WordprocessingMLPackage.createPackage();
XHTMLImporterImpl xhtmlImporter = new XHTMLImporterImpl(doc);
xhtmlImporter.setHyperlinkStyle("Hyperlink");
doc.getMainDocumentPart().getContent().addAll(xhtmlImporter.convert(html, "http://localhost/"));
doc.save(fos);
fos.flush();
fos.close();
}
}