Page 1 of 1

[RESOLVED] XHTML to docx : P 10pts after spaces

PostPosted: Fri Mar 08, 2013 12:43 am
by kevins
Hi Jason!

When I export some HTML without any "after spaces" specification (the custom control binding in the template has no spaces anymore too), I got automatically an after space of 10pts in the docx document.

Where is the html :

Code: Select all
<div><p style="text-align: left;"><font face="'Segoe UI'">Test 1</font></p><p style="text-align: left;"><font face="'Segoe UI'">Test 2</font></p></div>


Thanks in advance for your help

Re: XHTML to docx : P 10pts after spaces

PostPosted: Wed Mar 13, 2013 2:31 am
by kevins
Hi Jason!

Is there a way to solve this bug?

Thanks!

Kévin

Re: XHTML to docx : P 10pts after spaces

PostPosted: Wed Mar 13, 2013 7:16 pm
by jason
When I run your HTML through the ConvertInXHTMLFragment sample, the result is:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" >
    <w:body>
        <w:p>
            <w:pPr>
                <w:ind w:left="0"/>
                <w:jc w:val="left"/>
                <w:textAlignment w:val="auto"/>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:color w:val="000000"/>
                    <w:sz w:val="22"/>
                </w:rPr>
                <w:t>Test 1</w:t>
            </w:r>
        </w:p>
        <w:p>
            <w:pPr>
                <w:ind w:left="0"/>
                <w:jc w:val="left"/>
                <w:textAlignment w:val="auto"/>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:color w:val="000000"/>
                    <w:sz w:val="22"/>
                </w:rPr>
                <w:t>Test 2</w:t>
            </w:r>
        </w:p>
        <w:sectPr>
            <w:pgSz w:code="1" w:h="15840" w:w="12240"/>
            <w:pgMar w:left="1440" w:bottom="1440" w:right="1440" w:top="1440"/>
        </w:sectPr>
    </w:body>
</w:document>
 
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


Interpreting this, w:spacing/@w:after is not being set.

So your spacing will be coming from your default paragraph style (which applies as no style is specified).

After today's https://github.com/plutext/docx4j/commi ... 999a712e11 you can use style="margin-bottom: 5mm;" to control this from your XHTML.

Re: XHTML to docx : P 10pts after spaces

PostPosted: Wed Mar 13, 2013 11:19 pm
by kevins
Thanks! :)