Search in sources :

Example 1 with CTPivotTableStyle

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableStyle in project poi by apache.

the class XSSFPivotTable method setDefaultPivotTableDefinition.

/**
     * Set default values for the table definition.
     */
@Beta
protected void setDefaultPivotTableDefinition() {
    //Not more than one until more created
    pivotTableDefinition.setMultipleFieldFilters(false);
    //Indentation increment for compact rows
    pivotTableDefinition.setIndent(0);
    //The pivot version which created the pivot cache set to default value
    pivotTableDefinition.setCreatedVersion(CREATED_VERSION);
    //Minimun version required to update the pivot cache
    pivotTableDefinition.setMinRefreshableVersion(MIN_REFRESHABLE_VERSION);
    //Version of the application which "updated the spreadsheet last"
    pivotTableDefinition.setUpdatedVersion(UPDATED_VERSION);
    //Titles shown at the top of each page when printed
    pivotTableDefinition.setItemPrintTitles(true);
    //Set autoformat properties
    pivotTableDefinition.setUseAutoFormatting(true);
    pivotTableDefinition.setApplyNumberFormats(false);
    pivotTableDefinition.setApplyWidthHeightFormats(true);
    pivotTableDefinition.setApplyAlignmentFormats(false);
    pivotTableDefinition.setApplyPatternFormats(false);
    pivotTableDefinition.setApplyFontFormats(false);
    pivotTableDefinition.setApplyBorderFormats(false);
    pivotTableDefinition.setCacheId(pivotCache.getCTPivotCache().getCacheId());
    pivotTableDefinition.setName("PivotTable" + pivotTableDefinition.getCacheId());
    pivotTableDefinition.setDataCaption("Values");
    //Set the default style for the pivot table
    CTPivotTableStyle style = pivotTableDefinition.addNewPivotTableStyleInfo();
    style.setName("PivotStyleLight16");
    style.setShowLastColumn(true);
    style.setShowColStripes(false);
    style.setShowRowStripes(false);
    style.setShowColHeaders(true);
    style.setShowRowHeaders(true);
}
Also used : CTPivotTableStyle(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableStyle) Beta(org.apache.poi.util.Beta)

Aggregations

Beta (org.apache.poi.util.Beta)1 CTPivotTableStyle (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPivotTableStyle)1