wim.anckaert Posted June 4, 2018 Share Posted June 4, 2018 Hi,I have a report that I want to export to HTML and send it as email.But the text in the email is centered in the mail body.How is it possible to left align the text of the html.The html that is produced contains a table with 3 columns.1. First column with a width of 50%2. Second column with my actual text3. third column with a width of 50% <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 --><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="INVOICE_2" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="5" rightMargin="5" topMargin="5" bottomMargin="5" uuid="fc97a963-c0b6-4c19-a348-7e2773e092a3"> <property name="template.engine" value="tabular_template"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <style name="Table"> <box> <pen lineWidth="1.0" lineColor="#000000"/> <topPen lineWidth="1.0" lineColor="#000000"/> <leftPen lineWidth="1.0" lineColor="#000000"/> <bottomPen lineWidth="1.0" lineColor="#000000"/> <rightPen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="Table_TH" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_CH" mode="Opaque" backcolor="#EFEFEF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="tableDataset" uuid="0eb05a90-8a7b-47dc-8d96-a37b65a68407"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <queryString> <![CDATA[]]> </queryString> </subDataset> <queryString> <![CDATA[]]> </queryString> <summary> <band height="74" splitType="Stretch"> <property name="local_mesure_unitheight" value="pixel"/> <textField isStretchWithOverflow="true"> <reportElement key="" positionType="Float" stretchType="ContainerHeight" x="0" y="0" width="288" height="51" isRemoveLineWhenBlank="true" uuid="2e5326b8-c74b-41a0-9f6f-740f4904d067"/> <textElement markup="html"/> <textFieldExpression><![CDATA["Test <b>tekstveld</b>"]]></textFieldExpression> </textField> </band> </summary></jasperReport>[/code]It produces this html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> a {text-decoration: none} </style></head><body text="#000000" link="#000000" alink="#000000" vlink="#000000"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="50%"> </td><td align="center"><a name="JR_PAGE_ANCHOR_0_1"></a><table class="jrPage" cellpadding="0" cellspacing="0" border="0" style="empty-cells: show; width: 595px; border-collapse: collapse; background-color: white;"><tr valign="top" style="height:0"><td style="width:5px"></td><td style="width:288px"></td><td style="width:302px"></td></tr><tr valign="top" style="height:5px"><td colspan="3"></td></tr><tr valign="top" style="height:51px"><td></td><td style="text-indent: 0px; text-align: left;"><span style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; line-height: 1.2578125;">Test </span><span style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color: #000000; font-size: 10px; line-height: 1.2578125; font-weight: bold;">tekstveld</span></td><td></td></tr><tr valign="top" style="height:786px"><td colspan="3"></td></tr></table></td><td width="50%"> </td></tr></table></body></html>[/code]tx for the help,Kind regards,Wim Link to comment Share on other sites More sharing options...
wim.anckaert Posted June 15, 2018 Author Share Posted June 15, 2018 it's a pitty it won't be usefull now Link to comment Share on other sites More sharing options...
nicknxswart.nl Posted July 25, 2020 Share Posted July 25, 2020 Hi Wim, it's a old post but I have something a bit the same! I want to change the html body background color. Do you have any idea on how to do this from jaspersoft? Greetz Link to comment Share on other sites More sharing options...
wim.anckaert Posted July 27, 2020 Author Share Posted July 27, 2020 Hello,I have no idea how to do it in jaspersoft.But we resolved the issue by altering the produced html after generation.We removed everything from <a name="JR_PAGE_ANCHOR_0_1"></a>until first </table>I assume you can do the same and put your own html and body tags around it. Kind regards Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now