various shenanigans.

Dynamically Resize Sharepoint 2010 Report Viewer Web Part

Came across this blog which shows how to dynamically resize a Reporting Services Viewer Web Part to fit the height of the content/report using JQuery.

Here’s the code for completeness. For my execution, I placed this on an HTML page and call it through a Content Editor Web Part.

<script src=”jquery-1.7.2.min.js”></script>
<script type=”text/javascript”>
$(window).load(function() {
setTimeout(“FixReportZoneHeight();”,2000);
});
</script>

<script type=”text/javascript”>
function FixReportZoneHeight() { try { $(‘div[id^=”WebPartWPQ”] div div’).each(function() { $(this).addClass(‘dynamic-height’); }); } catch(err) {} }
</script>

<Style type=”text/css”>
.dynamic-height {height:auto !important;}
</Style>

Set your Report Viewer Web Part like this; I use a fixed width, but not necessary.

 

 

 

Close Bitnami banner
Bitnami