在RDLC中证明段落 [英] Justify Paragraph in RDLC

查看:91
本文介绍了在RDLC中证明段落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试证明RDLC页面的TextBox中的段落。

仅在RDLC中左,右和中心对齐是可能的。 Justify没有任何规定。

你可以帮我一些代码或技巧来做这件事。

解决方案

请有一个看看:



http://social.msdn.microsoft.com/Forums/is/sqlreportingservices/thread/ecf375d1-7991-4e07-9180-ddbcc2bffd55 [ ^ ]


 = Code.JustifyTheText(First(Fields!FieldValue.Value,DATASET),310,100,0)


I做了一个函数,将一个字符串转换为一个字符串列表,这样你就可以在表格中使用它没有标题,用快递新字体(相同的宽度字符)



< pre lang =c#> public static 列表< 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 >





希望它有所帮助!


I'm trying to justify paragraph within TextBox of RDLC Page.
In RDLC only left, Right and Center align is possible. There is no any provision for Justify.
Can you Please help me with some code or trick to do this.

解决方案

Please have a look at:

http://social.msdn.microsoft.com/Forums/is/sqlreportingservices/thread/ecf375d1-7991-4e07-9180-ddbcc2bffd55[^]


=Code.JustifyTheText(First(Fields!FieldValue.Value, "DATASET"),310,100,0)


I made a function that convert a string into a list of strings so you can use it in a table wuth no header, in courier new font (same width character)

        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!


这篇关于在RDLC中证明段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆