Aspose.Cells.Examples.CSharp.PivotTableExamples.FormattingLook.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Load a template file
            Workbook workbook = new Workbook(dataDir + "Book1.xls");

            // Get the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];
            var pivot = workbook.Worksheets[0].PivotTables[0];

            pivot.PivotTableStyleType = PivotTableStyleType.PivotTableStyleDark1;

            Style style = workbook.CreateStyle();
            style.Font.Name = "Arial Black";
            style.ForegroundColor = Color.Yellow;
            style.Pattern = BackgroundType.Solid;

            pivot.FormatAll(style);

            // Saving the Excel file
            workbook.Save(dataDir + "output.xls");

            // ExEnd:1

        }
    }
FormattingLook