コード例 #1
0
        public ChartsSheetService(BudgetDto budget, ILogger log)
        {
            _budget = budget ?? throw new ArgumentNullException(nameof(budget));
            _log    = log;

            int rowsNumber = 5 + _budget.Categories.Count + 54;
            int colsNumber = 7;

            _googleSheetService = new GoogleSheetService("Charts", 2, rowsNumber, colsNumber, 0, 0, true, GetSheetsColor());
            _googleSheetService.SetRowHeight(0, 50);
            _googleSheetService.AddProtectedRanges(0, 2, 1, 3 + _budget.Categories.Count);
        }
コード例 #2
0
        public DashboardSheetService(BudgetDto budget)
        {
            _budget = budget ?? throw new ArgumentNullException(nameof(budget));

            int rowsNumber = 3 + (_budget.Categories.Count * 2) + _budget.Subcategories.Count;
            int colsNumber = 4;

            _googleSheetService = new GoogleSheetService("Dashboard", 0, rowsNumber, colsNumber, 0, 2, true, GetSheetsColor());
            _subcategoryRows    = new List <Model.DTOs.GoogleSpreadsheet.DashboardSubcategoryRowDto>();
            _googleSheetService.SetRowHeight(0, 50);
            _googleSheetService.AddProtectedRanges(0, 4, 1, rowsNumber);
        }
コード例 #3
0
        public SpendingSheetService(BudgetDto budget)
        {
            _budget = budget;
            int rowsNumber = 16 + (_budget.Incomes.Count + 4) + (_budget.Categories.Count * 4) + _budget.Subcategories.Count;
            int colsNumber = 6 + DateTime.DaysInMonth(_budget.Month.Year, _budget.Month.Month);

            _googleSheetService       = new GoogleSheetService("Spending", 1, rowsNumber, colsNumber, 5, 0, false, GetSheetsColor());
            _subcategoriesRowsIndexes = new List <int>();
            _subcategoriesRows        = new List <CellData>();
            _googleSheetService.SetRowHeight(0, 50);
            _googleSheetService.SetColumnWidth(0, 180);
            _googleSheetService.SetColumnWidth(1, 110);
            _googleSheetService.SetColumnWidth(2, 110);
            _googleSheetService.SetColumnWidth(3, 110);
            _googleSheetService.SetColumnWidth(4, 100);
        }
コード例 #4
0
        private void AddCategoryHeader(CategoryDto category)
        {
            var cells = new List <CellData>();

            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = $"=Spending!{GoogleSheetService.GetCellAddress(0, category.RowIndex)}"
                },
                UserEnteredFormat = CategoryHeaderFormat()
            });
            _googleSheetService.SetRowHeight(_googleSheetService.CurrentRow, 30);
            _googleSheetService.MergeRange(new GridRange()
            {
                StartRowIndex    = _googleSheetService.CurrentRow,
                EndRowIndex      = _googleSheetService.CurrentRow + 1,
                StartColumnIndex = 0,
                EndColumnIndex   = 4
            });
            _googleSheetService.AddRow(cells);
        }