I don't know if this is possible, but I presume that it is, I just have to work out the "how".
The dilemna is, that I have lots of data that I gather from multiple places and the data has to be printed in specific locations based on the size of the previous items printed. For example, I have one field that is retrieved from a multiline textbox control and may contain no lines or it may contain a hundred lines. Programmatically I can measure the string to see how much room it takes to print and adjust the fields after it up or down the requisite number so as to continue the printing without huge gaps in the words.
To get each of the 150 or so fields and format them properly on the many pages, I have to loop through several different controls. Since the data is being gathered from a loop, if I stop processing the loop when my page is full, the next page contains some of the same information, based upon which control was partially printed.
To combat this, I took an inefficient route that seemed to work, but alas, it too has flaws. I started by creating a "Y" property. Then as I incremented each bit of text to print in the Y Axis, I simply adjusted the "Y" property the requisite amount. In the property function, I check to see if the value is greater than 0 (top of the page) and less than the "Top Margin" if it is, I return the top margin to the next call to Y. Like so:
For each of my text items this works wonderfully, except if I have a large body of text that spans past the bottom margin.
I am considering a while loop to handle the large bodies of text unless there is an easier way.
The easier way is what I am after ... after all, isn't that why we write code .. to make things easier?
I'd appreciate any insight.
The dilemna is, that I have lots of data that I gather from multiple places and the data has to be printed in specific locations based on the size of the previous items printed. For example, I have one field that is retrieved from a multiline textbox control and may contain no lines or it may contain a hundred lines. Programmatically I can measure the string to see how much room it takes to print and adjust the fields after it up or down the requisite number so as to continue the printing without huge gaps in the words.
To get each of the 150 or so fields and format them properly on the many pages, I have to loop through several different controls. Since the data is being gathered from a loop, if I stop processing the loop when my page is full, the next page contains some of the same information, based upon which control was partially printed.
To combat this, I took an inefficient route that seemed to work, but alas, it too has flaws. I started by creating a "Y" property. Then as I incremented each bit of text to print in the Y Axis, I simply adjusted the "Y" property the requisite amount. In the property function, I check to see if the value is greater than 0 (top of the page) and less than the "Top Margin" if it is, I return the top margin to the next call to Y. Like so:
VB.NET:
Private Property Y() As Integer
Get
If m_Y >= 0 And m_Y <= marginTop Then
Return marginTop
Else
Return m_Y
End If
End Get
Set(ByVal value As Integer)
m_Y = value
End Set
End Property
For each of my text items this works wonderfully, except if I have a large body of text that spans past the bottom margin.
I am considering a while loop to handle the large bodies of text unless there is an easier way.
The easier way is what I am after ... after all, isn't that why we write code .. to make things easier?
I'd appreciate any insight.