证明RDLC中的一个段落 [英] justify a paragraph in RDLC

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

问题描述

大家好吧

我需要证明像Microsoft Word一样的段落。

Word Justfy选项是:证明合理,证明低,证明中等,证明高

我在RDLC中找到了TextAlign,但它没有解决我的问题。

任何建议都会受到赞赏。



问候Jamal

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

推荐答案

您好,



这在报告服务中不可用。只有左,中,右。



默认和一般不做任何事情..



没什么我们可以做..如果可能请告诉我..

谢谢,
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,


AFAIK在RDLC中没有选项。

尝试这个替代方案

SQL Reporting Services在文本框中对齐文本 [ ^ ]
AFAIK there is no option for that in RDLC.
Try this alternative
SQL Reporting Services Justify text in a textbox[^]


我只是创建一个返回字符串列表的函数,但是你需要使用等宽字体Courier。



I just create a function that returns a list of strings, but you hace to use a monospace font like "Courier".

        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天全站免登陆