On Sun, Nov 9, 2014 at 12:06 PM, Chuck Davis <[email protected]> wrote:
> I've been looking at ODF for Java reporting (using the Toolbox) and have
> hit a snag.  Heretofore I have been using pdf (iText)
>
> When developing reports I create a char[] that fits the width of the page
> depending on page size and orientation.  When the data for that report line
> is placed correctly in the buffer, I then add lines to the report by
> placing my array into the report.  This has been working wonderfully for
> PDF.  I try this on ODF and all the spaces get stripped out.  Is there a
> way to make ODF handle a buffer full of data the way I insert it --
> including spaces?  I don't think inserting <text:s><text:c/></text:s> for
> every 2 or three space break is going to be a nice (or usable) approach.
> That's OK for word processing but it's not ok for developing Java reports.
>

That's how ODF (and XML) handle whitepace.   You'd see the same
behavior in an HTML document.

One approach might be to keep your logic the same with your buffer,
fill it with spaces as you do now, but then call a conversion function
to expand the spaces into what ODF expects.   That would at least
isolate this to one place.

Another idea might be to use <text:tab> rather than multiple spaces,
or even layout via a table, for even more control.


> At this point I'm thinking ODF is not too usable for doing Java reporting.
> If I am incorrect I'd like to know how to make ODF keep my formatting for
> each line of the report without screwing up all the spacing.
>

I've seen many people use ODF for report generating.   The key, I've
found at least, is to take a structural approach, specifying the
structure of the page, and not the exact positioning/spacing.   That's
the difference between a fixed-layout format like PDF and a markup
language like ODF that defers layout until loaded into an editor.

Regards,

-Rob


> Thanks if anyone knows.

Reply via email to