예제 #1
0
        private string RenderString(List <ReportItemInfo> list, IExcelGenerator excel)
        {
            StringBuilder            stringBuilder            = new StringBuilder();
            HeaderFooterRichTextInfo headerFooterRichTextInfo = null;
            double num  = 0.0;
            string text = string.Empty;
            bool   flag = false;

            foreach (ReportItemInfo item in list)
            {
                if (stringBuilder.Length > 0 && !stringBuilder[stringBuilder.Length - 1].Equals("\n"))
                {
                    stringBuilder.Append("\n");
                }
                RPLTextBoxPropsDef rPLTextBoxPropsDef = item.Values.Definition as RPLTextBoxPropsDef;
                if (rPLTextBoxPropsDef.IsSimple)
                {
                    if (flag)
                    {
                        headerFooterRichTextInfo.CompleteCurrentFormatting();
                    }
                    excel.BuildHeaderFooterString(stringBuilder, item.Values, ref text, ref num);
                    flag = false;
                }
                else
                {
                    flag = true;
                    RPLTextBox rPLTextBox = (RPLTextBox)item.RPLSource;
                    if (headerFooterRichTextInfo == null)
                    {
                        headerFooterRichTextInfo = new HeaderFooterRichTextInfo(stringBuilder);
                    }
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.General;
                    bool   renderListPrefixes = true;
                    object obj = rPLTextBox.ElementProps.Style[29];
                    if (obj != null)
                    {
                        renderListPrefixes = ((RPLFormat.Directions)obj == RPLFormat.Directions.LTR);
                    }
                    LayoutEngine.RenderRichText(null, rPLTextBox, headerFooterRichTextInfo, true, null, renderListPrefixes, ref horizontalAlignment);
                    num  = headerFooterRichTextInfo.LastFontSize;
                    text = headerFooterRichTextInfo.LastFontName;
                    headerFooterRichTextInfo.CompleteRun();
                }
            }
            return(stringBuilder.ToString(0, Math.Min(stringBuilder.Length, 256)));
        }