Vertical Page offset

Vertical Page offset

Forum member · Feb 22, 2006
For example if I have a page which can fit 20 lines. And I have report data: -- the 1st record takes 5 lines + 1 line for space. -- the 2nd record takes 6 lines + 1 line for space. -- the 3rd record takes 3 lines + 1 line for space. -- the 4rd record takes 6 lines + 1 line for space. Since I cannot fit the 4 record(number of lines for the first 3 records will be 17), is there a way I can go back and pad extra spaces. so the result I need to figure out would be -- the 1st record takes 5 lines + 2 line for space. -- the 2nd record takes 6 lines + 2 line for space. -- the 3rd record takes 3 lines + 2 line for space. and move the 4th record to the next page. And ideas highly appreciated.

Re: Vertical Page offset

Support · Feb 23, 2006
Hello, Sure this is not a problem at all. The best way to handle this is by using TextAreas for each record. So every time you add record to one TextArea, get the height required for the text in the record and start the next TextArea whose Y co-ordinate is equal to height required by the first text area (calculated using GetRequiredHeight() property of TextArea) + padding(if needed). Next thing you want is to figure out if there is enough room to fit all lines of the next record. So you will just have to subtract the location on the page that the last TextArea stopped from plus the padding from the total amount of height of the page and you will get how much space you have at the bottom of the page to work with. So let’s say hypothetically your last record lines have a total height of 200 points. Then if you calculate that there is only, say, 400 points on the bottom of the page to work with then you know for sure that the last record lines will fit on the bottom and you can place them there. If however you calculate that there is only, say, 100, points left on the bottom of this page then you will create a new page and place your last record lines on the very last page. Thanks, ceTe Software Support Team

Re: Vertical Page offset

Forum member · Feb 23, 2006
Thank you so much for answering my question. Maybe I was not clear, I am using HTMLText area and the required height to decide when I can fit the record and move it to the next page. But what I need is say if there is enough white space left on the bottom of the page, is there a way I can go back to the records I added on the page and add the padding line's. It's basically page aesthetics so they look equally aligned(best fit) and no white space on the body bottom. If I could implement this easily my user's would love me to death :-) Once again thank you so much for your help.

Re: Vertical Page offset

Support · Feb 23, 2006
Hello, In this case, make sure to add HtmlTextArea for each record to the page in the end after you figure out whether or not all records will fit on same page (i.e. after doing all the calculations). If all records can not fit on the same page, you can increase the padding between them to cover up for white spaces at the bottom and accordingly modify the starting Y co-ordinate of the HtmlTextArea for the next record. After doing all the calculations, then you should add HtmlTextArea for each record to the page. Thanks, ceTe Software Support Team

Re: Vertical Page offset

Forum member · Feb 23, 2006
Yep that's what I need but how do I perform those calculation for padding(extra lines between each record). Here is the scenario, we generate paper Survey's dynamically. For Example if I have 100 questions in a survey, I know the page size by calculating the height of each question. Based on the calculation now I know I need to create a tabloid page(4 page). When I start placing question's on the form, say I could fit all the Questions within 3 page's leaving an empty page. What I need to do or what I am looking for is a calculation that will help me spread out questions evenly across all pages so that I am not left with an empty white page in the end and also in each page spread out questions by adding extra lines so that they occupy the width of the page. Final result should be 100 questions should occupy 4 pages by spreading out evenly in each page by using additional padding/extra lines. What it means to the end user is the Survey's aligned vertically in each page and occupy all the white spaces to the end of the 4th page. The calculation that I would need should help me add/increase extra lines between each question's.

Re: Vertical Page offset

Support · Feb 23, 2006
Hello, Once you determine that you need to increase the padding between HtmlTextArea, all you need to do is change the starting Y-co-ordinate of the next following HtmlTextArea by increasing the padding between two. For example, your page height is 800 points and your have four HtmlTextArea each of height 100, 200, 100, 300 points respectively. You use padding of 100 between each HtmlTextArea initially. So after adding all three HtmlTextArea the remaining space at the end of the page is 100 points after considering the padding. Since there is no room to fit the fourth HtmlTextArea, you add it to Page2. Now you go back to your first page and reorganize the padding. That is increase it from 100 to 200 and that should layout the three HtmlTextArea on Page1 evenly with equal spacing between all and also eliminates the white space at the bottom of the page. Case before increasing the padding -------------------------------------------------- First HtmlTextArea - Starts at 0 on Page 1 Second HtmlTextArea - Starts at 200 on Page1 Third HtmlTextArea - Starts at 500 on Page 1 Fourth HtmlTextArea - Starts at 0 on Page2 Case after increasing padding from 100 to 200 -------------------------------------------------- First HtmlTextArea - Starts at 0 on Page 1 Second HtmlTextArea - Starts at 300 on Page1 Third HtmlTextArea - Starts at 600 on Page 1 Fourth HtmlTextArea - Starts at 0 on Page2 Thanks, ceTe Software Support Team

Re: Vertical Page offset

Forum member · Feb 23, 2006
That's exactly what I need. But when I add elements to the page, in this case HTMLArea, How can I identify/access the page element? Can I say something like Page1.HTMLArea1.Y = 300 Page1.HTMLArea2.Y = 600 Or did you mean I need to pre-process these calculation and and store these co-ordinate info in a list. After the pre-process completes, when it comes to display data on the page read the values from the list.

Re: Vertical Page offset

Support · Feb 23, 2006
Hello, Since HtmlTextArea for each record will be a separate page element you can identify it as follows no matter on which page they are: HtmlTextArea htmlArea1 = new HtmlTextArea(htmlText, 0, 0, 256, 400) HtmlTextArea htmlArea2 = new HtmlTextArea(htmlText, 0, 200, 56, 40) So, in order to change the starting Y-co-ordinate for htmlArea1 all you need to do is: htmlArea1.Y = 300; htmlArea2.Y = 600; Thanks, ceTe Software Support Team

Re: Vertical Page offset

Forum member · Feb 28, 2006
Awesome, thank you so much for your help.

Re: Vertical Page offset

Forum member · Feb 28, 2006
Sorry one last question. How do I dynamically assign the variable name to implement the solution you suggested? while (data.Read()) { HTMLTextArea ht = new HTMLTextArea(formattedText, currentX, currentY , bodyWidth , 11, style); } I cannot do something like this HTMLTextArea ht+i.ToString() = new HTMLTextArea(formattedText, currentX, currentY , bodyWidth , 11, style);

Re: Vertical Page offset

Support · Feb 28, 2006
Couldn't you just reuse the same variable name once the HtmlTextArea has been added to the page? For instance: HTMLTextArea ht while (data.Read()) { ht = new HTMLTextArea(formattedText, currentX, currentY , bodyWidth , 11, style); } Thanks, ceTe Software Support Team

Re: Vertical Page offset

Forum member · Feb 28, 2006
HTMLTextArea ht while (data.Read()) { ht = new HTMLTextArea(formattedText, currentX, currentY , bodyWidth , 11, style); } say if I have to peform same page layout calculation here which gives me a new Y location for the 5th element How do I go back to list of ht elements I added and specify ht[5].Y = 250; Do I need to add these elements to a collection list or ArrayList

Re: Vertical Page offset

Support · Mar 1, 2006
Hello, Yes, in this case you will have to store all the elements inside of a collection (List or ArrayList) to use it for resetting their values based on page layout calculation. Thanks, ceTe Software Support Team