Antes de mais nada, não entendo de programação, apenas um futriqueiro que está tentando fazer relatórios “básicos” para complementar o ERP da empresa.
Estou tentando importar imagem do BD para um relatório ireport e após testar infinitas soluções do fórum e nenhuma ter funcionado venho aqui clamar por luz antes que quebre tudo kkk
O relatório funciona 100% sem a imagem, traz todos os dados de forma correta, porém ao adicionar objeto imagem não consegui de forma alguma fazer funcionar.
A tabela TGPRO_IMAGEM é encontrada quando rodo dentro do ERP e traz resultados binários http://puu.sh/FvMlz/7e26a1316c.png
Já testei algumas expressões para conversão de base64, porém nenhuma funcionou, se alguém puder ajudar agradeço.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="template.type" value="columnar"/>
<property name="ireport.zoom" value="1.464100000000004"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Title" forecolor="#000000" fontName="Times New Roman" fontSize="50" isBold="false" pdfFontName="Times-Bold"/>
<style name="SubTitle" forecolor="#666666" fontName="Times New Roman" fontSize="18" isBold="false" pdfFontName="Times-Roman"/>
<style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true" pdfFontName="Times-Roman"/>
<style name="Detail" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman"/>
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" backcolor="#F0EFEF"/>
</conditionalStyle>
</style>
<queryString>
<![CDATA[SELECT
TGFPRO.CODPROD AS TGFPRO_CODPROD,
TGFPRO.DESCRPROD AS TGFPRO_DESCRPROD,
TGFPRO.CODVOL AS TGFPRO_CODVOL,
TGFPRO.MARCA AS TGFPRO_MARCA,
TGFPRO.NCM AS TGFPRO_NCM,
TGFPRO.IMAGEM AS TGFPRO_IMAGEM,
TGFPRO.REFERENCIA AS TGFPRO_REFERENCIA
FROM
"TGFPRO" TGFPRO]]>
</queryString>
<field name="TGFPRO_CODPROD" class="java.math.BigDecimal"/>
<field name="TGFPRO_DESCRPROD" class="java.lang.String"/>
<field name="TGFPRO_CODVOL" class="java.lang.String"/>
<field name="TGFPRO_MARCA" class="java.lang.String"/>
<field name="TGFPRO_NCM" class="java.lang.String"/>
<field name="TGFPRO_IMAGEM" class="java.awt.Image"/>
<field name="TGFPRO_REFERENCIA" class="java.lang.String"/>
<variable name="TGFPRO_IMAGEM_1" class="java.lang.Integer" calculation="Count">
<variableExpression><![CDATA[$F{TGFPRO_IMAGEM}]]></variableExpression>
</variable>
<group name="TGFPRO_MARCA">
<groupExpression><![CDATA[$F{TGFPRO_MARCA}]]></groupExpression>
<groupHeader>
<band height="31">
<frame>
<reportElement mode="Opaque" x="0" y="7" width="555" height="24" forecolor="#B89F7D" backcolor="#9DB1B8"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="SubTitle" isPrintRepeatedValues="false" x="2" y="1" width="479" height="23" forecolor="#FFFFFF"/>
<textElement verticalAlignment="Middle">
<font isBold="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TGFPRO_MARCA}]]></textFieldExpression>
</textField>
</frame>
</band>
</groupHeader>
<groupFooter>
<band height="6"/>
</groupFooter>
</group>
<group name="TGFPRO_DESCRPROD">
<groupExpression><![CDATA[$F{TGFPRO_DESCRPROD}]]></groupExpression>
<groupHeader>
<band height="24">
<frame>
<reportElement mode="Opaque" x="206" y="4" width="349" height="20" forecolor="#D0B48E" backcolor="#BBC9CE"/>
</frame>
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="209" y="4" width="346" height="20" forecolor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="16" isBold="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TGFPRO_DESCRPROD}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="132" splitType="Stretch"/>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="91" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="2" y="90" width="551" height="1"/>
</line>
<staticText>
<reportElement style="Column header" positionType="Float" x="206" y="0" width="132" height="20" forecolor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Cód. Interno]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="338" y="0" width="215" height="18"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="false" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{TGFPRO_CODPROD}]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Column header" positionType="Float" x="206" y="20" width="132" height="20" forecolor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Un. venda]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="338" y="20" width="215" height="18"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="false" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TGFPRO_CODVOL}]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Column header" positionType="Float" x="206" y="40" width="132" height="20" forecolor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[NCM]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="338" y="40" width="215" height="18"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="false" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TGFPRO_NCM}]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Column header" positionType="Float" x="206" y="60" width="132" height="20" forecolor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[EAN13]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement style="Detail" positionType="Float" x="338" y="60" width="215" height="18"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14" isBold="false" pdfFontName="Times-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TGFPRO_REFERENCIA}]]></textFieldExpression>
</textField>
<elementGroup>
<image>
<reportElement x="0" y="0" width="206" height="90"/>
<imageExpression class="java.awt.Image"><![CDATA[new Image(getClass().getResource("$F{TGFPRO_IMAGEM}")).getImage()]]></imageExpression>
</image>
</elementGroup>
</band>
</detail>
<columnFooter>
<band height="7" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="13" splitType="Stretch">
<frame>
<reportElement mode="Opaque" x="0" y="0" width="555" height="13" forecolor="#D0B48E" backcolor="#9DB1B8"/>
<textField evaluationTime="Report">
<reportElement style="Column header" x="528" y="0" width="24" height="13" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Column header" x="481" y="0" width="48" height="13" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Pág. "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="2" y="0" width="163" height="13" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>