private static BorderProperties FillBorderProperties(IExcelGenerator excel, BorderProperties currBorder, BorderProperties border, ExcelBorderPart part, object style, object width, object color)
        {
            BorderProperties borderProperties = currBorder;

            if (style != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
            }
            if (width != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Width = LayoutConvert.ToPoints((string)width);
            }
            if (color != null && !color.Equals("Transparent"))
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Color = excel.AddColor((string)color);
            }
            return(borderProperties);
        }
Beispiel #2
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>();
        }
        public static int GetPageSizeIndex(float pageWidth, float pageHeight, out bool isPortrait)
        {
            int num  = (int)Math.Round((double)pageWidth);
            int num2 = (int)Math.Round((double)pageHeight);

            for (int i = 0; i < PageSizeIndex.m_mmWidth.Length; i++)
            {
                if (num2 == PageSizeIndex.m_mmHeight[i] && num == PageSizeIndex.m_mmWidth[i])
                {
                    isPortrait = true;
                    return(PageSizeIndex.m_mmSizeIndex[i]);
                }
            }
            for (int j = 0; j < PageSizeIndex.m_mmWidth.Length; j++)
            {
                if (num2 == PageSizeIndex.m_mmWidth[j] && num == PageSizeIndex.m_mmHeight[j])
                {
                    isPortrait = false;
                    return(PageSizeIndex.m_mmSizeIndex[j]);
                }
            }
            float num3 = (float)Math.Round(LayoutConvert.ToInches(pageHeight.ToString(CultureInfo.InvariantCulture) + "mm"), 1);
            float num4 = (float)Math.Round(LayoutConvert.ToInches(pageWidth.ToString(CultureInfo.InvariantCulture) + "mm"), 1);

            for (int k = 0; k < PageSizeIndex.m_inchWidth.Length; k++)
            {
                if (num3 == PageSizeIndex.m_inchHeight[k] && num4 == PageSizeIndex.m_inchWidth[k])
                {
                    isPortrait = true;
                    return(PageSizeIndex.m_inchSizeIndex[k]);
                }
            }
            for (int l = 0; l < PageSizeIndex.m_inchWidth.Length; l++)
            {
                if (num4 == PageSizeIndex.m_inchHeight[l] && num3 == PageSizeIndex.m_inchWidth[l])
                {
                    isPortrait = false;
                    return(PageSizeIndex.m_inchSizeIndex[l]);
                }
            }
            if (pageHeight >= pageWidth)
            {
                isPortrait = true;
            }
            else
            {
                isPortrait = false;
            }
            return(0);
        }
 private void FillBorderProperties(IExcelGenerator excel, BorderProperties border, object style, object width, object color)
 {
     if (style != null)
     {
         border.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
     }
     if (width != null)
     {
         border.Width = LayoutConvert.ToPoints((string)width);
     }
     if (color != null && !color.Equals("Transparent"))
     {
         border.Color = excel.AddColor((string)color);
     }
 }
Beispiel #5
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);
        }
Beispiel #6
0
 public static double ConvertMMTo20thPointsUnrounded(double aMm)
 {
     return(LayoutConvert.ConvertMMToPoints(aMm) * 20.0);
 }
Beispiel #7
0
 public static int ConvertMMTo20thPoints(double aMm)
 {
     return((int)Math.Round(LayoutConvert.ConvertMMToPoints(aMm) * 20.0 + 0.00051, 3));
 }