Reputation: 9937
I had the following problem with reports in the Birt. I want to be able to highlight text in a report using HTML tags <b>
, <i>
, <u>
, etc.
If I highlight the whole word, then everything works fine. But if I highlight only a part of the word, then Birt splits such a word with an extra space:
DataSource:
<data>
<text><b>This</b> is a text. T<b>his</b> is another text.</text>
</data>
.rptdesign:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.6.0.v201606072122</property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<data-sources>
<oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="4">
<property name="FILELIST">data_sources/test_data_source.xml</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID="org.eclipse.datatools.enablement.oda.xml.dataSet" name="testDataSet" id="5">
<list-property name="columnHints">
<structure>
<property name="columnName">text</property>
<text-property name="heading">text</text-property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">text</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">text</property>
<property name="nativeName">text</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[table0#-TNAME-#table0#:#[/data/text]#:#{text;STRING;}]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>2.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:identifier>
<design:name>text</design:name>
<design:position>1</design:position>
</design:identifier>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>-1</design:precision>
<design:scale>-1</design:scale>
<design:nullability>Unknown</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>text</design:label>
<design:formattingHints/>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
<list-property name="privateDriverProperties">
<ex-property>
<name>MAX_ROW</name>
<value>-1</value>
</ex-property>
<ex-property>
<name>XML_FILE</name>
</ex-property>
</list-property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2"/>
</page-setup>
<body>
<text-data id="6">
<property name="fontFamily">"Times New Roman"</property>
<property name="fontSize">14pt</property>
<property name="textAlign">justify</property>
<property name="dataSet">testDataSet</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">text</property>
<text-property name="displayName">text</text-property>
<expression name="expression" type="javascript">dataSetRow["text"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<expression name="valueExpr">row['text']</expression>
<property name="contentType">html</property>
</text-data>
</body>
</report>
Result in Word:
This is a text. T his is another text.
How to make so that the extra space didn't appear?
The my test project can be downloaded here.
Upvotes: 0
Views: 696
Reputation: 2668
A bit late, but I fixed this bug in my fork of BIRT, see https://github.com/hvbtup/birt/commit/fee8b76a1c2b3f2df097d9f23214d0ebc1770f61 You may fork the official BIRT repo (https://github.com/eclipse/birt) and apply this fix to the code.
Upvotes: 1
Reputation: 624
I tried your file with eclipse-reporting-neon-R-win32-x86_64.zip and it worked fine. Try upgrading your editor or viewer.
This is a text. This is another text. <<- formatting removed but no spaces when run with the latest viewer.
If you are just needing this in Word try exporting as DOC instead of DOCX.
Upvotes: 1