public void AddEntry(List <object> values)
        {
            ExcelSheet.MoveTo(
                UpperLeftRow + (_orientation == TableOrientation.RowHeaders ? 0 : NumEntries + 1),
                UpperLeftColumn + (_orientation == TableOrientation.ColumnHeaders ? 0 : NumEntries + 1)
                );

            for (var idx = 0; idx < (values.Count > NumHeaders ? values.Count : NumHeaders); idx++)
            {
                if (idx < values.Count)
                {
                    ExcelSheet.ActiveCell.SetValue(values[idx]);
                }

                ExcelSheet.Move(
                    _orientation == TableOrientation.RowHeaders ? 1 : 0,
                    _orientation == TableOrientation.ColumnHeaders ? 1 : 0
                    );
            }

            NumEntries++;

            ExcelSheet.Move(
                _orientation == TableOrientation.RowHeaders ? -values.Count : 0,
                _orientation == TableOrientation.ColumnHeaders ? -values.Count : 0
                );
        }
Esempio n. 2
0
        private static void OutputSimulationReturnsToExcel(ExcelSheet sheet, Simulator simulator)
        {
            var table = new ExcelTable(sheet, _services.GetService <IJ4JLoggerFactory>());

            table.AddHeaders("Simulation", "Investment #", "Total Return Factor");

            for (var sim = 0; sim < _context.Simulations; sim++)
            {
                for (var inv = 0; inv < _context.Investments; inv++)
                {
                    table.AddEntry(sim, inv, simulator.RawGeometricReturns[sim, inv]);
                }
            }

            sheet.Move(2, 0);

            var table2 = new ExcelTable(sheet, _services.GetService <IJ4JLoggerFactory>());

            table2.AddHeaders("Simulation", "Geometric Mean Return");

            for (var sim = 0; sim < _context.Simulations; sim++)
            {
                table2.AddEntry(sim, simulator.SimulationGeometricReturns[sim]);
            }
        }