DataDisplayFormat

Hi

I am trying to use DataDisplayFormat in pivot tables. That is:

• PivotField.DataDisplayFormat = PivotFieldDataDisplayFormat.DifferenceFrom;

• PivotField.BaseItemPosition = PivotItemPosition.Next;

A soon as I am specifying the BaseItemPosition, my application generates an unreadable xslx file. Without specifying the BaseItemPosition the generated file is valid.

I have joined an aspx example. Simply press on the xlsx button to generate the excel file.

Could you tell me if I am missing the point or if this is a bug?

Regards

Jacques

Hi,


Thanks for the sample project.

After an initial test, I observed the issue as you mentioned. When specifying the
BaseItemPosition attribute for the PivotField produces an invalid file
as when I opened the generated file into Ms Excel, it prompts me “Excel
found unreadable content…” error. Commenting out the relevant line of
code generates valid file though.

e.g


Sample code:


Workbook wb = new Workbook();


Worksheet ws = wb.Worksheets[wb.Worksheets.Add()];
ws.Name = "Sheet";

ws.Cells[0, 0].PutValue("X");
ws.Cells[0, 1].PutValue("Y");
ws.Cells[0, 2].PutValue("Data");
ws.Cells[0, 3].PutValue("Data2");

ws.Cells[1, 0].PutValue("A");
ws.Cells[1, 1].PutValue("C");
ws.Cells[1, 2].PutValue(10);
ws.Cells[1, 3].PutValue(122);

ws.Cells[2, 0].PutValue("A");
ws.Cells[2, 1].PutValue("D");
ws.Cells[2, 2].PutValue(25);
ws.Cells[2, 3].PutValue(23);

ws.Cells[3, 0].PutValue("B");
ws.Cells[3, 1].PutValue("C");
ws.Cells[3, 2].PutValue(30);
ws.Cells[3, 3].PutValue(22);

ws.Cells[4, 0].PutValue("B");
ws.Cells[4, 1].PutValue("D");
ws.Cells[4, 2].PutValue(45);
ws.Cells[4, 3].PutValue(78);



PivotTableCollection ptc = ws.PivotTables;
int index = ptc.Add("=Sheet!A1:D5", "A7", "PivotTable1");
PivotTable pt = ptc[index];

int fp; PivotField pf; PivotField pfBase;

fp = pt.AddFieldToArea(PivotFieldType.Row, "X");
pf = pt.Fields(PivotFieldType.Row)[fp];

fp = pt.AddFieldToArea(PivotFieldType.Column, "Y");
pfBase = pt.Fields(PivotFieldType.Column)[fp];

fp = pt.AddFieldToArea(PivotFieldType.Data, "Data");
pf = pt.Fields(PivotFieldType.Data)[fp];

fp = pt.AddFieldToArea(PivotFieldType.Data, "Data2");
pf = pt.Fields(PivotFieldType.Data)[fp];


int fieldPosition = pt.AddFieldToArea(PivotFieldType.Data, "Data");
PivotField pfDiff = pt.Fields(PivotFieldType.Data)[fieldPosition];
pfDiff.DisplayName = "Diff";
pfDiff.Function = ConsolidationFunction.Sum;
pfDiff.DataDisplayFormat = PivotFieldDataDisplayFormat.DifferenceFrom;
pfDiff.BaseItemPosition = PivotItemPosition.Next; //Commenting out this line produces valid file
pfDiff.BaseFieldIndex = pfBase.BaseIndex;


pt.AddFieldToArea(PivotFieldType.Column, pt.DataField);

wb.CalculateFormula();
wb.Save("e:\\test2\\outDataDisplay1.xlsx")

I have logged a ticket with an id "CELLSNET-43358" for your issue. We will look into it to figure it out soon.

Thank you.

Hi



How far is Aspose with this issue? This ‘absolute and percent difference from month to month’ feature will be used quite a lot in our Excel reports and it would be nice to have a status on the problem.



Regards

Jacques

Hi,


I have checked the status of your issue “CELLSNET-43358” into our database. Well, your issue is in progress, hopefully it will be fixed soon. Also I have asked the concerned developer to update on it or provide an eta (if possible).

Once we have any update on it, we will let you know here.

Thank you.

Hi,


To update you on your issue, as we are working over your issue and hopefully we will provide you the fix before the end of second week of February 2015 (expected Date is February 13, 2015).

Thank you.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.3.2.3 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-43358) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.