Add, delete or rename a report page

You can use page operation APIs to add or delete a page from a report during a Power BI embedded analytics session.

Add a page

To add a new page to the current report, use the addPage method of the Power BI Client Report class:

addPage(displayName?: string): Promise<Page>
  • displayName sets the display name for the new page. If not specified, the display name is set to Page#<NUM>.
  • The function returns a Page instance of the new page.

For example, add a page with the display name Sales to the current report:

let newPage = await report.addPage("Sales");

Delete a page

To delete a page from a report, you can use the deletePage method of the Report class, or the delete method of the Page class, depending on context. The return value resolves after the page is deleted.

Delete a page using a Report instance

To delete a page from a report by using a Report instance:

deletePage(pageName: string): Promise<void>

pageName is a unique identifier that's different from the displayName. You can use the report.getPages API to get the pageName.

For example, delete a page with the name ReportSection123:

await report.deletePage("ReportSection123");

ReportSection123 is the pageName the getPages API returned for the Sales page

Delete a page using a Page instance

To delete a page from a report by using a Page instance:

delete(): Promise<void>

For example:

newPage.delete();

Rename a page

To rename a page on a report, you can use the renamePage method of the Report class, or the setDisplayName method of the Page class, depending on context. The return value resolves after the page is renamed.

Rename a page using a Report instance

To rename a page from a report by using the Report instance:

renamePage(pageName: string, displayName: string): Promise<void>

pageName is a unique identifier that's different from the displayName. You can use the report.getPages API to get the pageName.

For example, rename the page with the name ReportSection123 to New Sales:

report.renamePage("ReportSection123", "New Sales");

ReportSection123 is the pageName the getPages API returned for the Sales page.

Rename a page using a Page instance

To rename a page from a report by using the Page instance:

setDisplayName(displayName: string): Promise<void>

For example, rename the page to New Sales:

newPage.setDisplayName("New Sales");

Limitations

Page operations work only after the report is loaded.

Next steps