Category Archives: SQL Server

[Review] Pinal Dave from

Founder of and developer for Pluralsight, Pinal Dave, reviewed OfficeWriter’s SSRS integration. Below is an excerpt from his blog post. To read the full review click here.

The OfficeWriter API is a .NET library by SoftArtisans that makes it easy for developers to add Excel and Word reporting and document processing to their own applications. OfficeWriter allows users to take data from any data source and turn reports into dynamic, visual presentations. Without requiring Microsoft Office on the server, OfficeWriter is optimized for high-performance, scalable server use. The .NET API integrates with business applications, including those in SSRS and SharePoint.

Why use OfficeWriter’s API with SQL Server Reporting Services (SSRS)? The default rendering extensions for Reporting Services deliver flat, static output. In order to render for multiple extensions such as HTML and PDF, the basic report design in SSRS cannot accommodate specific features, such as multiple worksheets in Excel. This also means that certain features like charts cannot be dynamic in the output because not all of the rendering extensions in SSRS support Excel charts. Therefore, charts are exported as images. Additionally, until SSRS 2008 R2, there wasn’t a default rendering extension for Word. Before SSRS 2012 there was no means of exporting to XLSX or DOCX. Using OfficeWriter for Reporting Services corrects these limitations, allowing end-users to design reports in Excel and Word and make use of many specific features in those applications.

How Creating a Report in SSRS with OfficeWriter Works:

OfficeWriter fits into SSRS with two parts. First, the OfficeWriter Renderer is a server-side rendering extension for Excel and Word, providing Excel and Word features beyond the built-in SSRS export options. Second, the OfficeWriter Designer is a client-side add-in for Excel and Word, which allows users to design reports that utilize the OfficeWriter rendering extensions.

To read the full review click here.

How to Render an SSRS Report Asynchronously using the Async\Await Keywords in C# 5.0 with .NET 4.5

The .NET Framework 4.5 introduced a simplified approach to the task-based asynchronous programming model (which was introduced as part of the Task Parallel Library API in .NET 4.0) via the utilization of the two new keywords:  “async” and “await” in C# (Async and Await in VB.NET). For detailed information, see Asynchronous Programming with Async and Await (C# and Visual Basic)  on MSDN.

In this post, I’d like to show you how we could use these new keywords when making asynchronous calls to the SQL Server Reporting Services web service.  For the purpose of simplicity, I created a very simple Windows Forms project in Visual Studio 2012 in which I just have one button which invokes the SSRS web service in the click event handler.

First we need to make sure the target framework for the project is set to .NET 4.5 in Visual Studio 2012 (from the project properties).

Then we add a service reference to the SSRS web service. This part is a little tricky.  In the “Add Service Reference” dialog, after we put in the URL of the ReportExecution2005.asmx file of the Reporting Services into the Address box and locate the service, in the “Services” panel it should list the “ReportExecutionService” and if you expand that, it would show the “ReportExecutionServiceSoap” underneath. Here we select the Soap service. Then, after specifying a namespace for our reference (I just named it as “SSRSWebService”), we click on the “Advanced” button at the bottom which opens the “Service Reference Settings” dialog (as seen in the screenshots). In this latter dialog, we will make sure the “Allow generation of asynchronous operations” is checked and the “Generate task-based operations” option is selected. What this does is that Visual Studio will generate the async methods for the SOAP proxy class by using the Task<> return types.  Then we click “OK” and close the dialog.

HowtorenderSSRSreport_image1 HowtorenderSSRSreport_image2

Here I would like to underline one key part. In the second step we added the reference to the SSRS web service as a “service reference” (just like a WCF service), not as the legacy web reference (which was the old way of adding web service references prior to .NET 3.5 and WCF).  One other thing I want to point out is that here I am using the ReportExecutionServiceSoapClient proxy class, not the ReportExecutionService class which would have been the case had I added the ASMX reference as a legacy web reference. The interfaces exposed by SSRS differ slightly (different method signatures and different members) between when it is added as a WCF service (in this case it is the SoapClient) versus a legacy web reference.  Since my goal is to use the new .NET 4.5 features, I had to create the service reference in the new WCF way.

In my WinForms project I render the report located at the /MyReports/Report1 directory in SSRS as a PDF file. Here is the code for the button’s click event handler: Continue reading How to Render an SSRS Report Asynchronously using the Async\Await Keywords in C# 5.0 with .NET 4.5

Baseball’s All-Star Break: Predicting the Game Using Excel

Major League Baseball

In keeping with my sports theme from March, on March Madness and predicting the NCAA tournament, it is time to look at this season’s sport: Baseball. As you might know, Major League Baseball’s All-Star game is tonight, so let’s use Excel to pick which league (the AL or NL) will be victorious, so we can kick back and enjoy the game.

Baseball has long been associated with using stats to predict outcomes and player performances. This was made famous in the movie Moneyball, and has its own cottage industry around helping fantasy baseball players perform better. There is no shortage of information that can be gathered about baseball, with the whole industry even having deemed the term: sabermetrics.

Before jumping into the vastness of data, however, I want to point out where we are getting the data from. There are many different sources for baseball stats, many requiring a fee, but I will be referring to the Sean Lahman Baseball Stats Database. It is open source, so you can just download a version that works for you, and run with it. I am only going to look at the players who have actually appeared in the All-Star game and their year’s performance.

The other source of data is the year-to-date stats for the All-Star players. These can be gathered from the many, many sports sites (like, but is a manual process. I will leave it as an exercise for the reader to copy and paste those! You can find the sum of those in the example file attached.

Just to simplify things, we are going to use the old standbys: Earned Run Averages (ERA) and Batting Averages (BA) to compare the two Major League Baseball leagues. The other consideration is to analyze data from just the “Long Ball Era,” which started in 1994. Since the sport has been around so very long, it helps to categorize the data so you get a better apples-to-apples comparison.

The first step is to get the data into your database. I used the Access file download, since SQL Server 2008 R2 can import that directly, and you don’t have to do any of the conversions. The data is also available in CSV and MySQL format. Now that we have a nice almost relational database, all we need are a couple of SQL statements to get the data for our processing needs. (They have been attached for reference.)

On to building our Excel workbook. Continue reading Baseball’s All-Star Break: Predicting the Game Using Excel

[Webinar] Grand Slam Your SSRS Reports

June Webinar

Tune in next week Friday, June 28, 2013 at 1 P.M. for our June webinar as we give you another inside look at how OfficeWriter enhances SQL Server Reporting Services (SSRS), making your reports a home run. Senior Sales Engineer, Chad Evans, will walk you through using both single and multi-value parameters and formulas in SSRS. Using baseball data on players’ batting averages and salaries, this webinar is sure to impress. Don’t miss out! Seating is limited.

*Can’t attend? Register anyway, and we’ll send a copy of the slides and recording following the webinar.

How to open a report from SQL Server Reporting Services with the Application object


You want to modify your reports with the WordApplication or ExcelApplication object after they’ve been populated with data by SQL Server Reporting Services. The ExcelApplication or WordApplication object’s Open method can’t pull a report from a report server, so how do you open a SSRS report with OfficeWriter?


For simplicity and ease of reading the code examples and text in this article refer to the ExcelApplication object exclusively. However, the exact same techniques can be used with the WordApplication object. The only strict requirement for opening reports from SSRS is for the Open method to have an overload that takes a Stream argument, which both objects have.

SQL Server Reporting Services exposes a web service that lets programs access and work with the reports on the server. The web service has a number of functions for interacting with a report server and in fact is the same API that the Report Manager tool is built on top of. One of its functions will let us retrieve a fully rendered report that we can then pass to the ExcelApplication object. Once the ExcelApplication object has opened the report, it can be used as if it were any other file.

Getting a Reference to the Report Server

There are a number of different ways to access a report server to manage your reports. The MSDN documentation has detailed instructions for all the different techniques. The most powerful way, and the one that the Report Manager application uses, is to use the report server’s web service, or SOAP API. The easiest way to use the web service is to add the report server as a web reference in Visual Studio. This will allow us to make web service calls to the report server as though it were any other object in a .NET project. I’ll provide a brief overview of the steps to add a report server as a web reference; details can be found at MSDN. Continue reading How to open a report from SQL Server Reporting Services with the Application object

How to create hyperlinks between cells in an Excel spreadsheet


Your application requires cells to contain hyperlinks to other cells in the same spreadsheet, but the Cell.CreateHyperlink function only makes links to URLs on the internet. This article discusses a workaround using Excel’s HYPERLINK function.


Excel has a function named hyperlink() that, with some special syntax, can create links to other cells in a spreadsheet.

Normally, the hyperlink function creates a link to a URL, much like the CreateHyperlink function. Simply passing the name of a cell to the function causes it to form a bad link; Excel will interpret it as a URL.

The solution is to enclose the name of the destination cell in quotes and preface it with a pound sign. For example, a cell with formula =HYPERLINK(“#Sheet2!C3”, “Link to C3”) will contain the text “Link to C3”, and function as a hyperlink to that cell in Sheet2. The formula can be set either by editing an Excel file directly, or through setting the Cell.Formula property in ExcelWriter.

When the user clicks on the link, Excel’s focus will move to Continue reading How to create hyperlinks between cells in an Excel spreadsheet

What’s new in OfficeWriter 8.5

Spring has sprung, bringing with it our newest release of OfficeWriter: OfficeWriter 8.5!  What’s in store for this maintenance release? Scroll down to see the latest additions our development team has been working on.

WordTemplate – Embed DOCX files into templates

In OfficeWriter 8.0, we added the ability to embed RTF or HTML documents in Word files with WordTemplate.  The feature uses the document modifier to signify that a RTF or HTML document will be inserted. To learn more about using the document modifier, see our guide on inserting an embedded document under our WordTemplate Tutorials.


We have also extended the feature to include DOCX files. Now you can embed other Word documents into your WordWriter templates. Continue reading What’s new in OfficeWriter 8.5

How to Find Your OfficeWriter License Keys

First Things First: What do we have, and where is it?

If you’ve ever gone through a licensing review or license audit, you know that sometimes the hardest part of the whole process is information gathering. What keys do you have? Where are they installed? What is still under support, and what is not? Are we overpaying or over-provisioned? These questions and more can drive a sysadmin to insanity, especially if your records are less than perfect.

While no method can substitute for proper record keeping, I’m here to show you how to find any OfficeWriter product keys that may be installed on your servers. Basically, what I am looking to do is get a list of license keys, versions, and where they are.


SoftArtisans stores all of its license keys in HKCR:\Licenses\Softartisans. We could manually open RegEdit on all our machines and find the keys, then copy them out into an Excel spreadsheet, but that would take WAY too long, even for my development environment.

Before we begin scripting, I first got a list of all the machines I wanted to check. Continue reading How to Find Your OfficeWriter License Keys

[Webinar] Making Reporting Easier with SSRS Designer Ribbon

SSRS Webinar

With data sets tied to different data sources and multiple people handling one report, the process of building a report can get messy. OfficeWriter’s built-in Designer Ribbon makes it easier to interact with SQL Server Reporting Services (SSRS), helping you access reports from your applications on time and with ease. Join us Friday, March 22nd as our Senior Sales Engineer, Chad Evans, shows you how this feature makes using SSRS simpler.

In this webinar you will learn:

  • How to build an SSRS report from start to finish using the OfficeWriter designer ribbon
  • How to easily open existing reports, create new ones, and view reports in process with SSRS

We will also have a question and answer period at the end of the webinar. Feel free to send in questions prior to the webinar so that we can include them in the presentation.

When: Friday, March 22nd at 1 P.M. EST

Can’t attend, but still want a copy of the recording and slides? Register below and we’ll email it out following the webinar.

**Spots are limited. So please register early to secure your seat.

Big Data and OfficeWriter

Big Data DemosWe partnered with Andrew Brust from Blue Badge Insights to integrate OfficeWriter with Hadoop and Big Data. Taking existing OfficeWriter sample projects, Andrew discusses how he created two demos showing OfficeWriter’s capabilities to work with Big Data. One demo uses C#-based MapReduce code to perform text-mining of Word docs. The other demo focuses on connecting to Hadoop through Hive.

In these demos you will learn:

  • How OfficeWriter integrates with Hadoop and Big Data
  • How to use ExcelWriter with Hadoop