When exporting a pivot into excel the numbers are not formatted the same as the report generated. I am using Format="###0.0" which gives me for example 2.2. When exporting I get for example 2.2929382 so it's not rounding up to one decimal point.
When exporting the pivot to either excel or csv I'm getting weird text in the blank cell that's on the top left corner.
It does it when using a calculated field. I have updated your sample.
|
<SfPivotView TValue="ProductDetails>
<PivotViewDataSourceSettings DataSource="@dataSource">
<PivotViewCalculatedFieldSettings>
<PivotViewCalculatedFieldSetting Name="Total" Formula="@calcTotalPrice" FormatString="###0.0">
</PivotViewCalculatedFieldSetting>
</PivotViewCalculatedFieldSettings>
</PivotViewDataSourceSettings>
</SfPivotView>
@code{
public string calcTotalPrice { get; set; } = "\"" + "Sum(Amount)" + "\"";
} |
I ran your example. In your new example the calculated field is not formatted correctly. It should only have 1 decimal place.
Hi Jason,
Currently, we are analyzing this query at our end, and we will update further details within two business days (March 28, 2022).
Regards,
Angelin Faith Sheeba.
Hi Jason,
The new or existing calculated field can be formatted through its UI and also through code behind. In code-behind, you can set the desired format using the ”PivotViewFormatSettings” property. Furthermore, the "FormatString" property is only used to format the calculated field for OLAP, not relational. Please see the example code below.
Code Example:
|
<SfPivotView TValue="ProductDetails"> <PivotViewDataSourceSettings> <PivotViewFormatSettings> <PivotViewFormatSetting Name="Total" Format="###0.0"></PivotViewFormatSetting> </PivotViewFormatSettings> <PivotViewCalculatedFieldSettings> <PivotViewCalculatedFieldSetting Name="Total" Formula="@totalPrice"></PivotViewCalculatedFieldSetting> </PivotViewCalculatedFieldSettings> </PivotViewDataSourceSettings> </SfPivotView> |
Meanwhile, we have modified your sample for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotServerDemo-796517940
Also, please refer the following documentation for more details about “CalculatedField”.
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba.
I think this is just going off in a tangent. When a calculated field is included and you format it using ##0.0 to where you only want one decimal place. That format is not being maintained when exporting to excel.
Hi
Jason,
We tested the same scenario you mentioned, and we are unable to reproduce the issue at our end. We've included a video below for your convenience.
Meanwhile, we've prepared a sample for the same below.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotServerDemo-1980070101
If the problem persists, please reproduce it in the provided sample and revert to us (or) send your sample that replicates the problem. This would allow us to investigate the reported problem at our end and provide a solution as soon as possible.
Regards,
Angelin Faith Sheeba.
I can't run the sample.
System.IO.DirectoryNotFoundException: 'C:\Users\AngelinFaithSheebaPa\Downloads\PivotServerDemo939823091\blazor\PivotServerDemo\PivotServerDemo\wwwroot\'
Hi Jason,
We have checked the sample provided and we are unable to reproduce the reported problem at our end. However, we believe the problem occurs due to the Blazor App which we have shared with .Net 6 version, resulting version mismatch at your end. So, we have prepared a sample with .NET 5 version for your convenience. Please find the sample link below.
Sample using .NET 5: https://www.syncfusion.com/downloads/support/directtrac/general/ze/net5-2074014206
Moreover, if you are using .NET6, please check the sample link below.
Sample using .NET 6 : https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotServerDemo-1055189680
Regards,
Angelin faith Sheeba.
I have uploaded changes to your demo where the issues do happen. Run project then export to excel. Values are not formatted and "0.formattedText" is in the top left cell.
Hi Jason,
Thanks for the sample. We can able to reproduce the reported problem at our end. We have considered this as a bug “Pivot Table values are not formatted properly while Excel exporting”. And this fix will be available in our 2022, Volume 1 SP release which is estimated to be rolled out in the first week of May 2022. The following link will help you keep track of it.
Regards,
Angelin Faith Sheeba.
Hi Jason,
We are glad to announce that our Essential Studio 2022 Volume 1 Service Pack Release V20.1.0.55 is rolled out and fix for the issue “Pivot Table values are not formatted properly while Excel exporting” has been included in this release. Please refer to the following sample.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotTable(net6.0)1465745714
We thank you for your support and appreciate your patience in waiting for this release. Please contact us if you require any further assistance.
Regards,
Angelin Faith Sheeba