# GC.Spread.Pivot.CustomPivotTableThemeManager

## Content

# Class: CustomPivotTableThemeManager

[Spread](../modules/GC.Spread).[Pivot](../modules/GC.Spread.Pivot).CustomPivotTableThemeManager

## Hierarchy

- [`CustomThemeManagerBase`](GC.Spread.Sheets.CustomThemeManagerBase)

  ↳ **`CustomPivotTableThemeManager`**

## Table of contents

### Constructors

- [constructor](GC.Spread.Pivot.CustomPivotTableThemeManager#constructor)

### Methods

- [add](GC.Spread.Pivot.CustomPivotTableThemeManager#add)
- [all](GC.Spread.Pivot.CustomPivotTableThemeManager#all)
- [get](GC.Spread.Pivot.CustomPivotTableThemeManager#get)
- [remove](GC.Spread.Pivot.CustomPivotTableThemeManager#remove)
- [update](GC.Spread.Pivot.CustomPivotTableThemeManager#update)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new CustomPivotTableThemeManager**(`workbook`)

Represents a custom pivot table theme manager that can manage all custom pivot table themes.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `workbook` | [`Workbook`](GC.Spread.Sheets.Workbook) | The workbook. |

#### Overrides

[CustomThemeManagerBase](GC.Spread.Sheets.CustomThemeManagerBase).[constructor](GC.Spread.Sheets.CustomThemeManagerBase#constructor)

## Methods

### <a id="add" name="add"></a> add

▸ **add**(`theme`): `undefined` \| [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)

add a new pivot table theme.

**`example`**
```javascript
// add a new pivot table theme named "custom0"
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
let pivotTableStyle = spread.customPivotTableThemes.add("custom0");
let wholeTableStyle = new GC.Spread.Pivot.PivotTableStyle();
wholeTableStyle.backColor = "#0C66E4";
pivotTableStyle.wholeTableStyle(wholeTableStyle);
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `theme` | `string` \| [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme) | the new pivot table theme or just a new pivot table theme name you want to add |

#### Returns

`undefined` \| [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)

return the newly added pivot table theme, if the named pivot table theme is existed, failed to add pivot table theme and return undefined

___

### <a id="all" name="all"></a> all

▸ **all**(): [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)[]

get the pivot table themes collection.

**`example`**
```javascript
// get all pivot table themes
let tableStylesCollection = spread.customPivotTableThemes.all();
```

#### Returns

[`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)[]

Array<GC.Spread.Pivot.PivotTableTheme>

___

### <a id="get" name="get"></a> get

▸ **get**(`name`): `undefined` \| [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)

get the pivot table theme by name.

**`example`**
```javascript
// get pivot table theme
pivotTableStyle = spread.customPivotTableThemes.get("custom0");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | the specific name of the pivot table theme to get |

#### Returns

`undefined` \| [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme)

If the corresponding pivot table theme with the spefic name is found, return the theme; otherwise, return undefined.

___

### <a id="remove" name="remove"></a> remove

▸ **remove**(`name`): `void`

remove the pivot table theme by name.

**`example`**
```javascript
// delete pivot table theme
spread.customPivotTableThemes.remove("custom0");
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | the specific name of the pivot table theme to remove |

#### Returns

`void`

___

### <a id="update" name="update"></a> update

▸ **update**(`oldThemeName`, `newTheme`): `void`

update the pivot table theme.

**`example`**
```javascript
// update pivot table theme
tableStyle = spread.customPivotTableThemes.update("custom0", new GC.Spread.Pivot.PivotTableTheme());
```

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `oldThemeName` | `string` | the specific name of the pivot table theme to update |
| `newTheme` | [`PivotTableTheme`](GC.Spread.Pivot.PivotTableTheme) | the specific name of the pivot table theme to update |

#### Returns

`void`
