Category / Section
How to print in ASP.NET Win Forms OLAP Grid?
1 min read
You can print OLAP Grid using the following code example.
HTML
<input type="button" name="name" value="Print Grid" onclick="return PrintGrid('<%=this.OlapGridControl1.ClientID%>')" />
By passing the control id to PrintGrid function, you can print the controls.
JavaScript
function PrintGrid(controlId) { var grid = $("#" + controlId).clone().find(">table").siblings().remove().end().end().appendTo("<div></div>").parent(); var css = "<style type='text/css'>span,th,td{font-size:12px;}</style>"; var link = "<link rel='stylesheet' type='text/css' href=\""; $("link").each(function() { css += link + $(this).attr("href") + "\"/>"; }); window.printWnd = window.open(); printWnd.document.writeln(css); printWnd.document.writeln(grid.html()); printWnd.document.close(); window.setTimeout("window.printWnd.print()", 1000); return false; }