Tuesday, November 27, 2012

Barcode in Multiple Columns In RDLC

This article shows how to print barcode in rdlc in multiple columns. The final outcome of this article will be like this one -:
At first design the report than format it accordingly.I have used list control , Textbox and one Image control for this report.
Now, in this report three important things are present.
First one barcode, 2nd one Rupee symbol and the 3rd one is multiple column.
BARCODE :
Now for Barcode just install barcode font like 3o9 etc.And set the font of textbox to barcode font.One thing u must take care that the barcode is prefixed and suffixed by "*". For example if barcode is "000003" then it will be like "*000003*".
RUPEE SYMBOL :
Now for rupee symbol I have just put the image of it. Help for Image.
MULTIPLE COLUMNS :
For this u have to change columns in properties of Body.Rest is the matter of height n width of page and body.The height n width of body is for each column i.e. if here 3 columns are defined then finally page width will be of 3 inches.
Now, go to Report Properties.
Now, In this new window open the layout tab. And change the column to 3 and column spacing to 0.
In my scenario there is a scarcity of space thats why I have set column spacing to "0". You can change it a/c to ur need.
Then set the page width and height to ur need.Standard width=8.5in and height=11in. I have just saved my space by setting "0" to  left,right,top and bottom margin.
Now ur final design will look like this one :
When u run the report output will be like given image.To view the actual output u have to export it to PDF.


Image in RDLC

Show External Images In RDLC
This post is about "How to show images in RDLC?". 
Step 1 : In RDLC just drag n drop image from toolbox.
Step 2 : In property of Image change source to external and in value specify the path of image.
In path u have to put  "file:/// " before the absolute path for local resources and for Server "http://" .
Step 3 : In Code Behind we have to enable EnableExternalImages.
            ReportViewer1.LocalReport.EnableExternalImages = true;
Now, Run the report. If Image is not visible than we have to follow step 4.
Step 4 : We may need to bypass proxy settings to allow the external image to appear. Add following setting to web.config file.
 <system.net>
        <defaultProxy>
            <proxy proxyaddress ="http://proxyservername:80" usesystemdefault="False" bypassonlocal="True">    </proxy>
        </defaultProxy>
    </system.net>