Tuesday, March 14, 2023

How to generate a QR Code for SSRS report

 class QRHelper

{            

public static container QRCode(str _QRContents)

  {

    System.Drawing.Bitmap bm=null;

    try

   {  

  Microsoft.Dynamics.ApplicationSuite.QRCode.Encoder qrCodeEncoder = new Microsoft.Dynamics.ApplicationSuite.QRCode.Encoder();

    bm=qrCodeEncoder.Encode(_QRContents); 

   }                

catch(Exception::CLRError)                

 {                       

  error(CLRInterop::getLastException().toString());                              

 }                    

 using (var stream =new System.IO.MemoryStream())                    

{                            

bm.Save(stream,System.Drawing.Imaging.ImageFormat::Bmp);                            

bm.Dispose();                           

return Binary::constructFromMemoryStream(stream).getContainer();                   

}           

}  

}

.................................................................

Create a field container give EDT BITMAP

In DP class map the field with the above mentioned class as below :

Table.field =QRHelper::QRCode(string);


No comments:

Post a Comment