Print Word & Excel files from ASP.NET

Our WebClientPrint for ASP.NET solution can now be used to print almost any kind of files to the default or any installed printer at the client-side. We’ve published two new articles about how to print Word & Excel files that you should take a look at:

Contact our tech support regarding any questions or issues!

Need to add barcodes in SQL Reporting Services 2012?

We’re proud to announce the availability of Barcode Professional 7.0 for the latest Microsoft SQL Server Reporting Services 2012! Barcode Professional for SSRS is the first third-party barcode solution supporting RS 2012 version.

Barcode Professional for RS brings you a new Barcode CRI (Custom Report Item) for supporting SQL Server Reporting Services 2012 edition which you can use within Visual Studio 2010 or the new SQL Server Data Tools 2012 (formerly Business Intelligent Development Studio a.k.a. BIDS) for adding high quality barcode images into your RDL server reports.

Barcode Professional supports most popular Linear (1D), Postal, MICR & 2D Symbologies/Standards all-in-one solution including Code 39, Code 128, GS1-128, GS1 DataBar (RSS-14), EAN 13 & UPC, Postal (USPS, British Royal Mail, Australia Post, DHL, etc.), Data Matrix, QR Code, PDF 417, Aztec Code, UPS MaxiCode, MICR E-13-B Characters, ALL EAN/UPC Composite Barcodes (CC-A, CC-B & CC-C) and many more barcode standards.

How to get it? Just download the installer from http://www.neodynamic.com/ND/Downloads.aspx?tabid=79&prodid=7

NOTE: Customers who bought Barcode Pro 7.0 for RS will get this update for free i.e. at no extra costs!!!

Reporting Services & Excel – Barcode image size is not properly displayed

It seems that “autosize” images rendered in any list control of RS is not properly displayed when exporting the RDL report to Excel *.xls format. AutoSize feature of our Barcode Pro for RS ensures that the generated barcode will not be “cut off”. This is very important when you are using variable length linear barcodes like Code 39, Code 128, GS1-128, etc. because the barcode length will depend on the amount of characters in the value to encode. For other barcodes like UPC-A/E or EAN-13/ISBN that is not a problem at all because these standards encode fixed length values and the final barcode size can be calculated from the beginning.

Now, back to the Excel “image autosize” issue, there is a workaround which can be applied to avoid this. It involves you disable AutoSize feature on our product and just specify a fixed size for it through Width & Height properties. The only thing to be aware is that for variable length barcodes, you must specify the greatest size which will depend on your data source field which will be encoded into the barcodes.

Let’s apply the workaround to the sample we provide in the “Getting Started – First Steps with Barcode Professional for SQL Reporting Services” In this guide there’s a sample report listing barcodes for the products of AdventureWorks sample DB available in SQL Server 2008

For “Using Barcode DLL Component” report sample, there is the following VB function which is in the Code section of the RDL report:


Public Function GetBarcode(ByVal valueToEncode As String) As Byte()
'Set the value to encode
objBarcode.Code = valueToEncode
'Set the Code 128 Barcode Symbology
objBarcode.Symbology = _
Neodynamic.ReportingServices.Symbology.Code128
'Set the Bar's height to 0.5 in
objBarcode.BarHeight = 0.5F
'Enable AutoSize
objBarcode.AutoSize = True

'Generate the barcode image
Return objBarcode.GetBarcodeImagePng()
End Function

In that function, the AutoSize feature is enabled. If you run the RDL report and export it to Excel you get this:

Image auto-size issue when exporting Reporting Services RDL report to Excel

Notice that the barcodes on the Excel file are being “scaled”. The fact is that the barcode image generated by our product is correct (see the “Original size” info) but is scaled down by Excel without apparent reason (In reality, it seems that Excel is honoring the Height of the “table cell” row and scales the barcode image to fit in).

Let’s change some settings on the GetBarcode function by disabling the AutoSize feature and specifying a fixed image size which will contain the rendered barcode.


Public Function GetBarcode(ByVal valueToEncode As String) As Byte()
'Set the value to encode
objBarcode.Code = valueToEncode
'Set the Code 128 Barcode Symbology
objBarcode.Symbology = _
Neodynamic.ReportingServices.Symbology.Code128
'Set the Bar's height to 0.5 in
objBarcode.BarHeight = 0.5F
'Specify fixed size
objBarcode.AutoSize = False
objBarcode.Width = 1F
objBarcode.Height = 0.75F

'Generate the barcode image
Return objBarcode.GetBarcodeImagePng()
End Function

These new settings will generate an image which size is 1in x 0.75in containing a barcode which bar’s height is 0.5in

NOTE: Please notice that the Width & Height properties are for the final image size NOT the barcode bars! The barcode size is determined by a combination of some properties like BarHeight, BarWidth, BarRatio, Code, etc

Other settings must also be done on the Image control which is invoking the GetBarcode() function. Select the Image control and set the Sizing property to FitProportional AS WELL AS the Width & Height properties to the same values you set up in the GetBarcode()function i.e. Width = 1in and Height = 0.75in
Reporting Services Image control settings
That’s it. Now run the report once again and export it to Excel. The barcode images are now displayed correctly without any scaling!
Image size issue solved when exporting a RDL report to Excel

Reporting Services & Excel – File error: data may have been lost.

If you try exporting a Reporting Services RDL report containing our Barcode Professional CRI product to Microsoft Excel and get this error:

“File error: data may have been lost.”

then you are experiencing a known bug of Excel regarding bitmap images (bmp format). This likely happens when you configure our Barcode CRI to render barcodes in BMP format. To solve the issue, just change the ImageFormat property to ONE of the following formats: GIF, JPEG or PNG