Blogs

.NET to SQL to Project Server and everything in between
Welcome to Blogs Sign in | Join | Help
in Search

Strate SQL

SSRS: Mixed Formatting for Textboxes

You've been there before... the report needs to be built with mixed formatting in the textboxes.  Which one could consider a major gap with Reporting Services, because without doing some investigating and research, and in most cases coding and compiling of your own, this functionality simply isn't available.

While doing my own research into this, I found two sites that referenced the same C# code block that transform RTF documents into bitmaps and display them on reports.  The first thread has a nice description and the second had nice pictures, neither of them had compiled code to download nor a working sample to verify... so I did that and have linked it to this blog.

I have found a sort of lazy man's beauty in this solution... because when I save a Word document as Richtext Format and then opened it in Notepad I could use all of the RTF code without any cleansing to build the images.

Hope someone else finds this as useful as I have.

 ** EDIT 2008/08/11 ** If you really want this to work, it is time to upgrade to SQL Server 2008.

Published Tuesday, October 03, 2006 12:07 PM by Jason
Filed under:

Attachment(s): RichTextImager.zip

Comments

 

Adnan Shamim said:

Greetings, its a good suggestion you have got there, i have tried it and everything went smoothly, but the images are not being generated....by smoothly i mean there is no error or anything like that. just a cross appears in the omage control (i have tried placing simple as well as html text in the database field)
awaiting response. thanks in advance.
adnan shamim
fastian1335@yahoo.com, adnan.shamim@ekalsoft.com
November 2, 2006 12:21 PM
 

Davaren said:

The control isn't meant to convert HTML, it will only work with text formatted using the RTF specification.  There is one problem I was never able to resolve when I wrote this class.  The resolution being returned is 96dpi, which looks great on screen, but when you print it out the quality of the printed text is unacceptable.  I've since started writing my own RTF parser and a custom control so that I can change the DPI of the rendered image depending on whether it is being displayed or printed, but if anyone has a way to do this using my original class, feel free to save me a couple hundred hours of work and post your workaround :)

December 12, 2006 12:55 PM
 

Steven said:

THis all works, when I am in the project solution, but when I deploy and try to see it working through the Reports Server (HTML interface) it come up with just a square in the imae control. I have tested to see whether the dll is actually working by just writing a simple function in the richtextimager.dll which just outputs text to a field in the report and it does, so it seems like it is something with the image.

Also I can not debug when the report loads up through the reports manager web interface.

pls. can you help me with this

January 7, 2007 11:23 PM
 

Davaren said:

If you look in the read me file he included, I provided a full walkthrough on where you need to copy the DLL files as well as how to give it proper security rights within reporting services.

January 15, 2007 10:09 AM
 

Daniele said:

Works like a charm!

It's handy to see the XML source of the sample report, and in my case it was the first time using code inside a report so the instructions where baffling at first... until I saw the tags in the sample reports.

Thanks for saving the day!

January 25, 2007 1:48 PM
 

Thiago Silva said:

Have you tried just running the RTF string through the RichTextBox control in System.Windows.Forms?

You can create a new instance of this control type, then pass the RTF string via the "Rtf" property.  Then retrieve the unformatted text using the Text property.

This will not display line breaks and tabbing in HTML, but when you export to PDF it will show those just fine.

June 18, 2007 4:43 PM
 

gyan_sada1 said:

I am able to view the RTF data in the Report Preview (Design Time), but at Runtime the same does not work. i have checked the references to RichTextImager.dll but still no luck.

Any pointers?

September 5, 2007 3:49 PM
 

Jason said:

Double check the readme.txt file that is included.  I am assuming the runtime execution you are referencing is on the report server.  The changes made in the development environment for the control will need to be done on the server as well.

September 5, 2007 4:17 PM
 

gyan_sada1 said:

SQL Server Report Preview works corrrectly at design time, but the same doesnot work when I run the report.

My confusion is why the configuration changes are not working at runtime when it works at desing time.

Any help is very much appreciated.

November 1, 2007 8:39 AM
 

gyan_sada1 said:

I did a workaround to resolve the issue.

I used the RTFTextImager.dll to create an RTF Image file (byte array) and save it to a Image field in database. I then used an Image control on the SQL Server report to render the image of the database.

Works like a charm!!

November 5, 2007 11:13 AM
 

srinath said:

I am able to successfully use this thanks for the same, but when i export to excel and open it, it opens with the error "File Error : data may have been lost" and when it opens all my images are gone including the image that was created using above custom dll. Please help me in this regards at the earliest.  

January 3, 2008 5:14 AM
 

srinath said:

In addition to comment above by me other exports works fine, without any problem (ie PDF, TIFF, CSV and Web archive). Your response will be greatly appriciated,

Thanks

January 3, 2008 5:21 AM
 

Claudio said:

Hi, I just tried Your control and it functions very well with RTF, but my situation is different.

I need to get an image (for a report) from an Html Text, Do You have some suggestions to translate HTML to RTF, using c# ? in this way with Your control I can resolve my problem (or not ?)

Thank You

January 4, 2008 4:20 AM
 

Sebastian said:

hi,

the solution in this state is useless. How do you deal with:

- page breaks at runtime

- 300dpi printer quality

the last problem can be solved by setting FitProportional and sizing the image for 300dpi quality. However, managing page breaks is something I never got around.

Any Ideas?

write: scholz.sebastian@gmail.com

Sebastian

March 16, 2008 6:15 AM
 

Ashish said:

I used it and it works perfectly in development environment (Visual Studio 2005) but there are some issues while deployment.

When I follow the steps and deploy it, it’s being deployed properly but while running its giving RED CROSS instead of the image.

Kindly Suggest me a solution

May 19, 2008 3:24 PM
 

Shrishail said:

I tried using RTFIMAGER.dll to convert HTML text to image and display the image in the report.But there is an issue. The image does not come up. Its shows Red cross instead of image. Can any one throw light on this?

June 10, 2008 8:09 AM
 

Zon said:

Any one fixed the issue with the image not displaying but just an X? any comment will be appreciated...

August 7, 2008 12:50 PM
New Comments to this post are disabled
Powered by Community Server, by Telligent Systems