예제 #1
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
            });
        }