Esempio n. 1
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); }
 }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        private static ColumnData RawDataColumn(List <PD.IElemento> detail, TituloCabera titulo)
        {
            object[,] result = new object[detail.Count, 1];
            Type tipo = null;

            for (var j = 0; j < detail.Count; j++)
            {
                var    row_proc    = detail[j];
                var    titulo_proc = titulo;
                object selected    = row_proc.Item(titulo_proc.Index);
                tipo = selected.GetType();
                switch (tipo.Name)
                {
                case "GENERIC_VALUE":
                case "GENERIC_RELATED":
                    var    val_d   = (PD.GENERIC_VALUE)selected;
                    string formato = titulo_proc.FormatTipo;
                    if (formato == "CODE")
                    {
                        result[j, 0] = val_d.code;
                    }
                    else if (formato == "DESCRIP")
                    {
                        result[j, 0] = val_d.description;
                    }
                    else if (formato == "ID")
                    {
                        result[j, 0] = val_d.id.ToString();
                    }
                    else
                    {
                        result[j, 0] = val_d.code;
                    }
                    break;

                default:
                    result[j, 0] = selected;
                    break;
                }
            }

            return(new ColumnData {
                Valores = result, ColType = tipo
            });
        }
Esempio n. 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); }
 }
Esempio n. 5
0
 private static ColumnData RawDataColumn(IEnumerable <PD.IElemento> detail, TituloCabera titulo)
 {
     return(RawDataColumn(detail.ToList(), titulo));
 }