Forum Discussion

nagarjunb's avatar
nagarjunb
Frequent Visitor
9 years ago

Fit to width usage in power bi embed

Hello,

Thanks for sharing the code. We are able to integrate the power bi reports in our Angular 2 app. But, the problem is, we are seeing empty areas with in the iframe around the report. Is it possible to set viewPage property in the config settings as below. If so, how are we going to get the powerbi-client using window object in Angular 2, and use its models to set the pageView setting on the configuration . Below is not working for us(Source: https://microsoft.github.io/PowerBI-JavaScript/demo/code-demo/index.html - in edit mode.)

let models = window['powerbi-client'].models;
var config = {
type: 'report',
accessToken: this.pbiToken,
embedUrl: CONFIGURATION.baseUrls.PowerBIEmbedURL + this.ReportID,
id: this.ReportID,
pageName: this.PageName,
permissions: models.Permissions.All,
pageView: models.PageView.fitToWidth,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
}
};

Thanks.

3 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    nagarjunb wrote:

    Hello,

    Thanks for sharing the code. We are able to integrate the power bi reports in our Angular 2 app. But, the problem is, we are seeing empty areas with in the iframe around the report. Is it possible to set viewPage property in the config settings as below. If so, how are we going to get the powerbi-client using window object in Angular 2, and use its models to set the pageView setting on the configuration . Below is not working for us(Source: https://microsoft.github.io/PowerBI-JavaScript/demo/code-demo/index.html - in edit mode.)

    let models = window['powerbi-client'].models;
    var config = {
    type: 'report',
    accessToken: this.pbiToken,
    embedUrl: CONFIGURATION.baseUrls.PowerBIEmbedURL + this.ReportID,
    id: this.ReportID,
    pageName: this.PageName,
    permissions: models.Permissions.All,
    pageView: models.PageView.fitToWidth,
    settings: {
    filterPaneEnabled: false,
    navContentPaneEnabled: false
    }
    };

    Thanks.


    Could you share a snapshot for your description?

    By the way, page size can be customized in Power BI desktop before a report is published.

    • nagarjunb's avatar
      nagarjunb
      Frequent Visitor

      Hi Eric,

       

        Thanks for your reply. Below is the snap shot. We need our report to fill up the grey area around. Any help is appreciated.  We will try out setting the page size from desktop meanwhile. Thank you.

       

       

      Thanks,

      Nagarjun B

      • nagarjunb's avatar
        nagarjunb
        Frequent Visitor

         

        Hi Eric,

         

           We tried out applying fitToWidth in Desktop as below. With this it's occupying frame width perfectly. But, its showing up grey area in the top and bottom. Can you please suggest us any solution to address this as well. Thank you once again.

         

         

        Thanks,

        Nagarjun B