根据内容动态设置BIRT查看器的高度和宽度

时间:2017-01-04 12:06:21

标签: jsp birt

我使用BIRTData tables构建了一份报告。一切都按预期工作。但height的{​​{1}}和width不是动态的。它们是静态的,因此应用了滚动。所以我编写了一个代码,使BIRT viewerheight width动态化。

BIRT viewer

function resizeFrame(e,f){ var x = document.getElementsByTagName("iframe"); var winW = 1112, winH = 486; if (document.body && document.body.offsetWidth) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) { winW = document.documentElement.offsetWidth; winH = document.documentElement.offsetHeight; } if (window.innerWidth && window.innerHeight) { winW = window.innerWidth; winH = window.innerHeight; } x[0].style.width = winW + "px"; x[0].style.height = winH + "px"; console.log(f,e); }

BIRT code is:

请注意,BIRT查看器的高度和宽度分别为<birt:viewer id="birtViewer" reportDesign="/sampleReport.rptdesign" pattern="run" height="700" width="1136" scrolling="none" showParameterPage="false" isHostPage="false"> </birt:viewer> 700px。上面的代码并未使1136pxheight动态化 如何使BIRT高度和宽度动态?我添加了一张图片以便清楚理解。BIRT
正如您在图片中看到的那样,它正在添加垂直滚动。如何防止这种情况,并根据桌面高度增加BIRT的高度?

2 个答案:

答案 0 :(得分:1)

你能够触发你从报告中写的功能吗?我不这么认为。我会看看构建的代码&#39;查看器并运行报告。

构建并加载报表后,您可以触发javascript函数来调整窗口大小以适应其内容。 更多信息:http://www.eclipse.org/birt/documentation/integrating/viewer-usage.php

不确定为什么需要这个?打开全屏窗口是不是更容易?

答案 1 :(得分:0)

我建议使用百分比(%)的高度和宽度。

还计算窗口高度和宽度,并对外部div使用相同。

对于内部div使用高度和宽度100%,因此内部div将固定在外部div中并且滚动不会出现在屏幕上。

希望这会对你有所帮助。谢谢