Printing table with large data

24 views
Skip to first unread message

Hari

unread,
Aug 27, 2009, 9:37:34 AM8/27/09
to SWT PaperClips
Hi,
I am trying to print a table with large number of columns (> 30) , I
used combination of ScalePrint and GridPrint,
but data shrink to fit the page and makes it unreadable, is there any
way to print large table like Excel does, print columns to next page
if they don't fit in one page.

Thanks
Harish

Matthew Hall

unread,
Aug 27, 2009, 10:21:12 AM8/27/09
to swt-pap...@googlegroups.com
Hari,

Have you tried BigPrint?

Matthew

Hari

unread,
Aug 27, 2009, 10:57:18 AM8/27/09
to SWT PaperClips
I tried BIgPrint but I had to use with PagePrint as I has show page
number, but data got scaled to suite page.
I will try without PagePring, but is there way to set page number with
BigPrint.

Matthew Hall

unread,
Aug 27, 2009, 11:14:59 AM8/27/09
to swt-pap...@googlegroups.com
You want to wrap the BigPrint in the PagePrint, not the other way around, e.g.

PagePrint {
  body = BigPrint {
    target = GridPrint
  }
}

Matthew

Hari

unread,
Aug 31, 2009, 9:27:22 AM8/31/09
to SWT PaperClips
Hi,
Thank you It worked, but I couldn't control the columns which should
be moved next page.
The data is last column get truncated in first page but the complete
content is written in next page.

So I am trying to use GridPrint over Gridprint (split table as
multiple tables based on columns and add table to a cell entry in
parent grid).

Other thing which I noted is I don't have control over text alignment.
For some I used right alignment but it always printing to left.
Major issue with this number, left printing for number takes more
space.

Matthew Hall

unread,
Aug 31, 2009, 9:49:52 AM8/31/09
to swt-pap...@googlegroups.com
Hari wrote:
> Hi,
> Thank you It worked, but I couldn't control the columns which should
> be moved next page.
>
No, PaperClips is currently not able to do this elegantly. I have some
ideas for how to fix it but I don't have enough bandwidth to work on it
right now. Would you file an issue for this so I don't forget it? (Use
a summary such as "control how a PrintPiece is divided".

> So I am trying to use GridPrint over Gridprint (split table as
> multiple tables based on columns and add table to a cell entry in
> parent grid).
>
Sadly this will not give you ideal printouts unless every row lays out
at the same height.

> Other thing which I noted is I don't have control over text alignment.
> For some I used right alignment but it always printing to left.
> Major issue with this number, left printing for number takes more
> space.
>
In addition to setting the alignment on the TextPrint, you also must to
supply the same alignment to GridPrint when you add the TextPrint to it:

TextPrint text = new TextPrint("text");
text.setAlign(SWT.RIGHT);
grid.add(SWT.RIGHT, text);

Hope this helps,

Matthew

Hari

unread,
Sep 29, 2009, 10:13:37 AM9/29/09
to SWT PaperClips


On Aug 31, 6:49 pm, Matthew Hall <matth...@woodcraftmill.com> wrote:
> Hari wrote:
> > Hi,
> > Thank you It worked, but I couldn't control the columns which should
> > be moved next page.
>
> No, PaperClips is currently not able to do this elegantly.  I have some
> ideas for how to fix it but I don't have enough bandwidth to work on it
> right now.  Would you file an issue for this so I don't forget it?  (Use
> a summary such as "control how a PrintPiece is divided".> So I am trying to use GridPrint over Gridprint (split table as
> > multiple tables based on columns and add table to a cell entry in
> > parent grid).
Hi I am trying to look at the code to fix the column truncation issue
while printing across multiple page. Instead of column data getting
truncated I wanted to move it next page, can you give me some
pointers, I am trying to look at next(int, int) in GridIterator but I
have not reached point where it divide columns across pages.

Matthew Hall

unread,
Sep 29, 2009, 1:47:03 PM9/29/09
to swt-pap...@googlegroups.com
Hari wrote:
> Hi I am trying to look at the code to fix the column truncation issue
> while printing across multiple page. Instead of column data getting
> truncated I wanted to move it next page, can you give me some
> pointers, I am trying to look at next(int, int) in GridIterator but I
> have not reached point where it divide columns across pages.
>
You won't find it--GridPrint does not divide columns across pages. If a
GridPrint is getting divided horizontally, it is because it is wrapped
in a BigPrint. However BigPrint is totally unaware that its target is a
GridPrint and so doesn't know that the GridPrint would prefer to be
divided up in a particular way.

There are a couple ways to solve this, each with their own challenges:
1) Add methods to GridPrint e.g. setAllowColumnSplit(boolean) or
setAllowColumnOverlap or something, and refactor GridPrint to break
columns across pages.
2) Add a class for specifically wrapping GridPrint e.g. BigGridPrint,
that is aware of how GridPrint lays out columns and divides them
sensibly across pages.

Solution 1 has the benefit of ensuring that a super-wide column will be
confined to one page wide instead of being split across several pages.
However it makes the GridIterator code extremely complex (it actually
completely changes the column size distribution strategy) and makes
assumptions about the surrounding document--namely, that subsequent
pages will have the exact same area in which to lay out the next
columns. Take a look at the documentation for BigPrint for an
explanation of what happens when these conditions are not satisfied.

Solution 2 is simpler and more modular but then you lose the ability to
confine any one column to a single page. So a column that would
normally have word wrap applied sensibly could suddenly be tens of pages
wide with all text on a single line.

Please note that I am in the midst of migrating the PaperClips projects
to http://www.eclipse.org/nebula/ and that there are breaking changes
happening in the transition.

Matthew

Reply all
Reply to author
Forward
0 new messages