using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OfficeOpenXml;
using OfficeOpenXml.Style;

namespace CreateExcelEpplus
{
    class CommonExcel
    {
        #region Propiedades

        public static string strUltimaActualizacion = string.Empty;

        #region Colors

        public static Color colorBordersReport = System.Drawing.Color.FromArgb(0, 205, 204, 204);

        public static Color colorNegro = System.Drawing.Color.FromArgb(0, 0, 0, 0);

        public static Color colorBlanco = System.Drawing.Color.FromArgb(0, 255, 255, 255);//

        public static Color colorAzulRey = System.Drawing.Color.FromArgb(0, 10, 32, 96);//

        #endregion//Colors


        #region Alineacion

        public static ExcelHorizontalAlignment horizontalAligmentCenter = ExcelHorizontalAlignment.Center;

        public static ExcelHorizontalAlignment horizontalAligmentLeft = ExcelHorizontalAlignment.Left;

        public static ExcelHorizontalAlignment horizontalAligmentRight = ExcelHorizontalAlignment.Right;

        #endregion//Alineacion


        #endregion //Propiedades


        #region Atributos
        #endregion //Atributos


        #region Instancias
        #endregion //Instancias


        #region Constructores
        #endregion //Constructores


        #region Metodos Publicos

        #region Paramtros Excel


        #region CellString
        public static void cellString(ExcelWorksheet ws, int nFromRow, int nFromCol, int nToRow, int nToCol, string strValue
                              , bool bBold, Color cBkgSetColor, Color cFontSetColor, Color cBorderSetColor, int nFontSize)
        {
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Merge = true;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Value = strValue;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Font.Bold = bBold;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.WrapText = true;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Font.Color.SetColor(cFontSetColor);
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Font.Size = nFontSize;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Fill.BackgroundColor.SetColor(cBkgSetColor);
            ws.Cells[nFromRow, nFromCol, nToRow, nToCol].Style.Border.BorderAround(ExcelBorderStyle.Thin, cBorderSetColor);
        }

        #endregion//CellString


        #region CellNumber
        public static void cellNumber(ExcelWorksheet ws, int nRow, int nCol, int nValue, bool bBold
                              , bool bBkgSetColor, Color cBkgSetColor, Color cFontSetColor, Color cBorderSetColor, int nFontSize
                              , ExcelHorizontalAlignment xlsHorizAligment)
        {
            ws.Cells[nRow, nCol].Value = nValue;
            ws.Cells[nRow, nCol].Style.Font.Bold = bBold;
            ws.Cells[nRow, nCol].Style.Font.Color.SetColor(cFontSetColor);
            ws.Cells[nRow, nCol].Style.Font.Size = nFontSize;
            ws.Cells[nRow, nCol].Style.HorizontalAlignment = xlsHorizAligment;
            ws.Cells[nRow, nCol].Style.Border.BorderAround(ExcelBorderStyle.Thin, cBorderSetColor);
            ws.Cells[nRow, nCol].Style.Fill.PatternType = ExcelFillStyle.Solid;
            if (bBkgSetColor == true)
            {
                ws.Cells[nRow, nCol].Style.Fill.BackgroundColor.SetColor(cBkgSetColor);
            }
        }
        #endregion//CellNumber



        #region workSheetStyles
        public static void WorkSheetStyles(ExcelWorksheet ws)
        {
            int i = 0
              , j = 0;

            ws.Cells.Style.Font.Size = 10;
            ws.Cells.Style.Font.Name = "Century Gothic";
            ws.View.ShowGridLines = false;
        }
        #endregion//workSheetStyles


        #endregion//Parametros Excel


        #endregion //Metodos Publicos


        #region Metodos Privados
        #endregion //Metodos Privados
    }

}
