Aspose.Cells.Examples.CSharp.Articles.RemoveUnusedStyles.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 template excel file containing unused styles
            Workbook workbook = new Workbook(dataDir + "Template-With-Unused-Custom-Style.xlsx");

            // Remove all unused styles inside the template this will also remove AsposeStyle which is an unused style inside the template
            workbook.RemoveUnusedStyles();

            // Save the file
            workbook.Save(dataDir + "output_out.xlsx");
            // ExEnd:1
        }
    }
RemoveUnusedStyles