【问题标题】:Power BI Custom theme file is not getting applied with AngularPower BI 自定义主题文件未与 Angular 一起应用
【发布时间】:2021-07-14 12:02:59
【问题描述】:

我们正在使用 pbi-client 在我们的 Angular 应用程序中嵌入 pbi 报告。我们正在传递带有嵌入配置的自定义主题文件,并尝试将其应用于 pbi 报告加载。似乎自定义主题文件没有覆盖 pbi 的默认主题。请找到以下代码:

  1. 带有嵌入配置的主题文件:

const embedConfig = { 类型:'报告', embedUrl: embedUrl + '?' + 'xxxxId=' + xxxxId + '&yyyyId=' + yyyyId, accessToken: embedToken, 权限:models.Permissions.All, 令牌类型:models.TokenType.Embed, 主题:{themeJson:powerbiTheme}, 视图模式:models.ViewMode.View }; 2. 报告加载后的主题文件: self.report.applyTheme({theme:powerbiTheme});

【问题讨论】:

    标签: javascript angular powerbi powerbi-embedded


    【解决方案1】:

    请按照以下代码 sn-ps 将自定义主题应用于 Power BI 报告:

    • 使用 embedConfig 应用主题:
      1. 导入自定义主题文件如下:
      const theme = require("../custom-theme.json");
      
      1. 将主题分配给 embedConfig 对象中 theme 属性的 themeJson 属性:
      embedConfig: IReportEmbedConfiguration = {
        type: "report",
        embedUrl: "EMBED URL",
        tokenType: models.TokenType.Embed,
        accessToken: "ACCESS TOKEN",
        settings: "SETTINGS",
        theme: {
            themeJson: theme
        }
      };
      
      
    • 要在报告加载后应用主题,请使用:
      1. 导入自定义主题文件如下:
      const theme = require("../custom-theme.json");
      
      1. 任何方法:
      self.report.applyTheme({ themeJson: theme });
      

    请参考文档: https://docs.microsoft.com/javascript/api/overview/powerbi/apply-report-themes

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-02
      • 1970-01-01
      • 2020-05-20
      • 2020-06-14
      相关资源
      最近更新 更多