Aspose.Cells.Examples.CSharp.Articles.FormatWorksheetCells.CreateSalesReport C# (CSharp) Method

CreateSalesReport() private static method

private static CreateSalesReport ( string filename ) : void
filename string
return void
        private static void CreateSalesReport(string filename)
        {
            /*
             * Uncomment the code below when you have purchased license
             * for Aspose.Cells. You need to deploy the license in the
             * same folder as your executable, alternatively you can add
             * the license file as an embedded resource to your project.
            */
            Aspose.Cells.License cellsLicense = new
            Aspose.Cells.License();
            cellsLicense.SetLicense("Aspose.Cells.lic");

            // Create a new Workbook.
            Workbook workbook = new Workbook();

            /*
             * Note: Since Excel color palette has 56 colors on it.
             * The colors are indexed 0-55.
             * Please check: http:// Www.aspose.com/Products/Aspose.Cells/Api/Aspose.Cells.Workbook.ChangePalette.html
             * If a color is not present on the palette, we have to add it
             * To the palette, so that we may use.
             * Add a few custom colors to the palette.
            */
            workbook.ChangePalette(Color.FromArgb(155, 204, 255), 55);
            workbook.ChangePalette(Color.FromArgb(0, 51, 105), 54);
            workbook.ChangePalette(Color.FromArgb(250, 250, 200), 53);
            workbook.ChangePalette(Color.FromArgb(124, 199, 72), 52);

            CreateReportData(workbook);
            CreateCellsFormatting(workbook);

            // Get the first worksheet in the book.
            Worksheet worksheet = workbook.Worksheets[0];
            // Name the worksheet.
            worksheet.Name = "Sales Report";
            // Save the excel file.
            workbook.Save(filename);
        }