HeaderHAlignment Property

Microsoft Office Web Components Object Model

Show All

HeaderHAlignment Property

       

Returns or sets a PivotHAlignmentEnum constant that represents the horizontal alignment of a heading in the data area or an item in the filter area of the specified view. Read/write.

PivotHAlignmentEnum can be one of these PivotHAlignmentEnum constants.
plHAlignAutomatic
plHAlignCenter
plHAlignLeft
plHAlignRight

expression.HeaderHAlignment

expression   Required. An expression that returns a PivotView object.

Remarks

Use the HeaderBackColor, HeaderForeColor, and HeaderFont properties in addition to this property to format the heading in the data area or an item in the filter area of a PivotTable list.

Example

This example formats the header for the data area and the filter area of the current view in PivotTable1.

Sub SetHeaderProperties()

    Dim ptView
    Dim ptConstants

    Set ptConstants = PivotTable1.Constants

    ' Set a variable to the current PivotTable view.
    Set ptView = PivotTable1.ActiveView

    ' Set the background color.
    ptView.HeaderBackColor = "Gray"

    ' Set the foreground color.
    ptView.HeaderForeColor = "Blue"

    ' Set the font.
    ptView.HeaderFont = "Tahoma"

    ' Set the alignment.
    ptView.HeaderHAlignment = ptConstants.plHAlignLeft

End Sub