Exemple #1
0
 internal BorderInfo(RPLElementStyle style, int width, int height, bool slant, bool omitBorderTop, bool omitBorderBottom, bool defaultLine, IExcelGenerator excel)
 {
     m_omitBorderTop    = omitBorderTop;
     m_omitBorderBottom = omitBorderBottom;
     if (height == 0)
     {
         if (defaultLine)
         {
             m_topBorder = new BorderProperties(ExcelBorderPart.Top);
             FillBorderProperties(excel, m_topBorder, style[5], style[10], style[0]);
         }
         else
         {
             m_bottomBorder = new BorderProperties(ExcelBorderPart.Bottom);
             FillBorderProperties(excel, m_bottomBorder, style[5], style[10], style[0]);
         }
     }
     else if (width == 0)
     {
         m_leftBorder = new BorderProperties(ExcelBorderPart.Left);
         FillBorderProperties(excel, m_leftBorder, style[5], style[10], style[0]);
     }
     else if (slant)
     {
         m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalUp);
         FillBorderProperties(excel, m_diagonal, style[5], style[10], style[0]);
     }
     else
     {
         m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalDown);
         FillBorderProperties(excel, m_diagonal, style[5], style[10], style[0]);
     }
 }
        public static float GetReportSizeStyleMM(RPLElementStyle properties, byte style)
        {
            object obj = properties[style];

            if (obj != null)
            {
                return((float)new RPLReportSize((string)obj).ToMillimeters());
            }
            return(float.NaN);
        }
        public static RPLFormat.BorderStyles GetStylePropertyValueBorderStyle(RPLElementStyle properties, byte style, RPLFormat.BorderStyles defaultStyle)
        {
            object obj = properties[style];

            if (obj != null)
            {
                return((RPLFormat.BorderStyles)obj);
            }
            return(defaultStyle);
        }
        public static Color GetReportColorStyle(RPLElementStyle properties, byte style)
        {
            object obj = properties[style];

            if (obj != null)
            {
                return(new RPLReportColor((string)obj).ToColor());
            }
            return(Color.Empty);
        }
        protected override void RenderTextBox(RPLTextBox textBox, RPLItemMeasurement measurement, int cellIndex, float left, BorderContext borderContext, bool inTablix, bool hasBorder)
        {
            RPLTextBoxPropsDef textBoxPropsDef = default(RPLTextBoxPropsDef);
            bool            isSimple           = default(bool);
            string          textBoxValue       = default(string);
            bool            notCanGrow         = default(bool);
            bool            needsTable         = default(bool);
            RPLElementStyle style             = default(RPLElementStyle);
            int             oldCellIndex      = default(int);
            RPLTextBoxProps textBoxProperties = base.GetTextBoxProperties(textBox, out textBoxPropsDef, out isSimple, out textBoxValue, inTablix, out notCanGrow, hasBorder, cellIndex, out needsTable, out style, out oldCellIndex);

            base.RenderTextBoxProperties(inTablix, cellIndex, needsTable, style);
            base.RenderTextBox(textBox, inTablix, cellIndex, needsTable, style, measurement, notCanGrow, textBoxPropsDef, textBoxProperties, isSimple, textBoxValue, borderContext, oldCellIndex);
        }
 protected override void RenderPageStart(bool firstPage, bool lastPage, RPLElementStyle pageStyle)
 {
     this.WriteStream(HTML4Renderer.m_openDiv);
     this.WriteStream(HTML4Renderer.m_ltrDir);
     this.WriteStream(HTML4Renderer.m_openStyle);
     if (base.m_deviceInfo.IsBrowserIE)
     {
         this.WriteStream(HTML4Renderer.m_styleHeight);
         this.WriteStream(HTML4Renderer.m_percent);
         this.WriteStream(HTML4Renderer.m_semiColon);
     }
     this.WriteStream(HTML4Renderer.m_styleWidth);
     this.WriteStream(HTML4Renderer.m_percent);
     this.WriteStream(HTML4Renderer.m_semiColon);
     this.WriteStream("direction:ltr");
     this.WriteStream(HTML4Renderer.m_quote);
     this.RenderReportItemId("oReportDiv");
     if (base.m_pageHasStyle)
     {
         Stream mainStream = base.m_mainStream;
         using (MemoryStream memoryStream = new MemoryStream())
         {
             base.m_mainStream = memoryStream;
             base.RenderBackgroundStyleProps(pageStyle);
             int num = 0;
             base.RenderHtmlBorders(pageStyle, ref num, 0, true, true, null);
             Encoding encoding = new UTF8Encoding(false);
             this.PageStyle = encoding.GetString(memoryStream.ToArray());
         }
         base.m_mainStream = mainStream;
         mainStream        = null;
     }
     else
     {
         this.PageStyle = null;
     }
     this.WriteStream(HTML4Renderer.m_closeBracket);
     this.WriteStream(HTML4Renderer.m_openTable);
     this.WriteStream(HTML4Renderer.m_closeBracket);
     this.WriteStream(HTML4Renderer.m_firstTD);
     this.RenderReportItemId("oReportCell");
     base.RenderZoom();
     this.WriteStream(HTML4Renderer.m_closeBracket);
 }
        public void BuildHeaderFooterString(StringBuilder str, RPLTextBoxProps textBox, ref string lastFont, ref double lastFontSize)
        {
            RPLElementStyle style = textBox.Style;
            string          text  = (string)style[20];

            if (!string.IsNullOrEmpty(text) && !text.Equals(lastFont))
            {
                str.Append("&").Append("\"");
                FormulaHandler.EncodeHeaderFooterString(str, text);
                str.Append("\"");
                lastFont = text;
            }
            string text2 = (string)style[21];

            if (!string.IsNullOrEmpty(text2))
            {
                double num = LayoutConvert.ToPoints(text2);
                if (num != 0.0 && num != lastFontSize)
                {
                    str.Append("&").Append((int)num);
                }
                lastFontSize = num;
            }
            StringBuilder stringBuilder = new StringBuilder();
            object        obj           = style[19];

            if (obj != null && (RPLFormat.FontStyles)obj == RPLFormat.FontStyles.Italic)
            {
                str.Append("&I");
                stringBuilder.Append("&I");
            }
            object obj2 = textBox.Style[22];

            if (obj2 != null && LayoutConvert.ToFontWeight((RPLFormat.FontWeights)obj2) >= 600)
            {
                str.Append("&B");
                stringBuilder.Append("&B");
            }
            object obj3 = textBox.Style[24];

            if (obj3 != null)
            {
                RPLFormat.TextDecorations num2 = (RPLFormat.TextDecorations)obj3;
                if (num2 == RPLFormat.TextDecorations.Underline)
                {
                    str.Append("&u");
                    stringBuilder.Append("&u");
                }
                if (num2 == RPLFormat.TextDecorations.LineThrough)
                {
                    str.Append("&s");
                    stringBuilder.Append("&s");
                }
            }
            string text3 = string.Empty;
            string text4 = ((RPLTextBoxPropsDef)textBox.Definition).Formula;

            if (text4 != null && text4.Length != 0)
            {
                if (text4.StartsWith("=", StringComparison.Ordinal))
                {
                    text4 = text4.Remove(0, 1);
                }
                text3 = FormulaHandler.ProcessHeaderFooterFormula(text4);
            }
            if (text3 != null && text3.Length != 0)
            {
                str.Append(text3);
            }
            else
            {
                string text5 = textBox.Value;
                if (text5 == null)
                {
                    text5 = ((RPLTextBoxPropsDef)textBox.Definition).Value;
                }
                if (text5 == null && textBox.OriginalValue != null)
                {
                    text5 = textBox.OriginalValue.ToString();
                }
                if (text5 != null)
                {
                    FormulaHandler.EncodeHeaderFooterString(str, text5.Trim());
                }
            }
            if (stringBuilder.Length > 0)
            {
                str.Append(stringBuilder);
            }
            str.Append(" ");
        }
        private void ProcessBorders(GdiWriter writer, RPLElementStyle style, RectangleF position, RectangleF bounds, byte state)
        {
            RPLFormat.BorderStyles stylePropertyValueBorderStyle = SharedRenderer.GetStylePropertyValueBorderStyle(style, 5, RPLFormat.BorderStyles.None);
            BorderLeft.Style   = SharedRenderer.GetStylePropertyValueBorderStyle(style, 6, stylePropertyValueBorderStyle);
            BorderTop.Style    = SharedRenderer.GetStylePropertyValueBorderStyle(style, 8, stylePropertyValueBorderStyle);
            BorderRight.Style  = SharedRenderer.GetStylePropertyValueBorderStyle(style, 7, stylePropertyValueBorderStyle);
            BorderBottom.Style = SharedRenderer.GetStylePropertyValueBorderStyle(style, 9, stylePropertyValueBorderStyle);
            if (BorderLeft.Style == RPLFormat.BorderStyles.None && BorderTop.Style == RPLFormat.BorderStyles.None && BorderRight.Style == RPLFormat.BorderStyles.None && BorderBottom.Style == RPLFormat.BorderStyles.None)
            {
                return;
            }
            float reportSizeStyleMM = SharedRenderer.GetReportSizeStyleMM(style, 10);

            BorderLeft.Width = SharedRenderer.GetReportSizeStyleMM(style, 11);
            if (float.IsNaN(BorderLeft.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderLeft.Width = reportSizeStyleMM;
            }
            BorderTop.Width = SharedRenderer.GetReportSizeStyleMM(style, 13);
            if (float.IsNaN(BorderTop.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderTop.Width = reportSizeStyleMM;
            }
            BorderRight.Width = SharedRenderer.GetReportSizeStyleMM(style, 12);
            if (float.IsNaN(BorderRight.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderRight.Width = reportSizeStyleMM;
            }
            BorderBottom.Width = SharedRenderer.GetReportSizeStyleMM(style, 14);
            if (float.IsNaN(BorderBottom.Width) && !float.IsNaN(reportSizeStyleMM))
            {
                BorderBottom.Width = reportSizeStyleMM;
            }
            if (!float.IsNaN(BorderLeft.Width) || !float.IsNaN(BorderTop.Width) || !float.IsNaN(BorderRight.Width) || !float.IsNaN(BorderBottom.Width))
            {
                Color reportColorStyle = SharedRenderer.GetReportColorStyle(style, 0);
                BorderLeft.Color = SharedRenderer.GetReportColorStyle(style, 1);
                if (BorderLeft.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderLeft.Color = reportColorStyle;
                }
                BorderTop.Color = SharedRenderer.GetReportColorStyle(style, 3);
                if (BorderTop.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderTop.Color = reportColorStyle;
                }
                BorderRight.Color = SharedRenderer.GetReportColorStyle(style, 2);
                if (BorderRight.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderRight.Color = reportColorStyle;
                }
                BorderBottom.Color = SharedRenderer.GetReportColorStyle(style, 4);
                if (BorderBottom.Color == Color.Empty && reportColorStyle != Color.Empty)
                {
                    BorderBottom.Color = reportColorStyle;
                }
                if (!(BorderLeft.Color == Color.Empty) || !(BorderTop.Color == Color.Empty) || !(BorderRight.Color == Color.Empty) || !(BorderBottom.Color == Color.Empty))
                {
                    RenderingItem.ProcessBorders(writer, ref BorderTop, ref BorderLeft, ref BorderBottom, ref BorderRight, position, bounds, state);
                }
            }
        }
Exemple #9
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);
        }
 internal ReportParagraph(RPLElementStyle style, string uniqueName)
 {
     m_style      = style;
     m_uniqueName = uniqueName;
 }
 internal ReportTextRun(RPLElementStyle sourceStyle, Dictionary <string, float> cachedReportSizes, Dictionary <string, Color> cachedReportColors)
 {
     m_sourceStyle = sourceStyle;
     SetFontSize(cachedReportSizes);
     SetFontColor(cachedReportColors);
 }
 internal ReportTextRun(RPLElementStyle sourceStyle, string uniqueName, RPLActionInfo sourceActionInfo, Dictionary <string, float> cachedReportSizes, Dictionary <string, Color> cachedReportColors)
     : this(sourceStyle, cachedReportSizes, cachedReportColors)
 {
     m_uniqueName = uniqueName;
     m_actionInfo = sourceActionInfo;
 }
Exemple #13
0
 public ReportParagraph(RPLElementStyle style, string uniqueName)
 {
     this.m_style      = style;
     this.m_uniqueName = uniqueName;
 }
 public ReportTextRun(RPLElementStyle sourceStyle, Dictionary <string, float> cachedReportSizes, Dictionary <string, Color> cachedReportColors)
 {
     this.m_sourceStyle = sourceStyle;
     this.SetFontSize(cachedReportSizes);
     this.SetFontColor(cachedReportColors);
 }