Report class

The Power BI Report embed component

Extends

Embed

Properties

bookmarksManager

Methods

addContextMenuCommand(string, string, string, MenuLocation, string, string, string)

Add context menu extension command.

report.addContextMenuCommand(commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName)
 .catch(error => {
     ...
 });
addOptionsMenuCommand(string, string, string, MenuLocation, string, string, string, string)

Add options menu extension command.

report.addOptionsMenuCommand(commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon)
 .catch(error => {
     ...
 });
addPage(string)

Add an empty page to the report

// Add a page to the report with "Sales" as the page display name
report.addPage("Sales");
applyTheme(IReportTheme)

Apply a theme to the report

report.applyTheme(theme);
arePersistentFiltersApplied()

Returns if there are user's filters, slicers, or other data view changes applied on the report. If persistent filters is disable, returns false.

report.arePersistentFiltersApplied();
clearSelectedVisuals(boolean)

Clears selected not popped out visuals, if flag is passed, all visuals selections will be cleared.

report.clearSelectedVisuals()
 .then(() => {
     ...
 });
closeAllOverlays()

Closes all open context menus and tooltips.

report.closeAllOverlays()
 .then(() => {
     ...
 });
configChanged(boolean)

Handle config changes.

deletePage(string)

Delete a page from a report

// Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API)
report.deletePage("ReportSection145");
getActivePage()

Gets the active report page.

report.getActivePage()
 .then(activePage => {
     ...
 });
getFilters()

Gets filters that are applied at the report level.

// Get filters applied at report level
report.getFilters()
  .then(filters => {
    ...
  });
getId()

Gets the report ID from the first available location: options, attribute, embed url.

getPageByName(string)

Gets a report page by its name.

report.getPageByName(pageName)
 .then(page => {
     ...
 });
getPages()

Gets the list of pages within the report.

report.getPages()
 .then(pages => {
     ...
 });
getTheme()

get the theme of the report

report.getTheme();
getZoom()

Return the current zoom level of the report.

isSaved()

checks if the report is saved.

report.isSaved()
moveVisual(string, string, number, number, number)

Updates the position of a visual in a page.

report.moveVisual(pageName, visualName, x, y, z)
  .catch(error => { ... });
print()

Prints the active page of the report by invoking window.print() on the embed iframe component.

refresh()

Refreshes data sources for the report.

report.refresh();
removeContextMenuCommand(string, string)

Remove context menu extension command.

report.removeContextMenuCommand(commandName, contextMenuTitle)
 .catch(error => {
     ...
 });
removeFilters()

Removes all filters at the report level.

report.removeFilters();
removeOptionsMenuCommand(string, string)

Remove options menu extension command.

report.removeOptionsMenuCommand(commandName, optionsMenuTitle)
 .then({
     ...
 });
renamePage(string, string)

Rename a page from a report

// Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API)
report.renamePage("ReportSection145", "Sales");
render(IReportEmbedConfiguration | IReportLoadConfiguration)

Render a preloaded report, using phased embedding API

// Load report
var report = powerbi.load(element, config);

...

// Render report
report.render()
resetPersistentFilters()

Reset user's filters, slicers, and other data view changes to the default state of the report

report.resetPersistentFilters();
resetTheme()

Reset and apply the default theme of the report

report.resetTheme();
resizeActivePage(PageSizeType, number, number)

Updates the size of active page in report.

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

Resize a visual in a page.

report.resizeVisual(pageName, visualName, width, height)
  .catch(error => { ... });
savePersistentFilters()

Save user's filters, slicers, and other data view changes of the report

report.savePersistentFilters();
setFilters(IFilter[])

Sets filters at the report level.

const filters: [
   ...
];

report.setFilters(filters)
 .catch(errors => {
   ...
 });
setPage(string)

Sets the active page of the report.

report.setPage("page2")
 .catch(error => { ... });
setVisualDisplayState(string, string, VisualContainerDisplayMode)

Updates the display state of a visual in a page.

report.setVisualDisplayState(pageName, visualName, displayState)
  .catch(error => { ... });
setZoom(number)

Sets the report's zoom level.

switchLayout(LayoutType)

Updates the report layout

report.switchLayout(layoutType);
switchMode(string | ViewMode)

Switch Report view mode.

updateFilters(FiltersOperations, IFilter[])

Update the filters at the report level according to the operation: Add, replace all, replace by target or remove.

report.updateFilters(FiltersOperations.Add, filters)
  .catch(errors => { ... });
updateSettings(ISettings)

Updates visibility settings for the filter pane and the page navigation pane.

const newSettings = {
  panes: {
    filters: {
      visible: false
    }
  }
};

report.updateSettings(newSettings)
  .catch(error => { ... });

Inherited Methods

exitFullscreen()

Requests the browser to exit fullscreen mode.

fullscreen()

Requests the browser to render the component's iframe in fullscreen mode.

getCorrelationId()

Get the correlationId for the current embed session.

// Get the correlationId for the current embed session
report.getCorrelationId()
  .then(correlationId => {
    ...
  });
off<T>(string, IEventHandler<T>)

Removes one or more event handlers from the list of handlers. If a reference to the existing handle function is specified, remove the specific handler. If the handler is not specified, remove all handlers for the event name specified.

report.off('pageChanged')

or

const logHandler = function (event) {
   console.log(event);
};

report.off('pageChanged', logHandler);
on<T>(string, IEventHandler<T>)

Adds an event handler for a specific event.

report.on('pageChanged', (event) => {
  console.log('PageChanged: ', event.page.name);
});
reload()

Reloads embed using existing configuration. E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state.

report.reload();
removeComponentTabIndex(number)

Removes element's tabindex attribute

save()

Saves Report.

saveAs(ISaveAsParameters)

SaveAs Report.

setAccessToken(string)

Set accessToken.

setComponentTabIndex(number)

Sets element's tabindex attribute

setComponentTitle(string)

Set the component title for accessibility. In case of iframes, this method will change the iframe title.

Property Details

bookmarksManager

bookmarksManager: BookmarksManager

Property Value

Method Details

addContextMenuCommand(string, string, string, MenuLocation, string, string, string)

Add context menu extension command.

report.addContextMenuCommand(commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName)
 .catch(error => {
     ...
 });
function addContextMenuCommand(commandName: string, commandTitle: string, contextMenuTitle: string, menuLocation: MenuLocation, visualName: string, visualType: string, groupName?: string): Promise<IHttpPostMessageResponse<void>>

Parameters

commandName

string

commandTitle

string

contextMenuTitle

string

menuLocation
MenuLocation
visualName

string

visualType

string

groupName

string

Returns

Promise<IHttpPostMessageResponse<void>>

addOptionsMenuCommand(string, string, string, MenuLocation, string, string, string, string)

Add options menu extension command.

report.addOptionsMenuCommand(commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon)
 .catch(error => {
     ...
 });
function addOptionsMenuCommand(commandName: string, commandTitle: string, optionsMenuTitle?: string, menuLocation?: MenuLocation, visualName?: string, visualType?: string, groupName?: string, commandIcon?: string): Promise<IHttpPostMessageResponse<void>>

Parameters

commandName

string

commandTitle

string

optionsMenuTitle

string

menuLocation
MenuLocation
visualName

string

visualType

string

groupName

string

commandIcon

string

Returns

Promise<IHttpPostMessageResponse<void>>

addPage(string)

Add an empty page to the report

// Add a page to the report with "Sales" as the page display name
report.addPage("Sales");
function addPage(displayName?: string): Promise<Page>

Parameters

displayName

string

Returns

Promise<Page>

applyTheme(IReportTheme)

Apply a theme to the report

report.applyTheme(theme);
function applyTheme(theme: IReportTheme): Promise<void>

Parameters

theme
IReportTheme

Returns

Promise<void>

arePersistentFiltersApplied()

Returns if there are user's filters, slicers, or other data view changes applied on the report. If persistent filters is disable, returns false.

report.arePersistentFiltersApplied();
function arePersistentFiltersApplied(): Promise<boolean>

Returns

Promise<boolean>

clearSelectedVisuals(boolean)

Clears selected not popped out visuals, if flag is passed, all visuals selections will be cleared.

report.clearSelectedVisuals()
 .then(() => {
     ...
 });
function clearSelectedVisuals(clearPopOutState?: boolean): Promise<void>

Parameters

clearPopOutState

boolean

If false / undefined visuals selection will not be cleared if one of visuals is in popped out state (in focus, show as table, spotlight...)

Returns

Promise<void>

closeAllOverlays()

Closes all open context menus and tooltips.

report.closeAllOverlays()
 .then(() => {
     ...
 });
function closeAllOverlays(): Promise<void>

Returns

Promise<void>

configChanged(boolean)

Handle config changes.

function configChanged(isBootstrap: boolean)

Parameters

isBootstrap

boolean

deletePage(string)

Delete a page from a report

// Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API)
report.deletePage("ReportSection145");
function deletePage(pageName: string): Promise<void>

Parameters

pageName

string

Returns

Promise<void>

getActivePage()

Gets the active report page.

report.getActivePage()
 .then(activePage => {
     ...
 });
function getActivePage(): Promise<Page>

Returns

Promise<Page>

getFilters()

Gets filters that are applied at the report level.

// Get filters applied at report level
report.getFilters()
  .then(filters => {
    ...
  });
function getFilters(): Promise<IFilter[]>

Returns

Promise<IFilter[]>

getId()

Gets the report ID from the first available location: options, attribute, embed url.

function getId(): string

Returns

string

getPageByName(string)

Gets a report page by its name.

report.getPageByName(pageName)
 .then(page => {
     ...
 });
function getPageByName(pageName: string): Promise<Page>

Parameters

pageName

string

Returns

Promise<Page>

getPages()

Gets the list of pages within the report.

report.getPages()
 .then(pages => {
     ...
 });
function getPages(): Promise<Page[]>

Returns

Promise<Page[]>

getTheme()

get the theme of the report

report.getTheme();
function getTheme(): Promise<IReportTheme>

Returns

Promise<IReportTheme>

getZoom()

Return the current zoom level of the report.

function getZoom(): Promise<number>

Returns

Promise<number>

isSaved()

checks if the report is saved.

report.isSaved()
function isSaved(): Promise<boolean>

Returns

Promise<boolean>

moveVisual(string, string, number, number, number)

Updates the position of a visual in a page.

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

Parameters

pageName

string

visualName

string

x

number

y

number

z

number

Returns

Promise<IHttpPostMessageResponse<void>>

print()

Prints the active page of the report by invoking window.print() on the embed iframe component.

function print(): Promise<void>

Returns

Promise<void>

refresh()

Refreshes data sources for the report.

report.refresh();
function refresh(): Promise<void>

Returns

Promise<void>

removeContextMenuCommand(string, string)

Remove context menu extension command.

report.removeContextMenuCommand(commandName, contextMenuTitle)
 .catch(error => {
     ...
 });
function removeContextMenuCommand(commandName: string, contextMenuTitle: string): Promise<IHttpPostMessageResponse<void>>

Parameters

commandName

string

contextMenuTitle

string

Returns

Promise<IHttpPostMessageResponse<void>>

removeFilters()

Removes all filters at the report level.

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

Returns

Promise<IHttpPostMessageResponse<void>>

removeOptionsMenuCommand(string, string)

Remove options menu extension command.

report.removeOptionsMenuCommand(commandName, optionsMenuTitle)
 .then({
     ...
 });
function removeOptionsMenuCommand(commandName: string, optionsMenuTitle: string): Promise<IHttpPostMessageResponse<void>>

Parameters

commandName

string

optionsMenuTitle

string

Returns

Promise<IHttpPostMessageResponse<void>>

renamePage(string, string)

Rename a page from a report

// Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API)
report.renamePage("ReportSection145", "Sales");
function renamePage(pageName: string, displayName: string): Promise<void>

Parameters

pageName

string

displayName

string

Returns

Promise<void>

render(IReportEmbedConfiguration | IReportLoadConfiguration)

Render a preloaded report, using phased embedding API

// Load report
var report = powerbi.load(element, config);

...

// Render report
report.render()
function render(config?: IReportEmbedConfiguration | IReportLoadConfiguration): Promise<void>

Parameters

Returns

Promise<void>

resetPersistentFilters()

Reset user's filters, slicers, and other data view changes to the default state of the report

report.resetPersistentFilters();
function resetPersistentFilters(): Promise<IHttpPostMessageResponse<void>>

Returns

Promise<IHttpPostMessageResponse<void>>

resetTheme()

Reset and apply the default theme of the report

report.resetTheme();
function resetTheme(): Promise<void>

Returns

Promise<void>

resizeActivePage(PageSizeType, number, number)

Updates the size of active page in report.

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

Parameters

pageSizeType
PageSizeType
width

number

height

number

Returns

Promise<IHttpPostMessageResponse<void>>

resizeVisual(string, string, number, number)

Resize a visual in a page.

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

Parameters

pageName

string

visualName

string

width

number

height

number

Returns

Promise<IHttpPostMessageResponse<void>>

savePersistentFilters()

Save user's filters, slicers, and other data view changes of the report

report.savePersistentFilters();
function savePersistentFilters(): Promise<IHttpPostMessageResponse<void>>

Returns

Promise<IHttpPostMessageResponse<void>>

setFilters(IFilter[])

Sets filters at the report level.

const filters: [
   ...
];

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

Parameters

filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>

setPage(string)

Sets the active page of the report.

report.setPage("page2")
 .catch(error => { ... });
function setPage(pageName: string): Promise<IHttpPostMessageResponse<void>>

Parameters

pageName

string

Returns

Promise<IHttpPostMessageResponse<void>>

setVisualDisplayState(string, string, VisualContainerDisplayMode)

Updates the display state of a visual in a page.

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

Parameters

pageName

string

visualName

string

Returns

Promise<IHttpPostMessageResponse<void>>

setZoom(number)

Sets the report's zoom level.

function setZoom(zoomLevel: number): Promise<void>

Parameters

zoomLevel

number

zoom level to set

Returns

Promise<void>

switchLayout(LayoutType)

Updates the report layout

report.switchLayout(layoutType);
function switchLayout(layoutType: LayoutType): Promise<IHttpPostMessageResponse<void>>

Parameters

layoutType
LayoutType

Returns

Promise<IHttpPostMessageResponse<void>>

switchMode(string | ViewMode)

Switch Report view mode.

function switchMode(viewMode: string | ViewMode): Promise<void>

Parameters

viewMode

string | ViewMode

Returns

Promise<void>

updateFilters(FiltersOperations, IFilter[])

Update the filters at the report level according to the operation: Add, replace all, replace by target or remove.

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

Parameters

operation
FiltersOperations
filters

IFilter[]

Returns

Promise<IHttpPostMessageResponse<void>>

updateSettings(ISettings)

Updates visibility settings for the filter pane and the page navigation pane.

const newSettings = {
  panes: {
    filters: {
      visible: false
    }
  }
};

report.updateSettings(newSettings)
  .catch(error => { ... });
function updateSettings(settings: ISettings): Promise<IHttpPostMessageResponse<void>>

Parameters

settings
ISettings

Returns

Promise<IHttpPostMessageResponse<void>>

Inherited Method Details

exitFullscreen()

Requests the browser to exit fullscreen mode.

function exitFullscreen()

Inherited From Embed.exitFullscreen

fullscreen()

Requests the browser to render the component's iframe in fullscreen mode.

function fullscreen()

Inherited From Embed.fullscreen

getCorrelationId()

Get the correlationId for the current embed session.

// Get the correlationId for the current embed session
report.getCorrelationId()
  .then(correlationId => {
    ...
  });
function getCorrelationId(): Promise<string>

Returns

Promise<string>

Inherited From Embed.getCorrelationId

off<T>(string, IEventHandler<T>)

Removes one or more event handlers from the list of handlers. If a reference to the existing handle function is specified, remove the specific handler. If the handler is not specified, remove all handlers for the event name specified.

report.off('pageChanged')

or

const logHandler = function (event) {
   console.log(event);
};

report.off('pageChanged', logHandler);
function off<T>(eventName: string, handler?: IEventHandler<T>)

Parameters

eventName

string

handler

IEventHandler<T>

Inherited From Embed.off

on<T>(string, IEventHandler<T>)

Adds an event handler for a specific event.

report.on('pageChanged', (event) => {
  console.log('PageChanged: ', event.page.name);
});
function on<T>(eventName: string, handler: IEventHandler<T>)

Parameters

eventName

string

handler

IEventHandler<T>

Inherited From Embed.on

reload()

Reloads embed using existing configuration. E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state.

report.reload();
function reload(): Promise<void>

Returns

Promise<void>

Inherited From Embed.reload

removeComponentTabIndex(number)

Removes element's tabindex attribute

function removeComponentTabIndex(_tabIndex?: number)

Parameters

_tabIndex

number

Inherited From Embed.removeComponentTabIndex

save()

Saves Report.

function save(): Promise<void>

Returns

Promise<void>

Inherited From Embed.save

saveAs(ISaveAsParameters)

SaveAs Report.

function saveAs(saveAsParameters: ISaveAsParameters): Promise<void>

Parameters

saveAsParameters
ISaveAsParameters

Returns

Promise<void>

Inherited From Embed.saveAs

setAccessToken(string)

Set accessToken.

function setAccessToken(accessToken: string): Promise<void>

Parameters

accessToken

string

Returns

Promise<void>

Inherited From Embed.setAccessToken

setComponentTabIndex(number)

Sets element's tabindex attribute

function setComponentTabIndex(tabIndex?: number)

Parameters

tabIndex

number

Inherited From Embed.setComponentTabIndex

setComponentTitle(string)

Set the component title for accessibility. In case of iframes, this method will change the iframe title.

function setComponentTitle(title: string)

Parameters

title

string

Inherited From Embed.setComponentTitle