Beispiel #1
0
        public int write_data_column(IEnumerable <PD.IElemento> detail, TituloCabera[] titulos, int TitleIndexRow, BorderPaintingFormat tituloFormato, BorderPaintingFormat contentFormato, BorderPaintingFormat TotalsFormato)
        {
            bool ckT            = false;
            int  processed_rows = detail.Count();
            int  max_columnas   = titulos.Count();
            int  DetailIndexRow = TitleIndexRow + 1;

            for (int curr_col = 0; curr_col < max_columnas; curr_col++)
            {
                var tituloValue = titulos[curr_col];
                write_tittle_area(tituloValue, TitleIndexRow, (curr_col + 1), tituloFormato);
                write_content_area(detail, tituloValue, DetailIndexRow, detail.Count(), (curr_col + 1), contentFormato);
                ckT = write_totals_area(detail, tituloValue, DetailIndexRow + processed_rows, (curr_col + 1), TotalsFormato);
            }
            if (ckT)
            {
                processed_rows += 1;
            }
            return(processed_rows);
        }
Beispiel #2
0
 private bool write_totals_area(IEnumerable <PD.IElemento> detail, TituloCabera info, int RowPosition, int ColumnPosition, BorderPaintingFormat formatos)
 {
     try
     {
         Exc.Range celLrangE;
         celLrangE = _oSheet.Cells[RowPosition, ColumnPosition];
         //Border Values
         formatos.ApplyFormats(celLrangE);
         if (info.Index != 0)
         {
             ColumnData data = RawDataColumn(detail, info);
             celLrangE.NumberFormat = data.Formating;
             if (data.ColType == typeof(decimal))
             {
                 decimal suma = 0;
                 for (int i = 0; i < data.Valores.Length; i++)
                 {
                     suma += (decimal)(data.Valores[i, 0]);
                 }
                 celLrangE.Value = suma;
             }
         }
         return(true);
     }
     catch
     { return(false); }
 }
Beispiel #3
0
        private bool write_tittle_area(TituloCabera info, int RowPosition, int ColumnPosition, BorderPaintingFormat formatos)
        {
            try
            {
                Exc.Range celLrangE;
                celLrangE = _oSheet.Cells[RowPosition, ColumnPosition];
                //Format
                celLrangE.HorizontalAlignment = Exc.XlHAlign.xlHAlignCenter; //-4108 equivale a centrar
                celLrangE.VerticalAlignment   = Exc.XlVAlign.xlVAlignCenter;
                celLrangE.WrapText            = true;                        //equivale a alinear contenido a la celda
                celLrangE.Orientation         = 0;
                celLrangE.AddIndent           = false;
                celLrangE.IndentLevel         = 0;
                celLrangE.ShrinkToFit         = false;
                celLrangE.RowHeight           = 30;           //alto de fila se estable en 30
                celLrangE.Font.Bold           = true;
                //Border Format
                formatos.ApplyFormats(celLrangE);

                //Value
                celLrangE.Value = info.ColTitulo;
                celLrangE       = null;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #4
0
 private bool write_content_area(IEnumerable <PD.IElemento> detail, TituloCabera info, int RowInitPosition, int TotalElements, int ColumnPosition, BorderPaintingFormat formatos)
 {
     try
     {
         Exc.Range celLrangE;
         celLrangE = _oSheet.Range[
             _oSheet.Cells[RowInitPosition, ColumnPosition],
             _oSheet.Cells[(RowInitPosition + TotalElements - 1), ColumnPosition]];
         //Border Values
         formatos.ApplyFormats(celLrangE);
         if (info.Index != 0)
         {
             ColumnData data = RawDataColumn(detail, info);
             celLrangE.NumberFormat = data.Formating;
             celLrangE.Value        = data.Valores;
         }
         return(true);
     }
     catch
     { return(false); }
 }
Beispiel #5
0
        public int write_data_column_colored(IEnumerable <PD.IElemento> detail, TituloCabera[] titulos, int TitleIndexRow, BorderPaintingFormat tituloFormato, BorderPaintingFormat contentFormato, BorderPaintingFormat TotalsFormato)
        {
            bool ckT            = false;
            int  processed_rows = detail.Count();
            int  max_columnas   = titulos.Count();
            int  DetailIndexRow = TitleIndexRow + 1;

            for (int curr_col = 0; curr_col < max_columnas; curr_col++)
            {
                var tituloValue = titulos[curr_col];
                write_tittle_area(tituloValue, TitleIndexRow, (curr_col + 1), tituloFormato);
                if (detail.GetType() == typeof(List <PD.GROUP_MOVEMENT>))
                {
                    var grouped        = (List <PD.GROUP_MOVEMENT>)detail;
                    int SingleIndexRow = DetailIndexRow + 1;
                    foreach (var gp in grouped)
                    {
                        var single_list = new List <PD.GROUP_MOVEMENT> {
                            gp
                        };
                        var singleFormato = contentFormato.Copy();
                        int extra_space   = 0;
                        if (gp.orden1 == "99999")
                        {
                            singleFormato.InteriorColor = 16764057;
                            SingleIndexRow++;
                            extra_space = 1;
                        }
                        else
                        if (gp.orden2 == "99999")
                        {
                            singleFormato.InteriorColor = 5296274;
                            SingleIndexRow++;
                            extra_space = 1;
                        }
                        write_content_area(single_list, tituloValue, SingleIndexRow, single_list.Count(), (curr_col + 1), singleFormato);
                        SingleIndexRow += extra_space + 1;
                    }
                }
            }
            if (ckT)
            {
                processed_rows += 1;
            }
            return(processed_rows);
        }