PivotFilter

Inheritance: java.lang.Object

public class PivotFilter

Represents a PivotFilter in PivotFilter Collection.

Example

         Workbook book = new Workbook();
         Worksheet sheet = book.getWorksheets().get(0);
         Cells cells = sheet.getCells();
         cells.get(0, 0).setValue("fruit");
         cells.get(1, 0).setValue("grape");
         cells.get(2, 0).setValue("blueberry");
         cells.get(3, 0).setValue("kiwi");
         cells.get(4, 0).setValue("cherry");
         cells.get(5, 0).setValue("grape");
         cells.get(6, 0).setValue("blueberry");
         cells.get(7, 0).setValue("kiwi");
         cells.get(8, 0).setValue("cherry");
 
         cells.get(0, 1).setValue("year");
         cells.get(1, 1).setValue(2020);
         cells.get(2, 1).setValue(2020);
         cells.get(3, 1).setValue(2020);
         cells.get(4, 1).setValue(2020);
         cells.get(5, 1).setValue(2021);
         cells.get(6, 1).setValue(2021);
         cells.get(7, 1).setValue(2021);
         cells.get(8, 1).setValue(2021);
 
         cells.get(0, 2).setValue("amount");
         cells.get(1, 2).setValue(50);
         cells.get(2, 2).setValue(60);
         cells.get(3, 2).setValue(70);
         cells.get(4, 2).setValue(80);
         cells.get(5, 2).setValue(90);
         cells.get(6, 2).setValue(100);
         cells.get(7, 2).setValue(110);
         cells.get(8, 2).setValue(120);
 
         PivotTableCollection pivots = sheet.getPivotTables();
 
         int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable");
         PivotTable pivot = pivots.get(pivotIndex);
         pivot.addFieldToArea(PivotFieldType.ROW, "fruit");
         pivot.addFieldToArea(PivotFieldType.COLUMN, "year");
         pivot.addFieldToArea(PivotFieldType.DATA, "amount");
 
         pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10);
 
         //Add PivotFilter
         int index = pivot.getPivotFilters().add(0, PivotFilterType.COUNT);
         PivotFilter filter = pivot.getPivotFilters().get(index);
         filter.getAutoFilter().filterTop10(0, false, false, 2);
 
         pivot.refreshData();
         pivot.calculateData();
 
         //do your business
 
         book.save("out.xlsx");

Methods

MethodDescription
equals(Object arg0)
getAutoFilter()Gets the autofilter of the pivot filter.
getClass()
getEvaluationOrder()Gets the Evaluation Order of the pivot filter.
getFieldIndex()Gets the field index of the pivot filter.
getFilterType()Gets the autofilter type of the pivot filter.
getMeasureFldIndex()Gets the measure field index of the pivot filter.
getMemberPropertyFieldIndex()Gets the member property field index of the pivot filter.
getName()Gets the name of the pivot filter.
getValue1()Gets the string value1 of the label pivot filter.
getValue2()Gets the string value2 of the label pivot filter.
hashCode()
notify()
notifyAll()
setEvaluationOrder(int value)Gets the Evaluation Order of the pivot filter.
setMeasureFldIndex(int value)Gets the measure field index of the pivot filter.
setMemberPropertyFieldIndex(int value)Gets the member property field index of the pivot filter.
setName(String value)Gets the name of the pivot filter.
setValue1(String value)Gets the string value1 of the label pivot filter.
setValue2(String value)Gets the string value2 of the label pivot filter.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAutoFilter()

public AutoFilter getAutoFilter()

Gets the autofilter of the pivot filter.

Returns: AutoFilter

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getEvaluationOrder()

public int getEvaluationOrder()

Gets the Evaluation Order of the pivot filter.

Returns: int

getFieldIndex()

public int getFieldIndex()

Gets the field index of the pivot filter.

Returns: int

getFilterType()

public int getFilterType()

Gets the autofilter type of the pivot filter.

See PivotFilterType.

Returns: int

getMeasureFldIndex()

public int getMeasureFldIndex()

Gets the measure field index of the pivot filter.

Returns: int

getMemberPropertyFieldIndex()

public int getMemberPropertyFieldIndex()

Gets the member property field index of the pivot filter.

Returns: int

getName()

public String getName()

Gets the name of the pivot filter.

Returns: java.lang.String

getValue1()

public String getValue1()

Gets the string value1 of the label pivot filter.

Returns: java.lang.String

getValue2()

public String getValue2()

Gets the string value2 of the label pivot filter.

Returns: java.lang.String

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setEvaluationOrder(int value)

public void setEvaluationOrder(int value)

Gets the Evaluation Order of the pivot filter.

Parameters:

ParameterTypeDescription
valueint

setMeasureFldIndex(int value)

public void setMeasureFldIndex(int value)

Gets the measure field index of the pivot filter.

Parameters:

ParameterTypeDescription
valueint

setMemberPropertyFieldIndex(int value)

public void setMemberPropertyFieldIndex(int value)

Gets the member property field index of the pivot filter.

Parameters:

ParameterTypeDescription
valueint

setName(String value)

public void setName(String value)

Gets the name of the pivot filter.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setValue1(String value)

public void setValue1(String value)

Gets the string value1 of the label pivot filter.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setValue2(String value)

public void setValue2(String value)

Gets the string value2 of the label pivot filter.

Parameters:

ParameterTypeDescription
valuejava.lang.String

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int