Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 621943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:55:50+00:00 2026-05-13T18:55:50+00:00

I’ve got a SQL Reporting Services 2005 report that includes a textbox on the

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:55:51+00:00Added an answer on May 13, 2026 at 6:55 pm

    Here is what I ended up with:

      public static IList<string> WordWrap(
         string text,
         Font printFont,
         Graphics graphics,
         IList<SizeF> sizeF,
         string tooLongText)
      {
         List<string> list = new List<string>();
         int charsFit;
         int linesFilled;
    
         foreach (SizeF size in sizeF)
         {
    
            graphics.MeasureString(
               text,
               printFont,
               size,
               new StringFormat(),
               out charsFit,
               out linesFilled);
    
            char[] whitespace = new[] { ' ', '\t', '\r', '\n' };
            int index = charsFit;
    
            if (text.Length > charsFit)
               index = text.LastIndexOfAny(whitespace, charsFit);
    
            if (index < 0) index = charsFit;
    
            string rv = text.Substring(0, index).Trim();
            text = text.Substring(index).Trim();
            list.Add(rv);
         }
    
         if (!string.IsNullOrEmpty(text))
         {
            string lastText = list[list.Count - 1];
            SizeF size = sizeF[sizeF.Count - 1];
            charsFit = 0;
            string newLastText = lastText + Environment.NewLine + tooLongText;
            while (charsFit < newLastText.Length)
            {
               graphics.MeasureString(
                  newLastText,
                  printFont,
                  size,
                  new StringFormat(),
                  out charsFit,
                  out linesFilled);
               lastText = lastText.Substring(0, lastText.Length - 1);
               newLastText = lastText + Environment.NewLine + tooLongText;
            }
    
            list.RemoveAt(list.Count - 1);
            list.Add(newLastText);
         }
    
         return list;
      }
    

    I then generate two public string properties for my two textboxes. If this function returns a list with count > 0, first textbox value = list[0]. If list count > 1, second textbox value = list[1]. Not the best code I’m sure, but it worked for my needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 386k
  • Answers 386k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Java : http://programmaremobile.blogspot.com/2009/01/facebook-java-apieng.html PHP: http://www.merchantos.com/makebeta/facebook/facebook-php-tutorial/ Update: For authentification, you can… May 14, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer So the answer to this question was: the WSDL does… May 14, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer Yes, you can. Simply call the OpenGL ES 1.0 APIs.… May 14, 2026 at 11:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.