Page 1 of 1

PTab Align Right supported for FO, but not Center and Left

PostPosted: Sun Jun 18, 2017 11:01 am
by Vikram
Jason,

I noticed that since 3.20, there is support in FO for PTab align right, but not for center and left. Would it be possible to support the latter two as well?

My specific use case is putting text into headers and footers. Using the default header and footer styles results in a correctly formatted footer in the docx file, but the FO export messes up what should be the right-aligned text (see attached PDF).

Using a PTab with align right correctly positions the rightmost text in the footer, but that seems to mess up what should be the centered text -- it shows up left-aligned in the PDF.

I'm thinking that perhaps being able to use the other alignments of PTab (at least the center one) might help.

FWIW -- Word uses PTabs in some of its built-in footers, like it's "Blank (Three Columns)" one, which is what our users want to imitate.

Without PTabs, currently the available solution would seem to be to insert a three-column table in the header/footer and manage the contents of cells, which seems a bit excessive.

Thanks!

Vikram

Re: PTab Align Right supported for FO, but not Center and Le

PostPosted: Mon Jun 19, 2017 1:40 pm
by jason
Hi Vikram

To implement something like this, the first thing to check is whether XSL FO supports it.

In the case of tabs, this is a challenge; see https://www.google.com.au/search?q=xsl+fo+tab+support

There are workarounds, for example, http://services.renderx.com/lists/xep-support/5367.html:

When I've had to mimic a single tab stop, I've used an inline
container of the width from the start of the line to the tab stop,
filled the container with the content I know to be less than the
width, then I've stacked the next information after the container,
which gives the appearance of a tab stop. ... If the use of tabs is well defined, then why not allow your users to
use tabs and then have your XSLT interpret the tabs into columnar
layout constructs more easily formatted by XSL-FO?


So implementing support for tabs would involve some effort. You're welcome to try it, and I'd be happy to accept a pull request if you succeed :-)

As an alternative, you could try Plutext's commercial PDF Converter. Since it doesn't use XSL FO, it can/does support tabs.

Re: PTab Align Right supported for FO, but not Center and Le

PostPosted: Mon Jun 19, 2017 1:49 pm
by jason
Without PTabs, currently the available solution would seem to be to insert a three-column table in the header/footer and manage the contents of cells, which seems a bit excessive.


A workaround might be to do this programmatically. In other words, users use centre tab (as usual), but then later you use docx4j to detect the centre tab, then if you find that, replace the paragraph with a three-column table (which XSL FO then processes).

Re: PTab Align Right supported for FO, but not Center and Le

PostPosted: Tue Jun 20, 2017 3:20 pm
by Vikram
Thanks for the links -- very illuminating.

I've tested the commercial Plutext converter, and the PDF looks beautiful. But we can't afford it (yet), so for now at least we'll go with the table-in-the-header/footer.

Best,

Vikram