在 SharePoint Server 中使用 iFrame 內嵌 Power BI 報表伺服器 報表

在本文中,您將瞭解如何在 SharePoint 頁面中使用 iFrame 內嵌 Power BI 報表伺服器 報表。 如果您正在使用 SharePoint Online,則必須公開存取 Power BI 報表伺服器。 在 SharePoint Online 中,與 Power BI 服務 搭配運作的 Power BI 網頁元件不適用於 Power BI 報表伺服器。

iFrame sample

必要條件

建立 Power BI 報表 URL

  1. 從 GitHub 下載範例: 部落格示範。 選取 [Clone or download] \(複製或下載\),然後選取 [Download ZIP] \(下載 ZIP\)。

    Download sample PBIX file

  2. 將檔案解壓縮,然後在Power BI Desktop 中開啟範例 .pbix 檔案,以取得 Power BI 報表伺服器。

    PBI RS Desktop tool

  3. 將報表儲存至 Power BI 報表伺服器

    PBI RS Save

  4. 在 Power BI 報表伺服器 入口網站中檢視報表。

    Web portal

擷取 URL 參數

取得 URL 之後,您可以在 SharePoint 頁面中建立 iFrame 來裝載報表。 針對任何 Power BI 報表伺服器 報表 URL,新增下列查詢字串參數,以在 SharePoint iFrame 中內嵌報表:?rs:embed=true

例如: https://myserver/reports/powerbi/Sales?rs:embed=true

在 SharePoint iFrame 中內嵌報表

  1. 流覽至 SharePoint 網站內容 頁面。

    Site Contents page

  2. 選擇您要新增報表的頁面。

    Site Contents page app

  3. 選取右上方的齒輪圖示,然後選取 [ 編輯] 頁面

    Edit page option

  4. 選取 [新增網頁元件]。

  5. 在 [類別] 底下,選取 [媒體和內容]。 在 [元件] 底下,選取 [內容編輯器],然後選取 [新增]。

    Select Content Editor Web Part

  6. 選取 [按兩下這裡] 以新增內容

  7. 從頂端功能表中,選取 [ 格式化文字],然後選取 [ 編輯來源]。

    Edit Source

  8. 在 [ 編輯來源] 視窗中,將 iFrame 程式代碼貼到 HTML 來源中,然後選取 [ 確定]。

    iFrame code

    例如:

    <iframe width="800" height="600" src="https://myserver/reports/powerbi/Sales?rs:embed=true" frameborder="0" allowFullScreen="true"></iframe>
    
  9. 在頂端功能表中,選取 [頁面],然後選取 [ 停止編輯]。

    Stop Editing

    報表會出現在頁面上。

    iFrame sample

更多問題嗎? 請嘗試 Power BI 社群