2012-02-29 38 views
2

我想出口碧玉報告到HTML。我的標題,細節帶欄標題有背景顏色。當我在jasperviewer中檢查它時,報告具有所有的顏色,但在導出爲html後,html報告中的背景顏色沒有顯示出來(僅用於詳細說明)即使在源代碼中它們也不存在。碧玉報告到HTML不顯示背景顏色

?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" 
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> 
<jasperReport 
name="monthlyStats" pageWidth="595" pageHeight="400" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> 
     <property name="ireport.zoom" value="1.0"/> 
     <property name="ireport.x" value="0"/> 
     <property name="ireport.y" value="0"/> 
     <style name="table"> 
      <box> 
        <pen lineWidth="1.0" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table_TH" mode="Opaque" backcolor="#1E90FF"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table_CH" mode="Opaque" backcolor="#BFE0FF"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 1"> 
      <box> 
        <pen lineWidth="1.0" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 1_TH" mode="Opaque" backcolor="#1E90FF"> 
      <box> 
        <topPen lineWidth="0.5" lineColor="#000000"/> 
        <bottomPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 1_CH" mode="Opaque" backcolor="#BFE0FF"> 
      <box> 
        <topPen lineWidth="0.5" lineColor="#000000"/> 
        <bottomPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
        <topPen lineWidth="0.5" lineColor="#000000"/> 
        <bottomPen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
      <conditionalStyle> 
      <conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression> 
      <style backcolor="#EFF7FF"/> 
     </conditionalStyle> 
     </style> 
     <style name="table 2"> 
      <box> 
        <pen lineWidth="1.0" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 2_TH" mode="Opaque" backcolor="#000000"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 2_CH" mode="Opaque" backcolor="#FFE6E6"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF"> 
      <box> 
        <pen lineWidth="0.5" lineColor="#000000"/> 
      </box> 
     </style> 
     <subDataset name="Table Dataset 1"/> 
     <subDataset name="Table Dataset 2"/> 
     <subDataset name="Table Dataset 3"/> 
     <parameter name="devicename" class="java.lang.String" /> 
     <queryString> 
      <![CDATA[select DATEPART(MONTH,rm_devus_enddt) as month, 
CASE when DATEPART(MONTH,rm_devus_enddt)=2 
     then 
      SUM((DATEDIFF(HOUR,rm_devus_startdt,rm_devus_enddt)*100.0)/(28.0*24.0)) 
     else 
      CASE when (DATEPART(MONTH,rm_devus_enddt)%2)!=0 
       then 
         SUM((DATEDIFF(HOUR,rm_devus_startdt,rm_devus_enddt)*100.0)/(31.0*24.0)) 
        else 
         SUM((DATEDIFF(HOUR,rm_devus_startdt,rm_devus_enddt)*100.0)/(30.0*24.0)) 
        end 
     end as freepercent 
from deviceusage where rm_device_id=(select rm_device_id from device where rm_device_name=$P{devicename}) 
and rm_devus_enddt is not NULL GROUP BY DATEPART(MONTH,rm_devus_enddt);]]> 
     </queryString> 
     <field name="month" class="java.lang.Integer"/> 
     <field name="freepercent" class="java.math.BigDecimal"/> 
     <background> 
      <band/> 
     </background> 
     <title> 
      <band height="41"> 
        <frame> 
         <reportElement mode="Opaque" x="-20" y="-26" width="595" height="53" backcolor="#006699"/> 
         <image> 
           <reportElement x="0" y="5" width="225" height="48"/> 
           <imageExpression><![CDATA["../logo/RDLOGO.JPG"]]></imageExpression> 
         </image> 
        </frame> 
        <rectangle> 
         <reportElement x="-20" y="33" width="595" height="5" forecolor="#006699" backcolor="#006699"/> 
        </rectangle> 
      </band> 
     </title> 
     <pageHeader> 
      <band/> 
     </pageHeader> 
     <columnHeader> 
      <band height="67"> 
        <frame> 
         <reportElement mode="Opaque" x="16" y="34" width="511" height="33" forecolor="#006699" backcolor="#000000"/> 
        </frame> 
        <staticText> 
         <reportElement x="58" y="47" width="100" height="20" forecolor="#F0F0F0" /> 
         <textElement textAlignment="Center" verticalAlignment="Middle" markup="none"> 
           <font size="13" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/> 
         </textElement> 
         <text><![CDATA[Month]]></text> 
        </staticText> 
        <staticText> 
         <reportElement x="221" y="47" width="100" height="20" forecolor="#F0F0F0" /> 
         <textElement textAlignment="Center" verticalAlignment="Middle"> 
           <font size="13" isBold="true"/> 
         </textElement> 
         <text><![CDATA[%free]]></text> 
        </staticText> 
        <staticText> 
         <reportElement x="371" y="47" width="100" height="20" forecolor="#F0F0F0" /> 
         <textElement textAlignment="Center" verticalAlignment="Middle"> 
           <font size="13" isBold="true"/> 
         </textElement> 
         <text><![CDATA[%used]]></text> 
        </staticText> 
      </band> 
     </columnHeader> 

注意:我得到標題的背景顏色,但不是列標題和細節。

+0

你可以閱讀@ mdahlman在[這個問題]的答案(http://stackoverflow.com/questions/7953705/ireport-import-background-image) – 2012-02-29 10:48:45

+0

@Alex問題和答案是關係到背景圖片和我的問題與背景顏色有關。 – 2012-02-29 12:54:31

+0

您可能需要發佈一些.jrxml。這聽起來像是你在概念上理解了事情,但報告定義中存在某種錯誤。 – mdahlman 2012-02-29 21:38:47

回答

2

與excel導出類似的問題。事實證明,導出只支持某些調色板。你將不得不尋找HTML導出器調色板,並將你的顏色更改爲該列表中的一個。