解决jasperreport生成html分页和打印问题
ie打印第一页时候常常会垂直居中,用下面的代码分页也正常了
String HTML_HEADER = "";
HTML_HEADER = HTML_HEADER + "<html>\n";
HTML_HEADER = HTML_HEADER + "<head>\n";
HTML_HEADER = HTML_HEADER + "<title></title>\n";
HTML_HEADER = HTML_HEADER
+ " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n";
HTML_HEADER = HTML_HEADER
+ " <meta http-equiv=\"imagetoolbar\" content=\"no\">\n";
HTML_HEADER = HTML_HEADER + " <style type=\"text/css\">\n";
HTML_HEADER = HTML_HEADER + " a{text-decoration:none}\n";
HTML_HEADER = HTML_HEADER + " </style>\n";
HTML_HEADER = HTML_HEADER + " </head>\n";
HTML_HEADER = HTML_HEADER
+ " <body text=\"#000000\" link=\"#000000\" alink=\"#000000\" vlink=\"#000000\">\n";
HTML_HEADER = HTML_HEADER
+ " <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
HTML_HEADER = HTML_HEADER
+ " <tr><td width=\"50%\"> </td><td align=\"center\" valign=\"top\">\n";
exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER,
HTML_HEADER);
String HTML_FOOTER = "";
HTML_FOOTER += "</td><td width=\"50%\"> </td></tr>\n";
HTML_FOOTER += "</table>\n";
HTML_FOOTER += "</body>\n";
HTML_FOOTER += "</html>\n";
exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER,
HTML_FOOTER);
HTML_HEADER = HTML_HEADER + "<html>\n";
HTML_HEADER = HTML_HEADER + "<head>\n";
HTML_HEADER = HTML_HEADER + "<title></title>\n";
HTML_HEADER = HTML_HEADER
+ " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n";
HTML_HEADER = HTML_HEADER
+ " <meta http-equiv=\"imagetoolbar\" content=\"no\">\n";
HTML_HEADER = HTML_HEADER + " <style type=\"text/css\">\n";
HTML_HEADER = HTML_HEADER + " a{text-decoration:none}\n";
HTML_HEADER = HTML_HEADER + " </style>\n";
HTML_HEADER = HTML_HEADER + " </head>\n";
HTML_HEADER = HTML_HEADER
+ " <body text=\"#000000\" link=\"#000000\" alink=\"#000000\" vlink=\"#000000\">\n";
HTML_HEADER = HTML_HEADER
+ " <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
HTML_HEADER = HTML_HEADER
+ " <tr><td width=\"50%\"> </td><td align=\"center\" valign=\"top\">\n";
exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER,
HTML_HEADER);
String HTML_FOOTER = "";
HTML_FOOTER += "</td><td width=\"50%\"> </td></tr>\n";
HTML_FOOTER += "</table>\n";
HTML_FOOTER += "</body>\n";
HTML_FOOTER += "</html>\n";
exporter.setParameter(JRHtmlExporterParameter.HTML_FOOTER,
HTML_FOOTER);