Page 1 of 1

Css support for xhtml to docx and pdf

PostPosted: Sun Jan 06, 2013 7:45 am
by Frobl
We are considering using docx4j in a project for making docx and pdf documents from some xhtml.

I did some tests and found it to be difficult to achieve the required result. The problem I had was. I did not find any way to put elements in a two column layout (or more then two columns. Is there any place I can find documentation on which css tags are supported? I tried to use table and remove the borders, but was unable to remove borders. I also tried to use floating layout, or display: inline.

Thanks for all help :)

Re: Css support for xhtml to docx and pdf

PostPosted: Mon Jan 07, 2013 3:28 pm
by jason
Frobl wrote: Is there any place I can find documentation on which css tags are supported? I


See http://stackoverflow.com/questions/1244 ... xhtml-tags

XHTMLImporter contains:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                        // borders.  rudimentary support
                        // for now, look just at border-top-style.
                        // If it is not 'none', for example 'solid', display a border.
                        // cssTable.getBorder requires a CssContext; so just
                        FSDerivedValue borderTopStyle = box.getStyle().valueByName(CSSName.BORDER_TOP_STYLE);
                        if (borderTopStyle!=null  // what to default to if its null?
                                        && borderTopStyle.asString().toLowerCase().contains("none")) {
                                log.debug("setting borders to none");
                                try {
                                                        TblBorders borders = (TblBorders)XmlUtils.unmarshalString(WORDML_TABLE_BORDERS, Context.jc, TblBorders.class);
                                                        tblPr.setTblBorders(borders);
                                                } catch (JAXBException e1) {}                                  
                        }

 
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


so try border-top="none" on your table.

That code was introduced 19/9; I think it is in 2.8.1.

Re: Css support for xhtml to docx and pdf

PostPosted: Mon Jan 07, 2013 10:14 pm
by Frobl
Thanks. I have been using 2.8.0, and when testing 2.8.1 it worked.

In 2.8.1 there seems to be some changes in what xml library is used, becouse I'm not able to use 2.8.1 in the context of my project. I will be looking into which library causes the conflict.

Re: Css support for xhtml to docx and pdf

PostPosted: Thu Jan 31, 2013 1:31 am
by louffoster
I had a similar problem and tried add css: border-top="none". It did nothing, the table borders remain.
I am using 2.8.1

Any help would be great!

Re: Css support for xhtml to docx and pdf

PostPosted: Sun Feb 17, 2013 2:46 am
by Sharcoux
Any new tag supported since last September ?

Re: Css support for xhtml to docx and pdf

PostPosted: Sun Feb 17, 2013 9:57 am
by jason