June 16, 2014

CRM Reports and Barcodes

Yesterday I saw a question on MSDN Dynamics forum: How to rotate an image in SSRS
The asker needed to generate barcodes inside a CRM Online report and shared this link:
Free Reporting Services Barcodes
The idea is to create a bitmap representing the barcode using the font text, in order to keep the aspect consistent between the preview and the exported report.
However he wanted to know how to rotate the bitmap and although I'm not a big fan of SSRS, the question was interesting so I checked the code.
I have some experience with Image Processing (years ago I created this ugly and nowadays outdated software) so I recognized the System.Drawing namespace and its methods.
So I thought: well, if we can use FillRectangle, DrawString and similar, probably RotateFlip will work too. I suggested the following code and it worked:
newBitmap.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone)
Moral of the story: even if the reports for CRM Online have limitations, sometimes we can count on the .NET framework to solve our requirements.

0 comments:

Post a Comment