コード例 #1
0
        internal HeaderFooterLayout(RPLReport report, float aWidth, float aHeight)
            : base(report)
        {
            m_fullList = new List <ReportItemInfo>();
            int num = LayoutConvert.ConvertMMTo20thPoints(aWidth);

            m_height      = aHeight;
            m_centerWidth = num / 3;
            m_rightWidth  = m_centerWidth * 2;
            m_leftList    = new List <ReportItemInfo>();
            m_centerList  = new List <ReportItemInfo>();
            m_rightList   = new List <ReportItemInfo>();
        }
コード例 #2
0
        internal void RenderStrings(RPLReport report, IExcelGenerator excel, out string left, out string center, out string right)
        {
            foreach (ReportItemInfo full in m_fullList)
            {
                RPLPageLayout rPLPageLayout = full.RPLSource as RPLPageLayout;
                if (rPLPageLayout != null)
                {
                    continue;
                }
                RPLTextBox   rPLTextBox = full.RPLSource as RPLTextBox;
                RPLItemProps rPLItemProps;
                byte         elementType;
                if (rPLTextBox != null)
                {
                    if (rPLTextBox.StartOffset > 0)
                    {
                        rPLItemProps = m_report.GetItemProps(rPLTextBox.StartOffset, out elementType);
                    }
                    else
                    {
                        rPLItemProps = (RPLItemProps)rPLTextBox.ElementProps;
                        elementType  = 7;
                    }
                }
                else
                {
                    rPLItemProps = m_report.GetItemProps(full.RPLSource, out elementType);
                }
                if (elementType == 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 < m_centerWidth)
                    {
                        m_leftList.Add(full);
                    }
                    else if (full.AlignmentPoint < m_rightWidth)
                    {
                        m_centerList.Add(full);
                    }
                    else
                    {
                        m_rightList.Add(full);
                    }
                }
            }
            m_leftList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_centerList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_rightList.Sort(ReportItemInfo.CompareTopsThenLefts);
            left   = RenderString(m_leftList, excel);
            center = RenderString(m_centerList, excel);
            right  = RenderString(m_rightList, excel);
        }