fluentreports icon indicating copy to clipboard operation
fluentreports copied to clipboard

[FRG] absoluteY does not reset after page break

Open beauwest opened this issue 4 years ago • 4 comments

In the Fluent API, we can specify a manual report.newPage(), but I don't see a way to do that in FRG.

Currently, even if I try to copy the newLine JSON syntax, and manually add

{"type":"newPage"}

as a child of a section, it does not create a new page.

I have a large final summary section that I would like to place a page break inside of.

beauwest avatar Aug 18 '20 16:08 beauwest

I did just find that manually setting

{"type":"newPage", "active":true},

In the JSON will work.

However, after a new page, absoluteY has to be reset to 0, but in the visual editor that causes elements to overlap.

beauwest avatar Aug 18 '20 16:08 beauwest

Their is two things...

  1. Are you aware that all sections has a Page break feature, this allows you to force a page feed before or after a section is printed (however, I'm not sure that would help you in this case).

  2. On the toolbar; image this has been available; the double page on the right creates this entry (that you found) in the JSON. :grinning:

Now as to the absoluteY; that is an interesting glitch -- I'll have to figure a good work around for it...

NathanaelA avatar Aug 19 '20 23:08 NathanaelA

Huh, I'm not quite sure how I missed that button. 😳

My workaround for the absoluteY issue, so far, is something like this, in case it's useful to see what I'm wanting.

  let pastPageBreak = false;
  let subtract = 0;
  for (const child of structure.finalSummary.children) {
    if (child.type === 'newPage') {
      pastPageBreak = true;
      subtract = 0;
    }
    if (!subtract && pastPageBreak && child.settings && child.settings.absoluteY) {
      subtract = child.settings.absoluteY;
    }
    if (subtract) {
      child.settings.absoluteY -= subtract;
    }
  }

In my use case, I have a final summary, with 2 manual page breaks in it, as well as a pageBreak "before". It's a long one.

beauwest avatar Aug 20 '20 12:08 beauwest

@beauwest - This issue ended up being a bit more tricky to fix and ended up messing up some reports... So all the other issues you reported have been fixed in the new 1.3.4 version; this specific one we are still working on& dealing with the several corner cases that occurred when we implemented this...

NathanaelA avatar Sep 03 '20 06:09 NathanaelA