Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
Handling TOP MARGIN for page when content length varies dramatically
posted

I know about the Container / Condition object, but it does not seem to quite meet my needs.  What I need is a more robust Container / Condition object.

 

For example, in my current project, I have several "Recommendation" paragraphs.

 

Recommendation 1 has, let's say, 3 paragraphs.

Recommendation 2 has, let's say, 6 paragraphs.

...
...

Recommendation "Nth" has, let's say, 2 paragraphs.

 

 

I don't know until runtime WHICH Recommendations will apply, and which ones will NOT apply.   The Recommendation paragraphs that do NOT apply are never seen.  Which means there can be combinations like

 

Recommendation 1 paragraphs followed by the Recommendation 2 paragraphs

 

or

 

Recommendation 2 paragraphs followed by the Recommednation 5 paragraphs followed by the Recommendation 8 paragraphs.

 

or

 

NONE of the Recommendations may be applied

 

or

 

ALL of them might be applied.

 

How do you go about handling those permutations and still have the document "LOOK RIGHT" ???

 

Now, the reason why I cannot just let them be appiled in order is ...  TOP MARGIN for the Section is set to ZERO.  I do this so that the first page, which has an IMAGE at the top of it, can run-up against the very TOP of the page.  But everywhere else, I need the TOP margin to be 30 pixels.  Since there is no way to have the TOP margin be "0" for only the first page, and "30" on all subsequent pages -- can you see my problem?

 

I can't really know until runtime WHERE I will need to AddPageBreak(  ) and insert a Gap of 30 pixels.

 

Or, if I implement the TOP margin as 30 pixels for the entire report ---   How do I get the IMAGE on the first page (of each section) to run up against the top of the page?  It can't, cuz the TOP margin is 30 pixels!!!!

Parents
  • 37774
    Verified Answer
    posted

    I think that the simplest solution to getting an image on the top of the first page and a top margin on the remaining pages would be to kind of 'hack' it through the use of headers.  On the first page, you would add the image to the header and specifically set the size of the header, but make sure that the Repeat property of this header is false.  Then you would add a second header with a height of 30 but with no content, which will cause the content on the remaining pages to be spaced down by 30.  So you might have something like:

    ISectionHeader header = section.AddHeader();
    header.Repeat = false;
    Infragistics.Documents.Graphics.Image image = new Infragistics.Documents.Graphics.Image("Pie.png");
    header.AddImage(image, 0, 0);
    header.Height = Infragistics.Documents.Utils.Converter.PixelsToPoints(image.Height);

    header = section.AddHeader();
    header.Height = 30;

    -Matt 

Reply Children
No Data