PivotGlobalizationSettings.GetTextOfAllPeriods
PivotGlobalizationSettings.GetTextOfAllPeriods method
Gets the localized text of “All Periods”.
public virtual string GetTextOfAllPeriods()
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Pivot;
using Aspose.Cells.Settings;
using System;
public class PivotGlobalizationSettingsMethodGetTextOfAllPeriodsDemo
{
public static void Run()
{
try
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add sample data to create context for pivot table
worksheet.Cells["A1"].PutValue("Date");
worksheet.Cells["B1"].PutValue("Sales");
worksheet.Cells["A2"].PutValue(new DateTime(2023, 1, 1));
worksheet.Cells["B2"].PutValue(1000);
worksheet.Cells["A3"].PutValue(new DateTime(2023, 2, 1));
worksheet.Cells["B3"].PutValue(2000);
worksheet.Cells["A4"].PutValue(new DateTime(2023, 3, 1));
worksheet.Cells["B4"].PutValue(3000);
// Create pivot table
int pivotIndex = worksheet.PivotTables.Add("A1:B4", "D1", "PivotTable1");
PivotTable pivotTable = worksheet.PivotTables[pivotIndex];
pivotTable.AddFieldToArea(PivotFieldType.Row, 0);
pivotTable.AddFieldToArea(PivotFieldType.Data, 1);
// Create PivotGlobalizationSettings instance
PivotGlobalizationSettings settings = new PivotGlobalizationSettings();
// Demonstrate GetTextOfAllPeriods method
string allPeriodsText = settings.GetTextOfAllPeriods();
Console.WriteLine("All Periods Text: " + allPeriodsText);
// Show related time period labels for context
Console.WriteLine("Years Text: " + settings.GetTextOfYears());
Console.WriteLine("Quarters Text: " + settings.GetTextOfQuarters());
Console.WriteLine("Months Text: " + settings.GetTextOfMonths());
// Save the workbook
workbook.Save("GetTextOfAllPeriodsDemo.xlsx");
Console.WriteLine("Workbook saved successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class PivotGlobalizationSettings
- namespace Aspose.Cells.Settings
- assembly Aspose.Cells