SettablePivotGlobalizationSettings.GetTextOfGrandTotal

SettablePivotGlobalizationSettings.GetTextOfGrandTotal method

Gets the text of “Grand Total” label in the PivotTable.

public override string GetTextOfGrandTotal()

Return Value

The text of “Grand Total” label

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class SettablePivotGlobalizationSettingsMethodGetTextOfGrandTotalDemo
    {
        public static void Run()
        {
            // Create a new workbook (just for context)
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.Cells["A1"].PutValue("Sample");

            // Instance of SettablePivotGlobalizationSettings
            SettablePivotGlobalizationSettings settings = new SettablePivotGlobalizationSettings();

            try
            {
                // Change the default "Grand Total" text
                settings.SetTextOfGrandTotal("My Custom Grand Total");

                // Retrieve the current "Grand Total" text
                string grandTotalText = settings.GetTextOfGrandTotal();

                Console.WriteLine($"Grand Total label text: {grandTotalText}");

                // Save the workbook (no pivot table is created, but file is saved to prove execution)
                workbook.Save("GetTextOfGrandTotalDemo.xlsx");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error calling GetTextOfGrandTotal: {ex.Message}");
            }
        }
    }
}

See Also