birt在页面展现

效果图如下:

 主要代码如下。

<%@ page language="java" contentType="text/html; charset=UTF-8" 
    pageEncoding="UTF-8"%>  
 <%@ taglib prefix="birt" uri="/WEB-INF/report-config/tlds/birt.tld" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
<title>Insert title here</title>  
</head>  
<script type="text/javascript">
  var reportName = '${reportName}';
  var startdate ='${startDate }';
  var enddate ='${endDate }';
  var username = '${name}';
  
          function expDoc() { 
           window.open('http://localhost:8080/matmo/frameset?__masterpage=true&__format=doc&__report='+ reportName +'&username=' + name +'&startdate=' +startdate +"&enddate=" +enddate);
            }  
           function expExcel() {
            window.open('http://localhost:8080/matmo/frameset?__masterpage=true&__format=xls&__report='+ reportName +'&username=' + name +'&startdate=' +startdate +"&enddate=" +enddate);
            }  
           function expPDF() { 
            window.open('http://localhost:8080/matmo/frameset?__masterpage=true&__format=pdf&__report='+ reportName +'&username=' + name +'&startdate=' +startdate +"&enddate=" +enddate);
            }  
    </script>  
<body>  

    <input type="button" value="保存成word" onclick="javaScript:expDoc();"/>  
    <input type="button" value="保存成Excel" onclick="javaScript:expExcel();"/>  
    <input type="button" value="保存成PDF" onclick="javaScript:expPDF();"/>  
   
    <birt:report id="0" 
                 top="100" 
                 left="100" 
                 width="800" 
                 height="600" 
                 reportDesign="${reportName }" 
                 position="absolute" 
                 format="html">  
      <birt:param name="username" value="${name }"/>
      <birt:param name="startdate" value="${startDate }"/>
      <birt:param name="enddate" value="${endDate }"/>
    </birt:report>
 
</body>  
</html> 

猜你喜欢

转载自jjc132.iteye.com/blog/2128254
今日推荐