We help IT Professionals succeed at work.
Get Started

Help with page break logic.

GY1680
GY1680 asked
on
573 Views
Last Modified: 2012-08-14
I'm trying to find a good way of performing a mathematical calculation based on given quantities and logic, but my brain isn't working today so I was hoping someone might have done something similar and could provide some insight.

Here's what I'm trying to do.

I have "sections" of data.  It's XML.  I'm essentially wanting to force a page break before the data gets cut off by the PDF control in my web application.  I've determined some number for "maximum data to be on the page" - let's call that 100.

So what I'm looking at right now is about 20 "sections" and performing some sort of logic like this:

Section A
Section B
Section C
Section D

If
      Section A + Section B > 100
Then
      Page break before Section B.

If
      Section A + Section B < 100
But
      Section A + Section B + Section C > 100
Then
      Page break before Section C.
      
If
      Section A + Section B + Section C < 100
But
      Section A + Section B + Section C + Section D > 100
Then
      Page break before Section D.

Please let me know if you can think of another way to do this that would be less......verbose.

Thanks.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE