How to Set the Overall Size of a Pivot Table

26-10 Web User Interface Developers Guide for Oracle Application Development Framework – column: An integer that specifies the zero-based column that contains the data cell that you want to format. – qdr: The QDR that is a fully qualified reference for the data cell that you want to format. – value: A java.lang.Object that contains the value in the data cell that you want to format. 2. Pass the DataCellContext to a method expression for the dataFormat attribute of the pivot table. 3. In the method expression, write code that specifies the kind of formatting you want to apply to the data cells of the pivot table. This method expression must return a CellFormat object.

26.9.2 How to Construct a CellFormat Object

An instance of a CellFormat object lets you specify the following arguments: ■ Converter: An instance of javax.faces.convert.Converter, which is used to perform number, date, or text formatting of a raw value in a cell. ■ CSS style: Used to change the CSS style of a cell. For example, you might use this argument to change the background color of a cell. ■ CSS text style: Used to change the CSS style of the text in a cell. For example, you might use this argument to set text to bold. ■ New raw value: Used to change the cell’s underlying value that was returned from the data model. For example, you might choose to change the abbreviated names of states to longer names. In this case, the abbreviation NY might be changed to New York.

26.9.3 How to Change Format and Text Styles

You can apply formatting and text styles to emphasize aspects of the data displayed in the pivot table. Figure 26–13 shows a pivot table with sales totals generated for products and for product categories. In the rows that contain totals, this pivot table displays bold text a text style change against a shaded background a style change. These changes show in both the row header cells and the data cells for the pivot table. The row headers for totals contain the text Sales Total. The pivot table also shows stoplight and conditional formatting of data cells. For more information, see Section 26.9.4, How to Create Stoplight and Conditional Formatting in a Pivot Table. Using ADF Pivot Table Components 26-11 Figure 26–13 Sales Data Per Product Category Example 26–5 shows sample code that produces the required custom formats for the sales totals, but not for the stoplight formatting. The example includes the code for method expressions for both the dataFormat attribute and the headerFormat attribute of the dvt:pivotTable tag. If you want to include stoplight formatting in the pivot table, you might want to include the code from Example 26–6 . Example 26–5 Sample Code to Change Style and Text Style in a Pivot Table public CellFormat getDataFormatDataCellContext cxt { CellFormat cellFormat = new CellFormatnull, null, null; QDR qdr = cxt.getQDR; Obtain a reference to the product category column. Object productCateg = qdr.getDimMemberProductCategory; Obtain a reference to the product column. Object product = qdr.getDimMemberProductId; if productCateg = null productCateg.toString.equalsSales Total { cellFormat.setTextStylefont-weight:bold cellFormat.setStylebackground-color:C0C0C0; } else if product = null product.toString.equalsSales Total { cellFormat.setTextStylefont-weight:bold; cellFormat.setStylebackground-color:C0C0C0; } return cellFormat; } public CellFormat getHeaderFormatHeaderCellContext cxt { if cxt.getValue = null { String header = cxt.getValue.toString; if header.equalsSales Total {