private void AddChartsHeader()
        {
            var cells = new List <CellData>();

            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Charts"
                },
                UserEnteredFormat = new CellFormat()
                {
                    BackgroundColor = GetSheetsColor(),
                    TextFormat      = new TextFormat()
                    {
                        FontSize = 18,
                        Bold     = true,
                    },
                    VerticalAlignment   = "MIDDLE",
                    HorizontalAlignment = "CENTER"
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Category"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders    = GoogleSheetService.GetAllBorders(),
                    TextFormat = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Spent"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders             = GoogleSheetService.GetAllBorders(),
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT",
                }
            });
            _googleSheetService.AddRow(cells);

            _googleSheetService.MergeRange(new GridRange()
            {
                StartRowIndex    = 0,
                EndRowIndex      = 1,
                StartColumnIndex = 0,
                EndColumnIndex   = 7
            });
        }
        private void AddSpendingHeader()
        {
            var cells = new List <CellData>();

            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Spending"
                },
                UserEnteredFormat = new CellFormat()
                {
                    BackgroundColor = GetSheetsColor(),
                    TextFormat      = new TextFormat()
                    {
                        FontSize   = 18,
                        Bold       = true,
                        FontFamily = "Verdana",
                    },
                    VerticalAlignment   = "MIDDLE",
                    HorizontalAlignment = "CENTER"
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Budget Plan"
                },
                UserEnteredFormat = SubHeaderFormat(),
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Planned income"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=B13"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting()
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Planned spending"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=B14"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "To allocate"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=B3-B4"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            _googleSheetService.AddRow(cells);

            _googleSheetService.AddEmptyRow();

            //Budget Realisation
            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Budget Realization"
                },
                UserEnteredFormat = SubHeaderFormat(),
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Actual income"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=C13"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Actual spending"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=C14"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Still available"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=B8-B9"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            _googleSheetService.AddRow(cells);
            _googleSheetService.AddEmptyRow();

            //Header table
            cells = new List <CellData>();
            cells.Add(new CellData());
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Planned"
                },
                UserEnteredFormat = new CellFormat()
                {
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT",
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Actual"
                },
                UserEnteredFormat = new CellFormat()
                {
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT",
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Difference"
                },
                UserEnteredFormat = new CellFormat()
                {
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT",
                }
            });
            _googleSheetService.AddRow(cells);

            //Income sum:
            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Income sum:"
                },
                UserEnteredFormat = new CellFormat()
                {
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = $"={GoogleSheetService.GetCellAddress(1, _googleSheetService.CurrentRow + 5)}"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = $"={GoogleSheetService.GetCellAddress(2, _googleSheetService.CurrentRow + 5)}"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = $"={GoogleSheetService.GetCellAddress(3, _googleSheetService.CurrentRow + 5)}"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    }
                }
            });
            _googleSheetService.AddRow(cells);

            //Spending sum:
            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Spending sum:"
                },
                UserEnteredFormat = new CellFormat()
                {
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    HorizontalAlignment = "RIGHT"
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    NumberValue = 0
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    NumberValue = 0
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    },
                    TextFormat = GoogleSheetService.GetDefaultCellFormatting(),
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    FormulaValue = "=C14-B14"
                },
                UserEnteredFormat = new CellFormat()
                {
                    NumberFormat = new NumberFormat()
                    {
                        Type = "CURRENCY"
                    }
                }
            });
            cells.ForEach(x => _subcategoriesRows.Add(x));
            _googleSheetService.AddRow(cells);
            _googleSheetService.AddEmptyRow();
            _googleSheetService.MergeRange(new GridRange()
            {
                StartRowIndex    = 0,
                EndRowIndex      = 1,
                StartColumnIndex = 0,
                EndColumnIndex   = 5
            });
        }
Esempio n. 3
0
        private void AddDashboardHeader()
        {
            var cells = new List <CellData>();

            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Dashboard"
                },
                UserEnteredFormat = new CellFormat()
                {
                    BackgroundColor = GetSheetsColor(),
                    TextFormat      = new TextFormat()
                    {
                        FontSize = 18,
                        Bold     = true,
                    },
                    VerticalAlignment   = "MIDDLE",
                    HorizontalAlignment = "CENTER"
                }
            });
            _googleSheetService.AddRow(cells);

            cells = new List <CellData>();
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Subcategory"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders           = GoogleSheetService.GetBottomMediumBorder(),
                    TextFormat        = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    VerticalAlignment = "BOTTOM",
                    WrapStrategy      = "WRAP",
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Planned spending"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders             = GoogleSheetService.GetBottomMediumBorder(),
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    VerticalAlignment   = "BOTTOM",
                    HorizontalAlignment = "RIGHT",
                    WrapStrategy        = "WRAP",
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Actual spending"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders             = GoogleSheetService.GetBottomMediumBorder(),
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    VerticalAlignment   = "BOTTOM",
                    HorizontalAlignment = "RIGHT",
                    WrapStrategy        = "WRAP",
                }
            });
            cells.Add(new CellData()
            {
                UserEnteredValue = new ExtendedValue()
                {
                    StringValue = "Difference"
                },
                UserEnteredFormat = new CellFormat()
                {
                    Borders             = GoogleSheetService.GetBottomMediumBorder(),
                    TextFormat          = GoogleSheetService.GetDefaultTableHeaderFormatting(),
                    VerticalAlignment   = "BOTTOM",
                    HorizontalAlignment = "RIGHT",
                    WrapStrategy        = "WRAP",
                }
            });
            _googleSheetService.AddRow(cells);

            _googleSheetService.MergeRange(new GridRange()
            {
                StartRowIndex    = 0,
                EndRowIndex      = 1,
                StartColumnIndex = 0,
                EndColumnIndex   = 4
            });
        }