Home
Analytics
Excel export of partially bolded Text element
kallem
Text and Dynamic text elements allow creation of partially bolded text using html tags if element content type is set to html. This works fine e.g. in html and pdf output but causes problems in excel output. Excel splits bold and non-bold text parts in separate cells (bold text remains bold). This causes problem if copying content from excel as well as it eats more space as cell's space isn't used optimally.
I have tried Birt and Actuate emitters and both have the same issue. Is there any other way to do this and get bold and plain contents in a single cell in Excel?
Best regards,
Kalle
Find more posts tagged with
Comments
mwilliams
Hi Kalle,
Have you tried the Tribix emitter? I don't know if it would be any different, but it's worth a shot.
kallem
I did try Tribix and it wasn't any better. There is a difference although. Basic Excel emitter splits content vertically while Tribix does it horizontally. Neither way it's no good. I guess I have to make selective content based on output type. Or start digging Excel emitter functionality.. I will check later whether there is feature request for this and post one if there isn't none.
- Kalle
kallem
Enhancement request <a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336680'>#336680</a>
; posted.
mwilliams
Thanks for the update!
kallem
Just in case if someone has problems with this as well I did make a workaround by modifying the prototype Excel emitter.<br />
<br />
Method startForeign in the ExcelEmitter was the entry for modification. Text and DynamicText elements that contain html content are handled by that. It splits cell content in multiple labels so I just removed the split and straightened the path to the output writer.<br />
<br />
<br />
Also there was couple of issues worth noting:<br />
<br />
1) To get rich text content working following attribute needs to be added in the Data tag:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>xmlns="http://www.w3.org/TR/REC-html40"</pre>
For some reason when xmlns is used Excel didn't reconize cell content and it was empty. This was caused by Data declaration. Emitter outputs the Data tag without prefix and for some reason it was causing the problem. By inserting prefix <em class='bbc'>ss:</em> (which references urn:schemas-microsoft-com:office:spreadsheet) in the Data tag then content is shown in Excel.<br />
<br />
2) ExcelXmlWriter encodes text content which transforms special characters. Excel seems not to be able to handle those and it converts encoded text to plain text. E.g. if Text element has: <em class='bbc'><B>text</B></em> and it is encoded then Excel shows exactly the same text. So I removed encoding call.<br />
<br />
<br />
As some of the text fields have rather long content I also wanted auto row height working. If element conatins html content then I set Row attribute ss:AutoFitHeight to 1. This should work in co-operation with ss:Height but I couldn't get it working. In the report template I don't have row height specified but output still showed row height to be 15. ExcelLayoutEngine has has DEFAULT_ROW_HEIGHT variable which defaults to 15. I did set it to 0 to prevent ss:Height generation if original row has no height.<br />
<br />
<br />
<a class='bbc_url' href='
http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx'>XML
Spreadsheet reference</a> is useful reading.<br />
<br />
I did test the code with Excel 2010.<br />
<br />
<br />
Hope this helps!
mwilliams
This could be a good addition to the devShare for easier searching, if you have time.