Exemplo n.º 1
0
        public HeaderFooterLayout(RPLReport report, float aWidth, float aHeight)
            : base(report)
        {
            this.m_fullList = new List <ReportItemInfo>();
            int num = LayoutConvert.ConvertMMTo20thPoints((double)aWidth);

            this.m_height      = aHeight;
            this.m_centerWidth = num / 3;
            this.m_rightWidth  = this.m_centerWidth * 2;
            this.m_leftList    = new List <ReportItemInfo>();
            this.m_centerList  = new List <ReportItemInfo>();
            this.m_rightList   = new List <ReportItemInfo>();
        }
Exemplo n.º 2
0
        public void RenderStrings(RPLReport report, IExcelGenerator excel, out string left, out string center, out string right)
        {
            foreach (ReportItemInfo full in this.m_fullList)
            {
                RPLPageLayout rPLPageLayout = full.RPLSource as RPLPageLayout;
                if (rPLPageLayout == null)
                {
                    RPLTextBox   rPLTextBox = full.RPLSource as RPLTextBox;
                    RPLItemProps rPLItemProps;
                    byte         b = default(byte);
                    if (rPLTextBox != null)
                    {
                        if (rPLTextBox.StartOffset > 0)
                        {
                            rPLItemProps = base.m_report.GetItemProps(rPLTextBox.StartOffset, out b);
                        }
                        else
                        {
                            rPLItemProps = (RPLItemProps)rPLTextBox.ElementProps;
                            b            = 7;
                        }
                    }
                    else
                    {
                        rPLItemProps = base.m_report.GetItemProps(full.RPLSource, out b);
                    }
                    if (b == 7)
                    {
                        full.Values = (RPLTextBoxProps)rPLItemProps;
                        RPLElementStyle     style = rPLItemProps.Style;
                        HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left;
                        object obj = style[25];
                        if (obj != null)
                        {
                            horizontalAlignment = LayoutConvert.ToHorizontalAlignEnum((RPLFormat.TextAlignments)obj);
                        }
                        int    num   = 0;
                        int    num2  = 0;
                        string text  = (string)rPLItemProps.Style[15];
                        string text2 = (string)rPLItemProps.Style[16];
                        if (text != null)
                        {
                            num = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text));
                        }
                        if (text2 != null)
                        {
                            num2 = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text2));
                        }
                        switch (horizontalAlignment)
                        {
                        case HorizontalAlignment.Left:
                            full.AlignmentPoint = full.Left + num;
                            break;

                        case HorizontalAlignment.Right:
                            full.AlignmentPoint = full.Right - num2;
                            break;

                        default:
                            full.AlignmentPoint = full.Left + (full.Right - full.Left + num - num2) / 2;
                            break;
                        }
                        if (full.AlignmentPoint < this.m_centerWidth)
                        {
                            this.m_leftList.Add(full);
                        }
                        else if (full.AlignmentPoint < this.m_rightWidth)
                        {
                            this.m_centerList.Add(full);
                        }
                        else
                        {
                            this.m_rightList.Add(full);
                        }
                    }
                }
            }
            this.m_leftList.Sort(ReportItemInfo.CompareTopsThenLefts);
            this.m_centerList.Sort(ReportItemInfo.CompareTopsThenLefts);
            this.m_rightList.Sort(ReportItemInfo.CompareTopsThenLefts);
            left   = this.RenderString(this.m_leftList, excel);
            center = this.RenderString(this.m_centerList, excel);
            right  = this.RenderString(this.m_rightList, excel);
        }