/// <summary>
        /// Sets the specified style by rows indexes. The row index is interpreted by index in source table (not reporting version of the table -- i.e. heading rows are not counted, only data)
        /// </summary>
        /// <param name="style">The style.</param>
        /// <param name="rowIndexes">The row indexes.</param>
        /// <returns>Rule that was created</returns>
        public dataRowIndexDynamicStyle <DataRowInReportTypeEnum> SetStyleForRows(DataRowInReportTypeEnum style, IEnumerable <Int32> rowIndexes)
        {
            var indexC = new dataRowIndexDynamicStyle <DataRowInReportTypeEnum>(style, rowIndexes);

            indexC.indexFromSourceTable = true;
            units.Add(indexC);
            return(indexC);
        }
        /// <summary>
        /// Sets the specified style by rows indexes. The row index is interpreted by index in source table (not reporting version of the table -- i.e. heading rows are not counted, only data)
        /// </summary>
        /// <param name="style">The style.</param>
        /// <param name="rowIndex">Index of the row.</param>
        /// <returns>
        /// Rule that was created
        /// </returns>
        public dataRowIndexDynamicStyle <DataRowInReportTypeEnum> SetStyleForRows(DataRowInReportTypeEnum style, Int32 rowIndex)
        {
            var indexC = new dataRowIndexDynamicStyle <DataRowInReportTypeEnum>(style, new Int32[] { rowIndex });

            indexC.indexFromSourceTable = true;
            units.Add(indexC);
            return(indexC);
        }
        public void DeployStyle(Object enumType)
        {
            key = enumType;

            if (enumType is DataRowInReportTypeEnum)
            {
                DataRowInReportTypeEnum enumType_DataRowInReportTypeEnum = (DataRowInReportTypeEnum)enumType;
                DeployDefault(enumType_DataRowInReportTypeEnum);
            }
        }
        /// <summary>
        /// Sets the style for rows with value.
        /// </summary>
        /// <typeparam name="TValueType">The type of the value type.</typeparam>
        /// <param name="style">The style.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="valuesToMatch">The row indexes.</param>
        /// <returns></returns>
        public dataValueMatchCriterionDynamicStyle <TValueType, DataRowInReportTypeEnum> SetStyleForRowsWithValue <TValueType>(DataRowInReportTypeEnum style, String columnName, IEnumerable <TValueType> valuesToMatch) where TValueType : IComparable
        {
            var indexC = new dataValueMatchCriterionDynamicStyle <TValueType, DataRowInReportTypeEnum>(valuesToMatch, style, columnName);

            units.Add(indexC);
            return(indexC);
        }
 public DataRowMetaDefinition(DataRow instance, DataRowInReportTypeEnum type)
 {
     rowType     = type;
     rowInstance = instance;
 }
 public DataRowMetaDefinition(DataRowInReportTypeEnum type)
 {
     rowType = type;
 }
 public DataRowMetaDefinition(DataRowInReportTypeEnum __rowType, templateFieldDataTable __cellDataSource)
 {
     rowType        = __rowType;
     cellDataSource = __cellDataSource;
 }
 public DataRowMetaDefinition(DataRowInReportTypeEnum __rowType, dataPointAggregationType __aggregation)
 {
     rowType     = __rowType;
     aggregation = __aggregation;
 }
        public static ExcelNamedStyleXml MakeStyle(this ExcelStyles styles, dataTableStyleSet styleSet, DataRowInReportTypeEnum data)
        {
            var output = styles.CreateNamedStyle(data.ToString());

            output.Style.SetStyle(styleSet.rowStyles[data]);
            return(output);
        }
        /// <summary>
        /// Deploys the style to row.
        /// </summary>
        /// <param name="ex_row">The ex row.</param>
        /// <param name="in_row">The in row.</param>
        /// <param name="ws">The ws.</param>
        /// <param name="metaSet">The meta set.</param>
        public void DeployStyleToRow(ExcelRow ex_row, DataRow in_row, ExcelWorksheet ws, tableStyleRowSetter metaSet = null)
        {
            DataRowInReportTypeEnum style = DataRowInReportTypeEnum.data;

            if (extraRowStyles.ContainsKey(in_row))
            {
                style = extraRowStyles[in_row];
            }

            bool isEven = ((in_row.Table.Rows.IndexOf(in_row) % 2) > 0);

            Boolean isLegend = in_row.Table.TableName == LEGENDTABLE_NAME;

            var baseStyle = styleSet.rowStyles[style];

            var rowsMetaSet = this.GetRowMetaSet();

            if (metaSet != null)
            {
                rowsMetaSet = metaSet;
            }

            var response = rowsMetaSet.evaluate(in_row, this, baseStyle);

            if (response != null)
            {
                if (response.style != null)
                {
                    baseStyle = response.style;
                }
            }
            if (baseStyle == null)
            {
                baseStyle = styleSet.rowStyles[style];
            }
            foreach (string s in response.notes)
            {
                Console.WriteLine(s);
            }

            ex_row.SetStyle(baseStyle, isEven);

            switch (style)
            {
            case DataRowInReportTypeEnum.columnCaption:
                if (!isLegend)
                {
                    foreach (var cpair in categories)
                    {
                        foreach (selectZone zone in categories.categoryZones[cpair.Key])
                        {
                            var sl = ws.getExcelRange(ex_row, zone);
                            sl.Style.Fill.PatternType = ExcelFillStyle.Solid;

                            var col = categories.categoryColors[cpair.Key];     //.First().DefaultBackground(System.Drawing.Color.Gray);
                            sl.Style.Fill.BackgroundColor.SetColor(col);
                            sl.Style.Fill.BackgroundColor.Tint = new decimal(0.2);
                        }
                    }
                }
                break;

            case DataRowInReportTypeEnum.mergedHeaderTitle:
                ws.Cells[ex_row.Row, 1, ex_row.Row, in_row.Table.Columns.Count].Merge = true;

                break;

            case DataRowInReportTypeEnum.mergedHeaderInfo:

                ws.Cells[ex_row.Row, 1, ex_row.Row, in_row.Table.Columns.Count].Merge = true;

                break;

            case DataRowInReportTypeEnum.mergedFooterInfo:

                ws.Cells[ex_row.Row, 1, ex_row.Row, in_row.Table.Columns.Count].Merge = true;

                break;

            case DataRowInReportTypeEnum.mergedHorizontally:

                selectZone z   = new selectZone(0, 0, Columns.Count - 1, 0);
                var        s2l = ws.getExcelRange(ex_row, z);
                s2l.Merge = true;
                break;

            case DataRowInReportTypeEnum.mergedCategoryHeader:

                double tn   = 0.2;
                int    hlip = -1;
                foreach (var cpair in categories)
                {
                    if (hlip == -1)
                    {
                        tn = 0.3;
                    }
                    else
                    {
                        tn = 0.6;
                    }

                    foreach (selectZone zone in categories.categoryZones[cpair.Key])
                    {
                        var sl = ws.getExcelRange(ex_row, zone);
                        sl.Merge = true;
                        sl.Value = cpair.Key.ToUpper();
                        sl.Style.Fill.PatternType = ExcelFillStyle.Solid;

                        var col = categories.categoryColors[cpair.Key];     //.First().DefaultBackground(System.Drawing.Color.Gray);
                        sl.Style.Fill.BackgroundColor.SetColor(col);
                        sl.Style.Fill.BackgroundColor.Tint = new decimal(tn);
                    }

                    hlip = -hlip;
                }
                isEven = !isEven;

                break;

            case DataRowInReportTypeEnum.data:

                //ex_row.Style.Font.Size = 9;

                foreach (DataColumn dc in in_row.Table.Columns)
                {
                    string format   = dc.GetFormatForExcel();
                    var    aligment = dc.GetAligment();

                    ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = aligment.GetHorizontalAlignment();


                    if (!format.isNullOrEmpty())
                    {
                        ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.Numberformat.Format = format;
                    }

                    //if (dc.GetValueType().isNumber())
                    //{
                    //    ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
                    //}
                    //else if (dc.GetValueType().IsEnum)
                    //{
                    //    ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    //}
                    //else if (dc.GetValueType().isBoolean())
                    //{
                    //    ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                    //}
                    //else
                    //{
                    //    ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                    //}
                }

                break;
            }

            if (!isLegend)
            {
                if (ex_row.Row == (RowStart + RowsWithMaxAggregation))
                {
                    ex_row.Style.Border.Bottom.Style = ExcelBorderStyle.Dotted;
                    ex_row.Style.Border.Bottom.Color.SetColor(System.Drawing.Color.Red);
                }
            }
        }
        public void DeployDefault(DataRowInReportTypeEnum enumType)
        {
            key = enumType;
            Background.FillType = reporting.style.enums.styleFillType.Solid;
            Text.FontName       = reporting.style.enums.aceFont.Calibri;
            Cell.aligment       = reporting.zone.textCursorZoneCorner.Left;
            Text.FontSize       = 10;
            Cell.doWrapText     = true;

            BackgroundAlt.Color = Background.Color;
            switch (enumType)
            {
            case DataRowInReportTypeEnum.columnCaption:
                Background.Color    = System.Drawing.Color.DarkGray;
                Background.Tint     = 0.6;
                BackgroundAlt.Color = System.Drawing.Color.DarkGray;
                BackgroundAlt.Tint  = 0.7;
                Text.Style          = reporting.style.enums.styleTextTypeEnum.bold;
                Cell.aligment       = reporting.zone.textCursorZoneCorner.center;
                Cell.minSize.height = 30;
                break;

            case DataRowInReportTypeEnum.dataHighlightA:
                Text.Style = reporting.style.enums.styleTextTypeEnum.bold;
                Cell.sizeAndBorder.setup(3, 0, Color.OrangeRed, 1, reporting.style.enums.styleBorderType.Dotted, styleSideDirection.top, styleSideDirection.bottom);
                Background.Color    = Color.OrangeRed;
                Background.Tint     = 0.5;
                BackgroundAlt.Color = Color.Orange;
                BackgroundAlt.Tint  = 0.5;
                break;

            case DataRowInReportTypeEnum.dataHighlightB:
                Text.Style = reporting.style.enums.styleTextTypeEnum.bold;
                Cell.sizeAndBorder.setup(3, 0, Color.CadetBlue, 1, reporting.style.enums.styleBorderType.Dotted, styleSideDirection.top, styleSideDirection.bottom);
                Background.Color    = Color.CadetBlue;
                Background.Tint     = 0.5;
                BackgroundAlt.Color = Color.DarkSeaGreen;
                BackgroundAlt.Tint  = 0.5;
                break;

            case DataRowInReportTypeEnum.dataHighlightC:
                Text.Style = reporting.style.enums.styleTextTypeEnum.bold;
                Cell.sizeAndBorder.setup(3, 0, Color.SteelBlue, 1, reporting.style.enums.styleBorderType.Dotted, styleSideDirection.top, styleSideDirection.bottom);
                Background.Color    = Color.SteelBlue;
                Background.Tint     = 0.5;
                BackgroundAlt.Color = Color.SteelBlue;
                BackgroundAlt.Tint  = 0.3;
                break;

            case DataRowInReportTypeEnum.removedLight:
                Text.Style = reporting.style.enums.styleTextTypeEnum.regular | styleTextTypeEnum.striketrough;
                //Cell.sizeAndBorder.setup(0, 0, Color.Gray, 0, reporting.style.enums.styleBorderType.None);
                Text.Color          = Color.LightGray;
                Background.Color    = Color.WhiteSmoke;
                BackgroundAlt.Color = Color.Snow;
                Background.Tint     = 0.8;
                BackgroundAlt.Tint  = 0.8;
                break;

            case DataRowInReportTypeEnum.removedStrong:
                Text.Style = reporting.style.enums.styleTextTypeEnum.regular | styleTextTypeEnum.striketrough;
                //Cell.sizeAndBorder.setup(0, 0, Color.Gray, 0, reporting.style.enums.styleBorderType.None);
                Text.Color          = Color.OrangeRed;
                Background.Color    = Color.WhiteSmoke;
                BackgroundAlt.Color = Color.Snow;
                Background.Tint     = 0.8;
                BackgroundAlt.Tint  = 0.8;
                break;

            case DataRowInReportTypeEnum.columnDescription:
                Background.Color    = Color.LightSteelBlue;
                BackgroundAlt.Color = Color.LightSteelBlue;
                Cell.aligment       = reporting.zone.textCursorZoneCorner.center;
                Background.Tint     = 0.4;
                BackgroundAlt.Tint  = 0.5;
                Text.FontSize       = 9;
                Cell.minSize.height = 18;
                break;

            case DataRowInReportTypeEnum.columnFooterInfo:
                Cell.minSize.height = 28;
                break;

            case DataRowInReportTypeEnum.columnInformation:
                Background.Color    = Color.LightSlateGray;
                BackgroundAlt.Color = Color.SlateGray;
                Background.Tint     = 0.9;
                BackgroundAlt.Tint  = 0.8;
                Text.FontSize       = 9;
                Cell.minSize.height = 28;
                Cell.aligment       = reporting.zone.textCursorZoneCorner.center;
                break;

            case DataRowInReportTypeEnum.data:
                Background.Color    = Color.WhiteSmoke;
                BackgroundAlt.Color = Color.Snow;
                Background.Tint     = 0.2;
                BackgroundAlt.Tint  = 0.2;
                Text.FontSize       = 9;
                Cell.minSize.height = 15;
                break;

            case DataRowInReportTypeEnum.dataAggregate:
                break;

            case DataRowInReportTypeEnum.info:
                break;

            case DataRowInReportTypeEnum.mergedCategoryHeader:
                Background.Color    = Color.Gray;
                Background.Tint     = 0.7;
                BackgroundAlt.Color = Color.Gray;
                BackgroundAlt.Tint  = 0.9;
                Cell.minSize.height = 25;
                Cell.aligment       = reporting.zone.textCursorZoneCorner.center;
                break;

            case DataRowInReportTypeEnum.mergedFooterInfo:

                Background.Color    = Color.LightSlateGray;
                BackgroundAlt.Color = Color.SlateGray;
                Background.Tint     = 0.8;
                BackgroundAlt.Tint  = 0.7;
                Text.FontSize       = 9;
                Cell.minSize.height = 25;
                break;

            case DataRowInReportTypeEnum.mergedHeaderInfo:
                Background.Color    = Color.LightSlateGray;
                BackgroundAlt.Color = Color.SlateGray;
                Background.Tint     = 0.2;

                BackgroundAlt.Tint  = 0.2;
                Text.FontSize       = 9;
                Cell.minSize.height = 24;
                break;

            case DataRowInReportTypeEnum.mergedHeaderTitle:
                Background.Color    = Color.LightBlue;
                Background.Tint     = 0.2;
                BackgroundAlt.Color = Color.LightBlue;
                BackgroundAlt.Tint  = 0.3;
                Text.Style          = reporting.style.enums.styleTextTypeEnum.bold;
                Text.FontSize       = 9;
                Cell.minSize.height = 30;
                break;

            case DataRowInReportTypeEnum.mergedHorizontally:
                Cell.minSize.height = 12;
                Text.FontSize       = 8;
                Background.Color    = Color.LightGray;
                BackgroundAlt.Color = Color.LightGray;
                Background.Tint     = 0.9;
                BackgroundAlt.Tint  = 0.8;
                Cell.aligment       = reporting.zone.textCursorZoneCorner.Left;
                break;

            case DataRowInReportTypeEnum.none:
                break;

            default:
                Text.Style = reporting.style.enums.styleTextTypeEnum.regular;
                //Cell.sizeAndBorder.setup(0, 0, Color.Gray, 0, reporting.style.enums.styleBorderType.None);
                // Text.Color = Color.OrangeRed;
                Background.Color    = Color.WhiteSmoke;
                BackgroundAlt.Color = Color.Snow;
                Background.Tint     = 0.4;
                BackgroundAlt.Tint  = 0.2;
                break;
            }

            switch (enumType)
            {
            case DataRowInReportTypeEnum.group01:
                Background.Color    = Color.LightBlue;
                BackgroundAlt.Color = Color.LightBlue;
                break;

            case DataRowInReportTypeEnum.group02:
                Background.Color    = Color.Bisque;
                BackgroundAlt.Color = Color.Bisque;
                break;

            case DataRowInReportTypeEnum.group03:
                Background.Color    = Color.LightCyan;
                BackgroundAlt.Color = Color.LightCyan;
                break;

            case DataRowInReportTypeEnum.group04:
                Background.Color    = Color.LightGoldenrodYellow;
                BackgroundAlt.Color = Color.LightGoldenrodYellow;
                break;

            case DataRowInReportTypeEnum.group05:
                Background.Color    = Color.LightPink;
                BackgroundAlt.Color = Color.LightPink;
                break;
            }
        }