Power BI 的 [發行至 Web]Publish to web from Power BI


透過 Power BI 的 [發佈至 Web] 選項,您可以輕鬆地使用任何裝置,線上內嵌互動式 Power BI 視覺效果,例如內嵌至部落格文章、網站,或透過電子郵件、社交媒體傳送。With Power BI's Publish to web option, you can easily embed interactive Power BI visualizations online, such as in blog posts, websites, through emails or social media, from any device. 您也可以輕鬆編輯、更新、重新整理或取消共用已發佈的視覺效果。You can also easily edit, update, refresh, or unshare your published visuals.


使用 [發佈至 Web] 時,網際網路上的任何人都可以檢視您發佈的報表或視覺效果。When you use Publish to web, anyone on the Internet can view your published report or visual. 這不需要驗證,且包括檢視報表彙總的詳細資料等級資料。This requires no authentication and includes viewing detail level data your reports aggregate. 發佈此報表之前,請確定您可以公開分享資料及視覺效果。Before publishing a report, make sure it is okay for you to share the data and visualizations publicly. 請勿發行機密或專屬資訊。Do not publish confidential or proprietary information. 如有疑問,請先核查貴組織的原則再發行。If in doubt, check your organization's policies before publishing.


若要安全地將您的內容內嵌在內部入口網站或網站,請使用內嵌內嵌於 SharePoint Online 中選項。To embed your content securely in an internal portal or website, use the Embed or Embed in SharePoint Online options. 這可確保當您的使用者檢視您的內部資料時,所有權限與資料安全性都強制受保護。This ensures all permissions and data security is enforced when your users are viewing your internal data.

如何使用 [發佈至網路]How to use Publish to Web

您可以在個人和群組工作區中可編輯的報表使用 [發佈至 Web] 功能。Publish to web is available for reports you can edit in your personal and group workspaces. 它不適用於與您共用的報表,也不適用於依賴資料列層級安全性來保護資料的報表。It isn't available for reports shared with you, or ones relying on row level security to secure data. 請參閱下面的<限制> 一節以取得不支援 [發佈至 Web] 的完整案例清單。See the Limitations section below for a complete list of cases where Publish to web isn't supported. 使用 [發佈至 Wb] 之前,請先檢閱本文中稍早的<警告> 。Review the Warning earlier in this article before using Publish to web.

下列短片會顯示這項功能的運作方式。The following short video shows how this feature works. 然後,請在下列步驟中親自試試看。Then, try it yourself in the steps below.

下列步驟說明如何使用 [ 發佈至網路]。The following steps describe how to use Publish to web.

  1. 在工作區中開啟您可以編輯的報表,然後選取 [檔案] > [發佈至 Web] 。Open a report in your workspace that you can edit and select File > Publish to web.


  2. 檢閱對話方塊內容,並選取 [建立內嵌程式碼] 。Review the dialog content and select Create embed code.


  3. 檢閱以下所顯示的警告,並確認資料是否可以內嵌在公開網站上。Review the warning, as shown here, and confirm that the data is okay to embed in a public website. 如果可以,請選取 [發佈] 。If it is, select Publish.


  4. 隨即顯示內含連結的對話方塊。A dialog appears with a link. 您可以使用電子郵件來傳送此連結、將它內嵌在 iFrame 之類的程式碼中,或將它直接貼到網頁或部落格。You can send this link in an email, embed it in code such as an iFrame, or paste it directly into a web page or blog.


  5. 如果您之前建立了報表的內嵌程式碼,並選取 [發佈至 Web] ,則不會看到步驟 2-4 中的對話方塊。If you previously created an embed code for a report and you select Publish to web, you won't see the dialogs in steps 2-4. 而是隨即顯示 [內嵌程式碼] 對話方塊:Instead, the Embed code dialog appears:


    每個報表只能建立一個內嵌程式碼。You can only create one embed code for each report.

檢視模式的祕訣和訣竅Tips and tricks for view modes

在部落格文章中內嵌內容時,通常需要符合特定畫面大小。When you embed content within a blog post, you typically need to fit it within a specific screen size. 您可以視需要調整 iFrame 標籤中的高度和寬度。You can adjust the height and the width in the iFrame tag as needed. 不過,您必須確保報表符合指定的 iFrame 區域大小,因此您也需要在編輯報表時設定適當的檢視模式。However, you need to ensure your report fits within the given iFrame area, so you also need to set an appropriate View Mode when editing the report.

下表提供檢視模式的相關指南,以及內嵌後的顯示方式。The following table provides guidance about the View Mode, and how it will appear when embedded.

檢視模式View Mode 內嵌時的外觀How it looks when embedded
PtW6b [符合一頁大小] 會遵循報表頁面的高度與寬度。Fit to page respects your report's page height and width. 如果頁面設定為 16:9 或 4:3 之類的「動態」 外觀比例,您的內容就會調整成適合 iFrame 大小。If you set your page to dynamic ratios like 16:9 or 4:3 your content will scale to fit within the iFrame. 當內嵌在 iFrame 中時,使用 [符合一頁大小] 會造成「上下黑邊」 ,當內容調整成符合 iFrame 大小後,iFrame 區域會出現灰色背景。When embedded in an iFrame, using Fit to page can result in letterboxing, where a gray background is shown in iFrame areas after the content is scaled to fit within the iFrame. 若要將上下黑邊縮到最小,請正確設定 iFrame 的高度及寬度。To minimize letterboxing, set your iFrame's height and width appropriately.
PtW6d [實際大小] 可確保報表維持您在報表頁面上設定的大小。Actual size ensures the report preserves its size as set on the report page. 這會導致 iFrame 中出現捲軸。This can result in scrollbars appearing in your iFrame. 設定 iFrame 的高度和寬度以避免出現捲軸。Set the iFrame height and width to avoid scrollbars.
PtW6c [符合寬度] 可確保內容符合 iFrame 的水平寬度。Fit to width ensures the content fits within the iFrame's horizontal area. 框線仍會顯示,但是內容會調整為使用所有的可用水平空間。A border is still shown, but the content scales to use all the horizontal space available.

iFrame 高度和寬度的秘訣和訣竅Tips and tricks for iFrame height and width

[發佈至 Web] 內嵌程式碼看起來如下所示:A Publish to web embed code looks like the following:


您可以手動編輯寬度與高度,以確保其大小適合您在其中內嵌它的頁面。You can edit the width and height manually to ensure it's precisely how you want it to fit in the page where you're embedding it.

若要達到更理想的符合狀態,您可以嘗試在 iFrame 的高度中新增 56 個像素,以配合下方列的目前大小。To achieve a more perfect fit, you can try adding 56 pixels to the iFrame's height to accommodate the current size of the bottom bar. 如果報表頁面使用動態大小,下表提供一些您可以使用而不會出現上下黑邊的大小。If your report page uses the dynamic size, the table below provides some sizes you can use to achieve a fit without letterboxing.

外觀比例Ratio 大小Size 尺寸 (寬度 x 高度)Dimension (Width x Height)
16:916:9 Small 640 x 416 像素640 x 416 px
16:916:9 Medium 800 x 506 像素800 x 506 px
16:916:9 Large 960 x 596 像素960 x 596 px
4:34:3 Small 640 x 536 像素640 x 536 px
4:34:3 Medium 800 x 656 像素800 x 656 px
4:34:3 Large 960 x 776 像素960 x 776 px

管理內嵌程式碼Manage embed codes

建立 [發佈至 Web] 內嵌程式碼後,您可以從 Power BI 的 [設定] 功能表管理您的程式碼。Once you create a Publish to web embed code, you can manage your codes from the Settings menu in Power BI. 管理內嵌程式碼時,可以移除目標視覺效果、回報程式碼 (會導致內嵌程式碼無法使用) 或取得內嵌程式碼。Managing embed codes includes the ability to remove the destination visual or report for a code (rendering the embed code unusable), or getting the embed code.

  1. 若要管理您的 [發行到 Web] 內嵌程式碼,請開啟 [設定] 齒輪,然後選取 [管理內嵌程式碼] 。To manage your Publish to web embed codes, open the Settings gear and select Manage embed codes.


  2. 您的內嵌程式碼隨即出現。Your embed codes appear.


  3. 您可以擷取或刪除內嵌程式碼。You can either retrieve or delete an embed code. 刪除它會停用該報表或視覺效果的任何連結。Deleting it disables any links to that report or visual.


  4. 如果您選取 [刪除] ,系統會要求您進行確認。If you select Delete, you’re asked for a confirmation.


報表更新和資料重新整理Updates to reports, and data refresh

建立 [發佈至 Web] 內嵌程式碼並加以共用後,報表將依據您進行的任何變更更新,而內嵌程式碼連結則會立即啟用。After you create your Publish to web embed code and share it, the report is updated with any changes you make, and the embed code link is immediately active. 開啟連結的任何人都可以進行檢視。Anyone who opens the link can view it. 不過,在這個初始動作之後,報表或視覺效果的更新可能需要大約一小時,才能讓您的使用者看見。After this initial action, however, updates to reports or visuals can take approximately one hour before becoming visible to your users. 如果需要立即可用的更新,您可以刪除內嵌程式碼,並建立新的內嵌程式碼。If you need your updates to be immediately available, you can delete the embed code and create a new one. 若要深入了解,請參閱本文稍後的運作方式一節。To learn more, see the How it works section later in this article.

資料重新整理Data refresh

資料重新整理會自動反映在您的內嵌報表或視覺效果中。Data refreshes are automatically reflected in your embedded report or visual. 大約需要 1 小時,重新整理的資料才會顯示在內嵌程式碼中。It can take approximately one hour for refreshed data to be visible from embed codes. 若要停用自動重新整理,請在報表使用的資料集排程上選取 [不重新整理] 。To disable automatic refresh, select don't refresh on the schedule for the dataset the report uses.

自訂視覺效果Custom visuals

[ 發佈至網路] 支援自訂視覺效果。Custom visuals are supported in Publish to web. 使用 [發佈至 Web] 時,與您共用已發佈視覺效果的使用者不需要啟用自訂視覺效果,即可檢視報表。When you use Publish to web, users with whom you share your published visual do not need to enable custom visuals to view the report.


[發佈至 Web] 支援絕大部分資料來源和 Power BI 服務中的報表,但 [發佈至 Web] 目前不支援或無法使用下列報表:Publish to web is supported for the vast majority of data sources and reports in the Power BI service, however, the following are not currently supported or available with Publish to web:

  • 使用資料列層級安全性的報表。Reports using row level security.
  • 使用任何即時連線資料來源的報表,包括裝載於內部部署 的 Analysis Services 表格式、Analysis Service 多維度和 Azure Analysis Services。Reports using any Live Connection data source, including Analysis Services Tabular hosted on-premises, Analysis Services Multidimensional, and Azure Analysis Services.
  • 直接或透過組織內容套件與您共用的報表。Reports shared to you directly or through an organizational content pack.
  • 位在您非屬編輯成員之群組中的報表。Reports in a group in which you are not an edit member.
  • [發佈至 Web] 報表目前不支援 "R" 視覺效果。"R" Visuals are not currently supported in Publish to web reports.
  • 從報表 (已發佈至 Web ) 中的視覺效果匯出資料。Exporting Data from visuals in a report, which has been published to the web.
  • ArcGIS Maps for Power BI 視覺效果。ArcGIS Maps for Power BI visuals.
  • 包含報表層級 DAX 量值的報表。Reports containing report-level DAX measures.
  • 單一登入資料查詢模型。Single sign-on data query models.
  • 安全的機密或專屬資訊Secure confidential or proprietary information.
  • 隨著 [內嵌] 選項提供的自動驗證功能無法搭配 Power BI JavaScript API 使用。The automatic authentication capability provided with the Embed option doesn't work with the Power BI JavaScript API. 針對 Power BI JavaScript API,請使用使用者擁有資料方式來內嵌。For the Power BI JavaScript API, use the user owns data approach to embedding. 深入了解使用者擁有資料Learn more about user owns data.

租用戶設定Tenant setting

Power BI 系統管理員可以啟用或停用 [發佈至 Web ] 功能。Power BI administrators can enable or disable the Publish to web feature. 他們也可以限制對特定群組的存取,這可能會影響您建立內嵌程式碼的能力。They can also restrict access to specific groups, which can impact your ability to create an embed code.

特徵Feature 允許整個組織使用Enabled for entire organization 不允許整個組織使用Disabled for entire organization 特定安全性群組Specific security groups
報告 [檔案] 功能表下的 [發佈至 Web] Publish to web under report's File menu 針對全部啟用Enabled for all 並非所有人都可看到Not visible for all 只有經授權的使用者或群組才可看到。Only visible for authorized users or groups.
[設定] 下的 [管理內嵌程式碼] Manage embed codes under Settings 針對全部啟用Enabled for all 針對全部啟用Enabled for all 針對全部啟用。Enabled for all.

[刪除]* 選項僅適用於經授權的使用者或群組。* Delete option only for authorized users or groups.
針對全部啟用 [取得驗證碼]* 。* Get codes enabled for all.
系統管理員入口網站內的 [內嵌程式碼] Embed codes within admin portal 狀態會反映下列其中一項:Status will reflect one of the following:
* 使用中* Active
* 不支援* Not supported
* 已封鎖* Blocked
狀態會顯示 [已停用] Status will display Disabled 狀態會反映下列其中一項:Status will reflect one of the following:
* 使用中* Active
* 不支援* Not supported
* 已封鎖* Blocked

如果使用者未以租用戶設定作為基礎加以授權,狀態會顯示成 [侵害] 。If a user is not authorized based on the tenant setting, status will display as infringed.
現有的已發佈報告Existing published reports 全部已啟用All enabled 全部已停用All disabled 報告會繼續針對全部項目呈現。Reports continue to render for all.

了解內嵌程式碼狀態欄Understanding the embed code status column

[管理內嵌程式碼] 頁面包含狀態資料行。The Manage embed codes page includes a status column. 根據預設,內嵌程式碼都是 [使用中] ,但也可以是下列其中一種狀態。By default, embed codes are Active, but could also be one of the statuses listed below.

狀態Status 描述Description
使用中Active 網際網路使用者可以檢視報表並與其互動。The report is available for Internet users to view and interact with.
封鎖Blocked 報表內容違反 Power BI 服務條款The report content violates the Power BI Terms of Service. Microsoft 已予以封鎖。Microsoft has blocked it. 如果您認為內容遭到不當封鎖,請連絡支援人員。Contact support if you believe the content was blocked in error.
不支援Not supported 報表的資料集使用資料列層級安全性或其他不受支援的設定。The report's data set is using row level security, or another unsupported configuration. 如需完整清單,請參閱限制一節。See the Limitations section for a complete list.
[侵害] Infringed 內嵌程式碼不屬於定義的租用戶原則。The embed code is outside the defined tenant policy. 當內嵌程式碼建立,且 [發佈至 Web] 租用戶設定變更為排除擁有內嵌程式碼的使用者時,通常就會發生這個情況。This typically occurs when an embed code was created and then the Publish to web tenant setting was changed to exclude the user owning the embed code. 如果已停用租用戶設定,或不再允許使用者建立內嵌程式碼,現有的內嵌程式碼就會顯示 [侵害] 狀態。If the tenant setting is disabled, or the user is no longer allowed to create embed codes, existing embed codes show an Infringed status.

如何回報 [發佈至網路] 內容的相關問題How to report a concern with Publish to web content

若要回報與內嵌在網站或部落格的 [發佈至 Web] 內容相關的問題,請使用下方列的旗標圖示,如下圖所示。To report a concern related to Publish to web content embedded in a website or blog, use the Flag icon in the bottom bar, as shown in the following image. 系統會要求您傳送電子郵件給 Microsoft 來說明您的問題。You’ll be asked to send an email to Microsoft explaining your concern. Microsoft 會根據「Power BI 服務條款」來評估內容,並採取適當行動。Microsoft will evaluate the content based on the Power BI Terms of Service and take appropriate action.

若要回報問題,請選取您在 [發佈至 Web] 報表下方列上看到的旗標圖示。To report a concern, select the flag icon in the bottom bar of the Publish to web report you see.


授權和定價Licensing and Pricing

您必須是 Microsoft Power BI 使用者才能使用 [ 發佈至網路]。You need to be a Microsoft Power BI user to use Publish to web. 您的報表檢視人員不需要是 Power BI 使用者。Your report's viewers do not need to be Power BI users.

運作方式 (技術性詳細資料)How it works (technical details)

使用 [發佈至 Web] 建立內嵌程式碼後,任何網際網路使用者都可以檢視報表。When you create an embed code using Publish to web, the report is made visible to Internet users. 報表可以公開取得,因此,您可以預期檢視人員日後透過社交媒體輕鬆共用報表。It’s publicly available, so you can expect viewers to easily share the report through social media in the future. 使用者直接開啟公用 URL 或在內嵌的網頁或部落格中檢視報表時,Power BI 會快取報表定義和檢視報表所需的查詢結果。As users view the report, either by opening the direct public URL or viewing it embedded in a web page or blog, Power BI caches the report definition and the results of the queries required to view the report. 這可確保數千名並行使用者能夠檢視報表,而不會影響效能。This ensures that thousands of concurrent users can view the report without impacting performance.

系統會長時間保留快取,所以如果您更新報表定義 (例如變更檢視模式),或重新整理報表資料,系統需要大約一小時,才會在使用者檢視的報表版本上反映變更。The cache is long-lived, so if you update the report definition (for example, if you change its View mode) or refresh the report data, it can take approximately one hour before changes are reflected in the version of the report your users view. 因此建議您預先準備要進行的工作,並且只在對設定滿意後再建立 [ 發佈至網路 ] 內嵌程式碼。It is therefore recommended that you stage your work ahead of time, and create the Publish to web embed code only when you’re satisfied with the settings.

後續步驟Next steps

有其他問題嗎?More questions? 試試 Power BI 社群Try the Power BI Community