Is there a way that I can set this checkbox? I can select and unselect the values on the PivotItem just fine, but if I only have one value selected, the spreadsheet still shows “Multiple Items” are selected. I would think there would be a method on the PivotField or PivotPageFields object. Can you help?
Hi,
You can also go to the ‘help’ menu in the software application. MS Excel, right?,
Hi again,
OK. I’ll elaborate. I create a pivot table with the java API.I add a page field to the pivot area. This page field, or “report filter” in excel, allows me to filter my pivot table based on certain values contained. For example, if I have a page field for “Stock”, the pivot table would provide a user with a way to select only the data that matches the status that I select. I have included an example excel 2010 file that I created. Pay specific attention to the page fields, or report filters, at the top. They are identified as “Status”, “Stock”, “Qty On Hand”, and “Qty On PO”. Click on the filter. You will see selections for “All”, “Y”, and “N” with a checkbox at the bottom that says “Select Multiple Items” which allows multiple items to be selected from the filter. Then the checkbox for “Select Multiple Items” is checked, this displays “(Multiple Items)” next to the page field header as the value. With the API, I do the following…
// setup page field for Stock
pivotTable.addFieldToArea(PivotFieldType.PAGE, HEADINGS[9]);
pf = pivotTable.getFields(PivotFieldType.PAGE).get(1);
pis = pf.getPivotItems();
for(int i=0; i<pis.size(); i++)
{
PivotItem pi = pis.get(i);
if(!pi.getStringValue().equals(“Y”))
pi.hide(true);
}
This causes the “Select Multiple Items” checkbox to be selected even if I only programatically selected one value, which means excel shows the value as "(Multiple Items)"instread of just “Y”. If only one value is selected, I want to uncheck the “Select Multiple Items” checkbox so the pre-selected value will show next to the page field in the pivot table.
Hi,
Greetings,
Hi,
We have fixed this issue. Please download Aspose.Cells for Java v2.5.4.6.
Please use isMultipleItemSelectionAllowed()/setMultipleItemSelectionAllowed(boolean) methods of pivotfield to set “select multi items”.
Yes, its fixed but its backwards. If I want to disallow multiple items to be selected, I would naturally choose false. However, the method does not perform as expected in this manner. I had to select true, to allow multiple items, so that the “multiple items” test does not display. Also, if I click on the filter, the checkbox is still selected regardless of the boolean value I pass.
Hi,
Hi,
field.setMultipleItemSelectionAllowed(false);
field.setCurrentPageItem((short)0);
Ok. Looks like it works now. So instead of showing or hiding specific pivotitems as i was doing before with pivotitem.hide(true), I just test the pivot item for the value and if the value happens to be the one I want to preselect, the index of the pivot item is used for the pivotfield.setCurrentPageItem((short)index). Thanks guys.
The issues you have found earlier (filed as 28372) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.