Page class

A Power BI report page

Properties

background

Page background color.

defaultDisplayOption

Page display options as saved in the report.

defaultSize

Page size as saved in the report.

displayName

The user defined display name of the report page, which is undefined if the page is created manually

isActive

Is this page is the active page

mobileSize

Mobile view page size (if defined) as saved in the report.

name

The report page name

report

The parent Power BI report that this page is a member of

visibility

The visibility of the page. 0 - Always Visible 1 - Hidden in View Mode

wallpaper

Page wallpaper color.

Methods

delete()

Delete the page from the report

// Delete the page from the report
page.delete();
getFilters()

Gets all page level filters within the report.

page.getFilters()
 .then(filters => { ... });
getSlicers()

Gets the list of slicer visuals on the page.

page.getSlicers()
 .then(slicers => {
     ...
 });
getVisualByName(string)

Gets a visual by name on the page.

page.getVisualByName(visualName: string)
 .then(visual => {
     ...
 });
getVisuals()

Gets all the visuals on the page.

page.getVisuals()
  .then(visuals => { ... });
hasLayout(LayoutType)

Checks if page has layout.

page.hasLayout(layoutType)
 .then(hasLayout: boolean => { ... });
moveVisual(string, number, number, number)

Updates the position of a visual in a page.

page.moveVisual(visualName, x, y, z)
  .catch(error => { ... });
removeFilters()

Removes all filters from this page of the report.

page.removeFilters();
resizePage(PageSizeType, number, number)

Updates the size of active page.

page.resizePage(pageSizeType, width, height)
  .catch(error => { ... });
resizeVisual(string, number, number)

Resize a visual in a page.

page.resizeVisual(visualName, width, height)
  .catch(error => { ... });
setActive()

Makes the current page the active page of the report.

page.setActive();
setDisplayName(string)

Set displayName to the current page.

page.setName(displayName);
setFilters(IFilter[])

Sets all filters on the current page.

page.setFilters(filters)
  .catch(errors => { ... });
setVisualDisplayState(string, VisualContainerDisplayMode)

Updates the display state of a visual in a page.

page.setVisualDisplayState(visualName, displayState)
  .catch(error => { ... });
updateFilters(FiltersOperations, IFilter[])

Update the filters for the current page according to the operation: Add, replace all, replace by target or remove.

page.updateFilters(FiltersOperations.Add, filters)
  .catch(errors => { ... });

Property Details

background

Page background color.

background: IPageBackground

Property Value

defaultDisplayOption

Page display options as saved in the report.

defaultDisplayOption: DisplayOption

Property Value

defaultSize

Page size as saved in the report.

defaultSize: ICustomPageSize

Property Value

displayName

The user defined display name of the report page, which is undefined if the page is created manually

displayName: string

Property Value

string

isActive

Is this page is the active page

isActive: boolean

Property Value

boolean

mobileSize

Mobile view page size (if defined) as saved in the report.

mobileSize: ICustomPageSize

Property Value

name

The report page name

name: string

Property Value

string

report

The parent Power BI report that this page is a member of

report: IReportNode

Property Value

visibility

The visibility of the page. 0 - Always Visible 1 - Hidden in View Mode

visibility: SectionVisibility

Property Value

wallpaper

Page wallpaper color.

wallpaper: IPageWallpaper

Property Value

Method Details

delete()

Delete the page from the report

// Delete the page from the report
page.delete();
function delete(): Promise<void>

Returns

Promise<void>

getFilters()

Gets all page level filters within the report.

page.getFilters()
 .then(filters => { ... });
function getFilters(): Promise<IFilter[]>

Returns

Promise<IFilter[]>

getSlicers()

Gets the list of slicer visuals on the page.

page.getSlicers()
 .then(slicers => {
     ...
 });
function getSlicers(): Promise<IVisual[]>

Returns

Promise<IVisual[]>

getVisualByName(string)

Gets a visual by name on the page.

page.getVisualByName(visualName: string)
 .then(visual => {
     ...
 });
function getVisualByName(visualName: string): Promise<VisualDescriptor>

Parameters

visualName

string

Returns

Promise<VisualDescriptor>

getVisuals()

Gets all the visuals on the page.

page.getVisuals()
  .then(visuals => { ... });
function getVisuals(): Promise<VisualDescriptor[]>

Returns

Promise<VisualDescriptor[]>

hasLayout(LayoutType)

Checks if page has layout.

page.hasLayout(layoutType)
 .then(hasLayout: boolean => { ... });
function hasLayout(layoutType: LayoutType): Promise<boolean>

Parameters

layoutType
LayoutType

Returns

Promise<boolean>

moveVisual(string, number, number, number)

Updates the position of a visual in a page.

page.moveVisual(visualName, x, y, z)
  .catch(error => { ... });
function moveVisual(visualName: string, x: number, y: number, z?: number): Promise<IHttpPostMessageResponse<void>>

Parameters

visualName

string

x

number

y

number

z

number

Returns

Promise<IHttpPostMessageResponse<void>>

removeFilters()

Removes all filters from this page of the report.

page.removeFilters();
function removeFilters(): Promise<IHttpPostMessageResponse<void>>

Returns

Promise<IHttpPostMessageResponse<void>>

resizePage(PageSizeType, number, number)

Updates the size of active page.

page.resizePage(pageSizeType, width, height)
  .catch(error => { ... });
function resizePage(pageSizeType: PageSizeType, width?: number, height?: number): Promise<IHttpPostMessageResponse<void>>

Parameters

pageSizeType
PageSizeType
width

number

height

number

Returns

Promise<IHttpPostMessageResponse<void>>

resizeVisual(string, number, number)

Resize a visual in a page.

page.resizeVisual(visualName, width, height)
  .catch(error => { ... });
function resizeVisual(visualName: string, width: number, height: number): Promise<IHttpPostMessageResponse<void>>

Parameters

visualName

string

width

number

height

number

Returns

Promise<IHttpPostMessageResponse<void>>

setActive()

Makes the current page the active page of the report.

page.setActive();
function setActive(): Promise<IHttpPostMessageResponse<void>>

Returns

Promise<IHttpPostMessageResponse<void>>

setDisplayName(string)

Set displayName to the current page.

page.setName(displayName);
function setDisplayName(displayName: string): Promise<IHttpPostMessageResponse<void>>

Parameters

displayName

string

Returns

Promise<IHttpPostMessageResponse<void>>

setFilters(IFilter[])

Sets all filters on the current page.

page.setFilters(filters)
  .catch(errors => { ... });
function setFilters(filters: IFilter[]): Promise<IHttpPostMessageResponse<void>>

Parameters

filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>

setVisualDisplayState(string, VisualContainerDisplayMode)

Updates the display state of a visual in a page.

page.setVisualDisplayState(visualName, displayState)
  .catch(error => { ... });
function setVisualDisplayState(visualName: string, displayState: VisualContainerDisplayMode): Promise<IHttpPostMessageResponse<void>>

Parameters

visualName

string

Returns

Promise<IHttpPostMessageResponse<void>>

updateFilters(FiltersOperations, IFilter[])

Update the filters for the current page according to the operation: Add, replace all, replace by target or remove.

page.updateFilters(FiltersOperations.Add, filters)
  .catch(errors => { ... });
function updateFilters(operation: FiltersOperations, filters?: IFilter[]): Promise<IHttpPostMessageResponse<void>>

Parameters

operation
FiltersOperations
filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>