From 2bc68218338e23a6c5fb429ce20863eee04a76e0 Mon Sep 17 00:00:00 2001 From: DeebigaSF4971 Date: Mon, 9 Jun 2025 17:26:13 +0530 Subject: [PATCH 1/3] 962647- Update the Excel Export Sample and Value sorting Sample with Description. --- blazor/pivot-table/excel-export.md | 99 +++++++++++++++++++++++++----- blazor/pivot-table/sorting.md | 8 ++- 2 files changed, 88 insertions(+), 19 deletions(-) diff --git a/blazor/pivot-table/excel-export.md b/blazor/pivot-table/excel-export.md index 83298f4f54..94dc34ec92 100644 --- a/blazor/pivot-table/excel-export.md +++ b/blazor/pivot-table/excel-export.md @@ -9,7 +9,7 @@ documentation: ug # Excel export in Blazor Pivot Table component -The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. +The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__)(false) method for exporting on external button click. In this sample, the method is invoked with false to initiate a direct download of the Excel file. N> The pivot table component can be exported to Excel format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -43,12 +43,12 @@ N> The pivot table component can be exported to Excel format using options avail public List Data { get; set; } protected override void OnInitialized() { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } public void OnExcelExport(Microsoft.AspNetCore.Components.Web.MouseEventArgs args){ - this.pivot.ExportToExcelAsync(); + this.pivot.ExportToExcelAsync(false); } } ``` @@ -91,7 +91,7 @@ N> By default, material theme will be applied to the pivot table during Excel ex public List Data { get; set; } protected override void OnInitialized() { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } @@ -223,7 +223,7 @@ The Excel export provides an option to change file name of the document before e public List Data { get; set; } protected override void OnInitialized() { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } @@ -246,7 +246,7 @@ By default, Microsoft Excel supports only 1,048,576 records in an Excel sheet. H ## CSV Export -The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. +The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__)(false) method for exporting on external button click. In this sample, the method is invoked with false to initiate a direct download of the Excel file. N> The pivot table component can be exported to CSV format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -280,12 +280,12 @@ N> The pivot table component can be exported to CSV format using options availab public List Data { get; set; } protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } public void OnCsvExport() { - this.pivot.ExportToCsvAsync(); + this.pivot.ExportToCsvAsync(false); } } @@ -332,6 +332,73 @@ When the [EnableVirtualization](https://help.syncfusion.com/cr/blazor/Syncfusion }; } ``` + +## Saving Excel document to stream + +Rather than exporting the Pivot Table as a downloadable file, user can save the Excel document as a memory stream. This is achieved by setting the **asMemoryStream** option to **true** in the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method. The resulting memory stream can then be further processed and customized by the user before being exported as a document. + +N> This option is only available if virtualization is enabled in the pivot table. + +```cshtml +@using Syncfusion.Blazor.PivotView +@using Syncfusion.Blazor.Buttons +@using Syncfusion.Blazor +@inject IJSRuntime JSRuntime + + + + + + + + + + + + + + + + + + + + + + + + +@code { + private SfPivotView pivot; + private List Data { get; set; } + protected override void OnInitialized() + { + this.Data = ProductDetails.GetProductData().ToList(); + //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. + } + private async Task OnPdfExport(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + { + System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); + //Excel document as a memory stream by setting the first parameter as "true" in the "ExportToExcelAsync" method. + memoryStream = await this.pivot.ExportToExcelAsync(true); + // You can then process the memory stream based on your needs and save it as mentioned in the last statement. + ...... + ...... + ...... + await JSRuntime.InvokeVoidAsync("saveAsFile", new object[] { "default.xlsx", Convert.ToBase64String(memoryStream.ToArray()),true }); + } +} +``` + ## Events ### ExcelQueryCellInfo @@ -379,22 +446,22 @@ The event [ExcelQueryCellInfo](https://help.syncfusion.com/cr/blazor/Syncfusion. protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); // Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } public void OnExcelExport(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { - this.pivot.ExportToExcelAsync(); + this.pivot.ExportToExcelAsync(false); } // Triggers every time for row header and value cells during exporting. public void ExcelQueryEvent(ExcelQueryCellInfoEventArgs args) { - Matrix> pivotValues = Pivot?.PivotValues; + Matrix> pivotValues = pivot?.PivotValues; AxisSet cellInfo = null; - if (Pivot?.EnableVirtualization == true) + if (pivot?.EnableVirtualization == true) { if (pivotValues != null) { @@ -470,22 +537,22 @@ The event [ExcelHeaderQueryCellInfo](https://help.syncfusion.com/cr/blazor/Syncf protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { - this.data = ProductDetails.GetProductData().ToList(); + this.Data = ProductDetails.GetProductData().ToList(); // Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. } public void OnExcelExport(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { - this.pivot.ExportToExcelAsync(); + this.pivot.ExportToExcelAsync(false); } // Triggers every time for column header cells during exporting public void ExcelHeaderEvent(ExcelHeaderQueryCellInfoEventArgs args) { - Matrix> pivotValues = Pivot?.PivotValues; + Matrix> pivotValues = pivot?.PivotValues; AxisSet cellInfo = null; - if (Pivot?.EnableVirtualization == true) + if (pivot?.EnableVirtualization == true) { if (pivotValues != null) { diff --git a/blazor/pivot-table/sorting.md b/blazor/pivot-table/sorting.md index 682a5f96a7..aadbedbfb3 100644 --- a/blazor/pivot-table/sorting.md +++ b/blazor/pivot-table/sorting.md @@ -120,9 +120,11 @@ Allows to sort individual value field and its aggregated values either in row or The value sorting can also be configured using the [PivotViewValueSortSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html) option through the code behind. The settings required to sort value fields are: -* [HeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): It allows to set the header names with delimiters, that is used for value sorting. The header names are arranged from Level 1 to Level N, down the hierarchy with a delimiter for better specification. +* [ColumnHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): Specifies the column header hierarchy for value sorting. Header levels are defined from Level 1 to N using a delimiter for clarity. * [HeaderDelimiter](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderDelimiter): It allows to set the delimiters string to separate the header text between levels. -* [SortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): It allows to set the sort direction of the value field. +* [ColumnSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): Sets the delimiter string used to separate levels in the column header text. +* [RowHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): Defines the specific row header for which the value sorting should be applied. +* [RowSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): Determines the sorting direction for the specified row header. N> Value fields are set to the column axis by default. In such cases, the value sorting applied will have an effect on the column alone. You need to place the value fields in the row axis to do so in row wise. For more information, [refer here](https://blazor.syncfusion.com/documentation/pivot-table/data-binding#values-in-row-axis). @@ -146,7 +148,7 @@ N> Value fields are set to the column axis by default. In such cases, the value                                -         +              From 52aecc4d4f502e911a98975d83f3baf280bac5bd Mon Sep 17 00:00:00 2001 From: DeebigaSF4971 Date: Tue, 10 Jun 2025 19:14:08 +0530 Subject: [PATCH 2/3] 952647: Modify the Review changes --- blazor/pivot-table/excel-export.md | 12 ++++++------ blazor/pivot-table/sorting.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/blazor/pivot-table/excel-export.md b/blazor/pivot-table/excel-export.md index 94dc34ec92..ed5f5e1de6 100644 --- a/blazor/pivot-table/excel-export.md +++ b/blazor/pivot-table/excel-export.md @@ -9,7 +9,7 @@ documentation: ug # Excel export in Blazor Pivot Table component -The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__)(false) method for exporting on external button click. In this sample, the method is invoked with false to initiate a direct download of the Excel file. +The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. This method accepts a boolean parameter, asMemoryStream, which determines the export behavior. When set to false, the file is directly downloaded. When set to true, the data is returned as a memory stream, which can be used for custom processing, storage, or further manipulation. In this sample, false is passed to initiate a direct download of the Excel file. N> The pivot table component can be exported to Excel format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -246,7 +246,7 @@ By default, Microsoft Excel supports only 1,048,576 records in an Excel sheet. H ## CSV Export -The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__)(false) method for exporting on external button click. In this sample, the method is invoked with false to initiate a direct download of the Excel file. +The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. This method accepts a boolean parameter, asMemoryStream, which determines the export behavior. When set to false, the file is directly downloaded. When set to true, the data is returned as a memory stream, which can be used for custom processing, storage, or further manipulation. In this sample, false is passed to initiate a direct download of the Excel file. N> The pivot table component can be exported to CSV format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -278,7 +278,7 @@ N> The pivot table component can be exported to CSV format using options availab @code{ SfPivotView pivot; public List Data { get; set; } - protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + protected override void OnInitialized() { this.Data = ProductDetails.GetProductData().ToList(); //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. @@ -335,7 +335,7 @@ When the [EnableVirtualization](https://help.syncfusion.com/cr/blazor/Syncfusion ## Saving Excel document to stream -Rather than exporting the Pivot Table as a downloadable file, user can save the Excel document as a memory stream. This is achieved by setting the **asMemoryStream** option to **true** in the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method. The resulting memory stream can then be further processed and customized by the user before being exported as a document. +Rather than exporting the Pivot Table as a downloadable file, user can save the Excel document as a memory stream. This is achieved by setting the **asMemoryStream** parameter to **true** in the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method. The resulting memory stream can then be further processed and customized by the user before being exported as a document. N> This option is only available if virtualization is enabled in the pivot table. @@ -444,7 +444,7 @@ The event [ExcelQueryCellInfo](https://help.syncfusion.com/cr/blazor/Syncfusion. private SfPivotView pivot; public List Data { get; set; } - protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + protected override void OnInitialized() { this.Data = ProductDetails.GetProductData().ToList(); // Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. @@ -535,7 +535,7 @@ The event [ExcelHeaderQueryCellInfo](https://help.syncfusion.com/cr/blazor/Syncf private SfPivotView pivot; public List Data { get; set; } - protected override void OnInitialized(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + protected override void OnInitialized() { this.Data = ProductDetails.GetProductData().ToList(); // Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. diff --git a/blazor/pivot-table/sorting.md b/blazor/pivot-table/sorting.md index aadbedbfb3..48cf6db6bf 100644 --- a/blazor/pivot-table/sorting.md +++ b/blazor/pivot-table/sorting.md @@ -116,15 +116,15 @@ Usually string sorting is applied to field members even if it starts with number ## Value sorting -Allows to sort individual value field and its aggregated values either in row or column axis in both ascending and descending order. It can be enabled by setting the [EnableValueSorting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_EnableValueSorting) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. On enabling, the end user can sort the values by directly clicking the value field header positioned either in row or column axis of the pivot table component. +The value sorting feature allows aggregated values to be sorted in either ascending or descending order. It can be enabled by setting the [EnableValueSorting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_EnableValueSorting) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. This feature supports value sorting on both the row and column axes simultaneously, enabling users to sort based on either ColumnHeaderText or RowHeaderText for more dynamic and precise data analysis. The value sorting can also be configured using the [PivotViewValueSortSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html) option through the code behind. The settings required to sort value fields are: -* [ColumnHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): Specifies the column header hierarchy for value sorting. Header levels are defined from Level 1 to N using a delimiter for clarity. +* [ColumnHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_ColumnHeaderText): Specifies the column header hierarchy for value sorting. Header levels are defined from Level 1 to N using a delimiter for clarity. * [HeaderDelimiter](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderDelimiter): It allows to set the delimiters string to separate the header text between levels. -* [ColumnSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): Sets the delimiter string used to separate levels in the column header text. -* [RowHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): Defines the specific row header for which the value sorting should be applied. -* [RowSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): Determines the sorting direction for the specified row header. +* [ColumnSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_ColumnSortOrder): Sets the delimiter string used to separate levels in the column header text. +* [RowHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_RowHeaderText): Defines the specific row header for which the value sorting should be applied. +* [RowSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_RowSortOrder): Determines the sorting direction for the specified row header. N> Value fields are set to the column axis by default. In such cases, the value sorting applied will have an effect on the column alone. You need to place the value fields in the row axis to do so in row wise. For more information, [refer here](https://blazor.syncfusion.com/documentation/pivot-table/data-binding#values-in-row-axis). @@ -148,7 +148,7 @@ N> Value fields are set to the column axis by default. In such cases, the value                                -         +      From 492b9bc6a194cad2f4dfc8727d5eae718777ab58 Mon Sep 17 00:00:00 2001 From: DeebigaSF4971 Date: Wed, 11 Jun 2025 19:39:39 +0530 Subject: [PATCH 3/3] 962647: Add the review changes --- blazor/pivot-table/excel-export.md | 20 +++++++++-- blazor/pivot-table/sorting.md | 53 +++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/blazor/pivot-table/excel-export.md b/blazor/pivot-table/excel-export.md index ed5f5e1de6..1a624f1af2 100644 --- a/blazor/pivot-table/excel-export.md +++ b/blazor/pivot-table/excel-export.md @@ -9,7 +9,14 @@ documentation: ug # Excel export in Blazor Pivot Table component -The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. This method accepts a boolean parameter, asMemoryStream, which determines the export behavior. When set to false, the file is directly downloaded. When set to true, the data is returned as a memory stream, which can be used for custom processing, storage, or further manipulation. In this sample, false is passed to initiate a direct download of the Excel file. +The Excel export allows Pivot Table data to be exported as Excel document. To enable Excel export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. Once the API is set, user needs to call the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. + +This method accepts a boolean parameter, **"asMemoryStream"**, which determines the export behavior: + +* **false:** Downloads the Excel file directly. +* **true:** Returns the file as a memory stream for custom processing, storage, or manipulation. + +In this example, false is used to initiate a direct download. N> The pivot table component can be exported to Excel format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -246,7 +253,14 @@ By default, Microsoft Excel supports only 1,048,576 records in an Excel sheet. H ## CSV Export -The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. This method accepts a boolean parameter, asMemoryStream, which determines the export behavior. When set to false, the file is directly downloaded. When set to true, the data is returned as a memory stream, which can be used for custom processing, storage, or further manipulation. In this sample, false is passed to initiate a direct download of the Excel file. +The Excel export allows pivot table data to be exported in **CSV** file format as well. To enable CSV export in the pivot table, set the [AllowExcelExport](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_AllowExcelExport) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class as **true**. Once the API is set, user needs to call the [ExportToCsvAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_CsvExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method for exporting on external button click. + +This method accepts a boolean parameter, **"asMemoryStream"**, which determines the export behavior: + +* **false:** Downloads the Excel file directly. +* **true:** Returns the file as a memory stream for custom processing, storage, or manipulation. + +In this example, false is used to initiate a direct download. N> The pivot table component can be exported to CSV format using options available in the toolbar. For more details [refer](./tool-bar) here. @@ -335,7 +349,7 @@ When the [EnableVirtualization](https://help.syncfusion.com/cr/blazor/Syncfusion ## Saving Excel document to stream -Rather than exporting the Pivot Table as a downloadable file, user can save the Excel document as a memory stream. This is achieved by setting the **asMemoryStream** parameter to **true** in the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method. The resulting memory stream can then be further processed and customized by the user before being exported as a document. +Rather than exporting the Pivot Table as a downloadable file, the user can save the Excel document as a memory stream. This is achieved by setting the **asMemoryStream** parameter to **true** in the [ExportToExcelAsync](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_ExcelExport_System_Object_System_Nullable_System_Boolean__System_Object_System_Nullable_System_Boolean__) method. The resulting memory stream can then be further processed and customized by the user before being exported as a document. N> This option is only available if virtualization is enabled in the pivot table. diff --git a/blazor/pivot-table/sorting.md b/blazor/pivot-table/sorting.md index 48cf6db6bf..c61aafd56d 100644 --- a/blazor/pivot-table/sorting.md +++ b/blazor/pivot-table/sorting.md @@ -116,17 +116,64 @@ Usually string sorting is applied to field members even if it starts with number ## Value sorting -The value sorting feature allows aggregated values to be sorted in either ascending or descending order. It can be enabled by setting the [EnableValueSorting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_EnableValueSorting) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. This feature supports value sorting on both the row and column axes simultaneously, enabling users to sort based on either ColumnHeaderText or RowHeaderText for more dynamic and precise data analysis. +Allows to sort individual value field and its aggregated values either in row or column axis in both ascending and descending order. It can be enabled by setting the [EnableValueSorting](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html#Syncfusion_Blazor_PivotView_SfPivotView_1_EnableValueSorting) property in [SfPivotView](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.SfPivotView-1.html) class to **true**. On enabling, the end user can sort the values by directly clicking the value field header positioned either in row or column axis of the pivot table component. The value sorting can also be configured using the [PivotViewValueSortSettings](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html) option through the code behind. The settings required to sort value fields are: +* [HeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderText): It allows to set the header names with delimiters, that is used for value sorting. The header names are arranged from Level 1 to Level N, down the hierarchy with a delimiter for better specification. +* [HeaderDelimiter](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderDelimiter): It allows to set the delimiters string to separate the header text between levels. +* [SortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_SortOrder): It allows to set the sort direction of the value field. + +N> Value fields are set to the column axis by default. In such cases, the value sorting applied will have an effect on the column alone. You need to place the value fields in the row axis to do so in row wise. For more information, [refer here](https://blazor.syncfusion.com/documentation/pivot-table/data-binding#values-in-row-axis). + +```cshtml +@using Syncfusion.Blazor.PivotView + + +   +         +             +             +         +         +             +             +         +         + +             +         +         +             +         +         +     + + +@code{ + public List data { get; set; } + protected override void OnInitialized() + { + this.data = ProductDetails.GetProductData().ToList(); + //Bind the data source collection here. Refer "Assigning sample data to the pivot table" section in getting started for more details. + } +} + +``` + +![Value Sorting in Blazor PivotTable](images/blazor-pivottable-value-sorting.png) + +### Multiple Axis Sorting + +Users can apply value sorting to both row and column axes simultaneously for more dynamic and precise data analysis. The following settings are used to configure sorting: + * [ColumnHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_ColumnHeaderText): Specifies the column header hierarchy for value sorting. Header levels are defined from Level 1 to N using a delimiter for clarity. * [HeaderDelimiter](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_HeaderDelimiter): It allows to set the delimiters string to separate the header text between levels. * [ColumnSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_ColumnSortOrder): Sets the delimiter string used to separate levels in the column header text. * [RowHeaderText](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_RowHeaderText): Defines the specific row header for which the value sorting should be applied. * [RowSortOrder](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.PivotView.PivotViewValueSortSettings.html#Syncfusion_Blazor_PivotView_PivotViewValueSortSettings_RowSortOrder): Determines the sorting direction for the specified row header. -N> Value fields are set to the column axis by default. In such cases, the value sorting applied will have an effect on the column alone. You need to place the value fields in the row axis to do so in row wise. For more information, [refer here](https://blazor.syncfusion.com/documentation/pivot-table/data-binding#values-in-row-axis). +N> This feature is applicable only to relational data sources. ```cshtml @using Syncfusion.Blazor.PivotView @@ -163,8 +210,6 @@ N> Value fields are set to the column axis by default. In such cases, the value ``` -![Value Sorting in Blazor PivotTable](images/blazor-pivottable-value-sorting.png) - ## Events ### OnActionBegin