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

            // Load your source workbook
            Workbook wb = new Workbook(dataDir + "sample.xlsx");

            // Set the glorbalization setting to change subtotal and grand total names
            GlobalizationSettings gsi = new GlobalizationSettingsImp();

            wb.Settings.GlobalizationSettings = gsi;

            // Access first worksheet
            Worksheet ws = wb.Worksheets[0];

            // Apply subtotal on A1:B10
            CellArea ca = CellArea.CreateCellArea("A1", "B10");

            ws.Cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2, 3, 4 });

            // Set the width of the first column
            ws.Cells.SetColumnWidth(0, 40);

            // Save the output excel file
            wb.Save(dataDir + "output_out.xlsx");
            // ExEnd:UsingGlobalizationSettings
        }
Exemplo n.º 2
0
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Load your source workbook
            Workbook wb = new Workbook(sourceDir + "sampleTotalsInOtherLanguages.xlsx");

            // Set the glorbalization setting to change subtotal and grand total names
            GlobalizationSettings gsi = new GlobalizationSettingsImp();

            wb.Settings.GlobalizationSettings = gsi;

            // Access first worksheet
            Worksheet ws = wb.Worksheets[0];

            // Apply subtotal on A1:B10
            CellArea ca = CellArea.CreateCellArea("A1", "B10");

            ws.Cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2, 3, 4 });

            // Set the width of the first column
            ws.Cells.SetColumnWidth(0, 40);

            // Save the output excel file
            wb.Save(outputDir + "outputTotalsInOtherLanguages.xlsx");

            Console.WriteLine("TotalsInOtherLanguages executed successfully.");
        }
        public static void Run()
        {
            // ExStart:UsingGlobalizationSettings
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Load your source workbook
            Workbook wb = new Workbook(dataDir + "sample.xlsx");

            // Set the glorbalization setting to change subtotal and grand total names
            GlobalizationSettings gsi = new GlobalizationSettingsImp();
            wb.Settings.GlobalizationSettings = gsi;

            // Access first worksheet
            Worksheet ws = wb.Worksheets[0];

            // Apply subtotal on A1:B10
            CellArea ca = CellArea.CreateCellArea("A1", "B10");
            ws.Cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2, 3, 4 });

            // Set the width of the first column
            ws.Cells.SetColumnWidth(0, 40);

            // Save the output excel file
            wb.Save(dataDir + "output_out.xlsx");
            // ExEnd:UsingGlobalizationSettings
        }