Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi everyone
I need to justify a paragraph like what Microsoft Word does.
Word Justfy options are: justify, justify low, justify medium, justify high
I found TextAlign in RDLC but it does not solve my issue.
any suggestion would be appreciated.

Regards Jamal
Posted
Updated 5-Sep-16 7:25am

Hi,

This is not available in reporting services. There is only Left, Center and Right.

Default & General dont do anything..

Nothing can we do.. If possible let me know..
Thanks,
 
Share this answer
 
Comments
Jamal Seyedi 30-May-11 9:16am    
thanks for answering me.
I have not found anything so far.
But I realy need to do that , i am searching for a way to simulate it.
AFAIK there is no option for that in RDLC.
Try this alternative
SQL Reporting Services Justify text in a textbox[^]
 
Share this answer
 
I just create a function that returns a list of strings, but you hace to use a monospace font like "Courier".

C#
        public static List<string> GetText(string text, int width)
        {
            string[] palabras = text.Split(' ');
            StringBuilder sb1 = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();
            int length = palabras.Length;
            List<string> resultado = new List<string>();
            for (int i = 0; i < length; i++)
            {
                sb1.AppendFormat("{0} ", palabras[i]);
                if (sb1.ToString().Length > width)
                {
                    resultado.Add(sb2.ToString());
                    sb1 = new StringBuilder();
                    sb2 = new StringBuilder();
                    i--;
                }
                else
                {
                    sb2.AppendFormat("{0} ", palabras[i]);
                }
            }
            resultado.Add(sb2.ToString());

            List<string> resultado2 = new List<string>();
            string temp;

            int index1, index2, salto;
            string target;
            int limite = resultado.Count;
            foreach (var item in resultado)
            {
                target = " ";
                temp = item.ToString().Trim();
                index1 = 0; index2 = 0; salto = 2;

                if (limite <= 1)
                {
                    resultado2.Add(temp);
                    break;
                }
                while (temp.Length <= width)
                {
                    if (temp.IndexOf(target, index2) < 0)
                    {
                        index1 = 0; index2 = 0;
                        target = target + " ";
                        salto++;
                    }
                    index1 = temp.IndexOf(target, index2);
                    temp = temp.Insert(temp.IndexOf(target, index2), " ");
                    index2 = index1 + salto;

                }
                limite--;
                resultado2.Add(temp);
            }
            return resultado2;
        }

</string></string></string></string></string>


Hope it helps!
 
Share this answer
 
Comments
Dave Kreskowiak 5-Sep-16 14:56pm    
Don't drop answers on FIVE YEAR OLD questions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900