I've got a SQL Reporting Services 2005 report that includes a textbox on the first page. The string input for the textbox can be very large and include newlines. The textbox size is fixed and another textbox is included on the second page of the report to handle any spillover text that didn't fit in the first page's textbox. If the second page textbox becomes full, then I would like to include a "..." at the end of the text to show that some text was cut off.
I've tried using the TextRenderer.MeasureText() method but it appears to only work on single lines. I'm trying the following code
string str = string.Copy(commentString);
TextFormatFlags flags = TextFormatFlags.WordBreak |
TextFormatFlags.WordEllipsis |
TextFormatFlags.ModifyString;
float textBoxWidthInches = 3.8f;
float textBoxHeightInches = 3.4f;
Size size = new Size(
(int)(textBoxWidthInches * 72 - 2),
(int)(textBoxHeightInches * 72 - 2));
TextRenderer.MeasureText(str, new Font("Arial", 8), size, flags);
I then expect the str to include a '\0' at the point where I need to break my string, however, it isn't showing up. If I remove the WordBreak flag and input a string with a long first line, it does include the '\0' at the correct spot for the first line, but it is only working for a single line.
My questions are:
1) How do I "continue" text from one textbox to another in Sql Reporting Services 2005?
2) If not, how can I calculate where I need to break my string up so that it fits inside a textbox?
3) Optionally I'd like to include a "..." at the end of the second textbox for text that is longer than both textboxes can fit.
Edit: What I'm trying to accomplish is something like this:
|------------------------|
| |
| Header Page 1 |
|------------------------|
| | |
| | |
|TextBox1| |
| | |
|--------| |
| |
| Other Data |
| |
| |
| |
| |
| |
| |
| |
|------------------------|
|------------------------|
| |
| Header Page 2 |
|------------------------|
| | |
| | |
|TextBox2| |
| | |
|--------| |
| |
| Other Data |
| |
| |
| |
| |
| |
| |
| |
|------------------------|
I then want TextBox1 to continue to TextBox2 on the second page. Using the CanGrow attribute will not get the desired behavior.