如何确定 Power BI 报表的嵌入宽度和高度 [英] How to determine a Power BI report's width and height for embedding
问题描述
我正在尝试将 Power BI 报表嵌入到网页的 iFrame 中.我有一个从 Power BI Rest API 收集的报告列表,并且我想将报告动态加载到同一页面上的 iFrame 中.
I am trying to embed a Power BI report into an iFrame in a web page. I have a list of reports gathered from the Power BI Rest API, and I would like to dynamically load the reports into an iFrame on the same page.
唯一的问题是,我似乎找不到计算报告宽度和高度的方法.
Only problem is, I can't seem to find a way to figure out the report's width and height.
我有一个固定的框架,所以我想以某种方式计算所需的高度(尽管如果我能得到报告的尺寸/比率,我可以算出那部分).
I have a fixed with frame, so I'd like to calculate the needed height somehow (though if I can get the report dimensions / ratios I can figure that part out).
由于 javascript 跨域限制,加载后我无法访问 iFrame 内容高度.
I can't access the iFrame content height after load due to javascript cross-domain restrictions.
推荐答案
请尝试将以下代码添加到您的嵌入配置设置中
please try adding the code below to your embed config settings
settings: {
layoutType: models.LayoutType.Custom,
customLayout: {
displayOption: models.DisplayOption.FitToPage
}
我希望这会有所帮助.
这篇关于如何确定 Power BI 报表的嵌入宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!