Пример #1
0
        private void setColorProfile()
        {
            var    alpha   = "FF";
            String profile = parser.getProfile();

            if ((profile.ToLower().Equals("color")) || profile.ToLower().Equals("full_color"))
            {
                bgColor            = alpha + "D1E5FE";
                lineColor          = alpha + "A4BED4";
                headerTextColor    = alpha + "000000";
                scaleOneColor      = alpha + "FFFFFF";
                scaleTwoColor      = alpha + "E3EFFF";
                gridTextColor      = alpha + "00FF00";
                watermarkTextColor = alpha + "8b8b8b";
            }
            else
            {
                if (profile.ToLower().Equals("gray"))
                {
                    bgColor            = alpha + "E3E3E3";
                    lineColor          = alpha + "B8B8B8";
                    headerTextColor    = alpha + "000000";
                    scaleOneColor      = alpha + "FFFFFF";
                    scaleTwoColor      = alpha + "EDEDED";
                    gridTextColor      = alpha + "000000";
                    watermarkTextColor = alpha + "8b8b8b";
                }
                else
                {
                    bgColor            = alpha + "FFFFFF";
                    lineColor          = alpha + "000000";
                    headerTextColor    = alpha + "000000";
                    scaleOneColor      = alpha + "FFFFFF";
                    scaleTwoColor      = alpha + "FFFFFF";
                    gridTextColor      = alpha + "000000";
                    watermarkTextColor = alpha + "000000";
                }
            }
        }
Пример #2
0
        private void setColorProfile()
        {
            var    alpha   = "FF";
            String profile = parser.getProfile();

            if ((profile.ToLower().Equals("color")) || profile.ToLower().Equals("full_color"))
            {
                BGColor            = alpha + _stripColor(BGColor, "D1E5FE");
                LineColor          = alpha + _stripColor(LineColor, "A4BED4");
                HeaderTextColor    = alpha + _stripColor(HeaderTextColor, "000000");
                ScaleOneColor      = alpha + _stripColor(ScaleOneColor, "FFFFFF");
                ScaleTwoColor      = alpha + _stripColor(ScaleTwoColor, "E3EFFF");
                GridTextColor      = alpha + _stripColor(GridTextColor, "00FF00");
                WatermarkTextColor = alpha + _stripColor(WatermarkTextColor, "8b8b8b");
            }
            else
            {
                if (profile.ToLower().Equals("gray"))
                {
                    BGColor            = alpha + _stripColor(BGColor, "E3E3E3");
                    LineColor          = alpha + _stripColor(LineColor, "B8B8B8");
                    HeaderTextColor    = alpha + _stripColor(HeaderTextColor, "000000");
                    ScaleOneColor      = alpha + _stripColor(ScaleOneColor, "FFFFFF");
                    ScaleTwoColor      = alpha + _stripColor(ScaleTwoColor, "EDEDED");
                    GridTextColor      = alpha + _stripColor(GridTextColor, "000000");
                    WatermarkTextColor = alpha + _stripColor(WatermarkTextColor, "8b8b8b");
                }
                else
                {
                    BGColor            = alpha + _stripColor(BGColor, "FFFFFF");
                    LineColor          = alpha + _stripColor(LineColor, "000000");
                    HeaderTextColor    = alpha + _stripColor(HeaderTextColor, "000000");
                    ScaleOneColor      = alpha + _stripColor(ScaleOneColor, "FFFFFF");
                    ScaleTwoColor      = alpha + _stripColor(ScaleTwoColor, "FFFFFF");
                    GridTextColor      = alpha + _stripColor(GridTextColor, "000000");
                    WatermarkTextColor = alpha + _stripColor(WatermarkTextColor, "000000");
                }
            }
        }
Пример #3
0
        private void rowsPrint(ExcelXmlParser parser, Stream resp)
        {
            ExcelRow[] rows = parser.getGridContent();

            this.rows_stat = rows.Length;

            ExcelBorder border = getBorder();
            ExcelFont   font   = wb.CreateFont("Arial", 10);

            // if (gridTextColor != "FF000000")
            //      font.Color = gridTextColor;

            for (uint row = 1; row <= rows.Length; row++)
            {
                ExcelCell[] cells  = rows[row - 1].getCells();
                uint        rowInd = (uint)(row + headerOffset);
                //  sheet.Rows[rowInd].Height = 20;

                for (uint col = 1; col <= cells.Length; col++)
                {
                    if (cells[col - 1].GetBold() || cells[col - 1].GetItalic())
                    {
                        ExcelFont curFont = wb.CreateFont("Arial", 10);;
                        // if (gridTextColor != "FF000000")
                        //       font.Color = gridTextColor;
                        if (cells[col - 1].GetBold())
                        {
                            font.Bold = true;
                        }

                        if (cells[col - 1].GetItalic())
                        {
                            font.Italic = true;
                        }

                        sheet.Cells[rowInd, col].Style.Font = curFont;
                    }
                    else
                    {
                        sheet.Cells[rowInd, col].Style.Font = font;
                    }

                    sheet.Cells[rowInd, col].Style.Border = border;


                    if ((!cells[col - 1].GetBgColor().Equals("")) && (parser.getProfile().Equals("full_color")))
                    {
                        sheet.Cells[rowInd, col].Style.Fill.ForegroundColor = "FF" + cells[col - 1].GetBgColor();
                    }
                    else
                    {
                        //Colour bg;
                        if (row % 2 == 0 && scaleTwoColor != "FFFFFFFF")
                        {
                            sheet.Cells[rowInd, col].Style.Fill.ForegroundColor = scaleTwoColor;
                        }
                        else
                        {
                            if (scaleOneColor != "FFFFFFFF")
                            {
                                sheet.Cells[rowInd, col].Style.Fill.ForegroundColor = scaleOneColor;
                            }
                        }
                    }


                    int    intVal;
                    double dbVal;

                    if (int.TryParse(cells[col - 1].GetValue(), out intVal))
                    {
                        sheet.Cells[rowInd, col].Value = intVal;
                    }
                    else if (double.TryParse(cells[col - 1].GetValue(), out dbVal))
                    {
                        sheet.Cells[rowInd, col].Value = dbVal;
                    }
                    else
                    {
                        sheet.Cells[rowInd, col].Value = cells[col - 1].GetValue();
                    }


                    //COLOR!



                    //String al = cells[row].getAlign();
                    //if (al == "")
                    //    al = cols[0][row].getAlign();
                    //if (al.equalsIgnoreCase("left"))
                    //{
                    //    f.setAlignment(Alignment.LEFT);
                    //}
                    //else
                    //{
                    //    if (al.equalsIgnoreCase("right"))
                    //    {
                    //        f.setAlignment(Alignment.RIGHT);
                    //    }
                    //    else
                    //    {
                    //        f.setAlignment(Alignment.CENTRE);
                    //    }
                    //}
                }
            }
            headerOffset += rows.Length;
        }