All posts by Chris Baldwin

What’s New in OfficeWriter 8.0?

server-side excel generation[cross-posted from officewriter.com]

OfficeWriter 8.0 was just recently released!  So, what’s new in this most significant release of OfficeWriter in a number of years?  Here’s the breakdown:

  • XLSX Support – Complete support for Excel 2007/2010 (XLSX) files in the ExcelApplication API
    • Programmatically create, manipulate, and read XLSX, XLS, and DOC
    • Run on your server with confidence – OfficeWriter is designed for high performance and scale
    • Build sophisticated Excel and Word reporting features into your applications
  • RTF/HTML import – Import arbitrary RTF and HTML documents into Word reports
    • Quickly and easily import markup into Word reports
    • Supports DOCX and DOC files
  • Enhanced documentation – New layout, new organization, new tutorials. We made it easier than ever for developers to find information they’re looking for at http://wiki.softartisans.com Continue reading What’s New in OfficeWriter 8.0?

OfficeWriter 8.0: Getting Started with XLSX in C#

XLSX in OfficeWriter 8.0

We just released OfficeWriter 8.0, and the biggest feature in this release is full support for Excel 2007/2010 files with the OfficeWriter API.  So, if you’ve written OfficeWriter applications that process XLS files, what do you need to do to get started with using XLSX files?  In short, nothing!

We took special care to keep compatibility in mind, so you can largely use the same code to process your XLSX files that you use with XLS.  There are a couple scenarios in which you’ll need to be specific about what you’re using, but they’re mainly around creating new files where you clearly need to tell OfficeWriter what kind of files to create.

Creating New Workbooks

Use the Create method on an ExcelApplication instance to create a new, blank workbook. For back compat, calling Create with no arguments will create an Excel 2003 (XLS) file.  To create an XLSX, pass it a FileFormat enum like this:

Workbook wb = xla.Create(ExcelApplication.FileFormat.Xlsx);

Continue reading OfficeWriter 8.0: Getting Started with XLSX in C#

No more row limitations: Exporting XLSX with SQL Server 2008 R2 Reporting Services

The hard-at-work folks on the SQL Server Reporting Services team recently announced that SQL Sever 2012(formerly codenamed “Denali”) will feature the ability to export reports to XLSX and DOCX. These new OpenXML-based file formats were introduced in Microsoft Office 2007, and they contain a number of interesting features and capabilities beyond the older, binary XLS and DOC files.

But, if you can’t wait for the SQL Server 2012 release (expected to be released in the first quarter of 2012) to get XLSX and DOCX from Reporting Services, you can use OfficeWriter.

No more 65,536 row limitation!

This is probably the biggest reason that people want XLSX instead of XLS. XLSX supports over a million rows.

What is OfficeWriter?

OfficeWriter is a set of tools for Excel and Word document generation, manipulation, and reading. OfficeWriter consists of three main pieces:

1. OfficeWriter API – For .NET developers who need to build custom Excel and Word document generation, manipulation, and reading into custom applications.
2. OfficeWriter SharePoint Solutions – Packaged, no-code solutions for SharePoint that add document generation capabilities to SharePoint lists
3. OfficeWriter for Reporting Services – Custom extensions to SSRS that allow you to publish, populate, and deliver Excel and Word reports from the report server.

The last option is what I will focus on. Specifically, how to generate XLSX reports from SSRS.

How to Generate XLSX from SQL Server 2008 R2 Reporting Services

With OfficeWriter for Reporting Services, you can publish Excel and Word templates to the report server.  When the report executes at runtime, SSRS merges the Excel or Word template with data and delivers it to the client.

First, I’ll open Excel and flip to the Add-Ins tab where the OfficeWriter toolbar resides:

You can either build a new DataSet  for the report by clicking the Add Query button, or import a DataSet from an existing RDL by clicking Open Report.  I have an RDL with a specific query already defined in it that shows all 121,317 rows from the AdventureWorks 2008 R2 sample database.  So, I’ll click Open Report and just use that.  Once I open that RDL, the DataSets and all fields from those DataSets will appear in dropdown menus:

The RDL I opened has only one DataSet called TerritorySalesLineItems, and two fields called Price and TerritoryName.  To build the report, add any headers or styles you want using regular Excel formatting techniques, and then drop data markers into cells where you want data to go by clicking on items in the Insert Field dropdown:

Publish this workbook to the report server with the Publish button:

When it’s published, it will appear just like a regular report which can be secured, managed, and delivered as you would any conventional RDL:

To export the report, select the Excel designed by OfficeWriter option:

The output generated is the template merged with the data by OfficeWriter on the report server.  Note that the exported Excel has well over 100k rows:

Conclusion

Using OfficeWriter and Reporting Services together lets you pump a huge amount of data into Excel workbooks in a high-performance, highly scalable manner while preserving all Excel formatting and leveraging the features of the report server.

How to Generate XLSX from SQL Server 2008 R2 Reporting Services

With OfficeWriter for Reporting Services, you can publish Excel and Word templates to the report server.  When the report executes at runtime, SSRS merges the Excel or Word template with data and delivers it to the client.

First, I’ll open Excel and flip to the Add-Ins tab where the OfficeWriter toolbar resides:

You can either build a new DataSet  for the report by clicking the Add Query button, or import a DataSet from an existing RDL by clicking Open Report.  I have an RDL with a specific query already defined in it that shows all 121,317 rows from the AdventureWorks 2008 R2 sample database.  So, I’ll click Open Report and just use that.  Once I open that RDL, the DataSets and all fields from those DataSets will appear in dropdown menus:

The RDL I opened has only one DataSet called TerritorySalesLineItems, and two fields called Price and TerritoryName.  To build the report, add any headers or styles you want using regular Excel formatting techniques, and then drop data markers into cells where you want data to go by clicking on items in the Insert Field dropdown:

Publish this workbook to the report server with the Publish button:

When it’s published, it will appear just like a regular report which can be secured, managed, and delivered as you would any conventional RDL:

To export the report, select the Excel designed by OfficeWriter option:

The output generated is the template merged with the data by OfficeWriter on the report server.  Note that the exported Excel has well over 100k rows:

Conclusion

Using OfficeWriter and Reporting Services together lets you pump a huge amount of data into Excel workbooks in a high-performance, highly scalable manner while preserving all Excel formatting and leveraging the features of the report server.

Get started:

Learn more about SSRS integration or start your free trial of OfficeWriter today.

      OR      



OfficeWriter and Excel Services: When to Use Which

Current and potential customers often ask our sales team: “what is the difference between OfficeWriter and Excel Services?” The high level answer is that that they are very different products designed to address very distinct scenarios. In brief, OfficeWriter is a tool that developers can use to generate, read, and manipulate Excel and Word documents in .NET code. Excel Services is a SharePoint-based server product for sharing, managing, and securing Excel workbooks.

Note that the title of this article is “OfficeWriter and Excel Services”, not “OfficeWriter vs. Excel Services”! There are scenarios where they are complementary to one another, and can be used together to solve some pretty interesting problems.

Excel Services Core Capabilities

Excel Services is a server-based workbook sharing, viewing, and calculation service. It’s a server product that is part of the SharePoint platform. It requires an enterprise-level SharePoint license to use.

The features discussed here pertain to Excel Services in SharePoint 2010, which is the latest version. Excel Services focuses on several key scenarios:

  1. Sharing and viewing workbooks through a browser– Excel Services allows for thin, web-based viewing of Excel 2007 and 2010 workbooks. This feature works only with modern XLSX files, not the legacy XLS files. The key benefits of this are:
    1. Excel is not required to be installed in order to view the file since it’s rendered in a web-based view
    2. Web-based views are interactive to a certain extent. Certain features including filtering, sorting, and page-level slicers are supported.
    3. Since an XLSX file viewable by Excel Services is just another item in document library, it can be secured and managed with SharePoint permissions just as any other document.
    4. The web-based view can be hosted in SharePoint webparts to become part of a larger dashboard.

    Continue reading OfficeWriter and Excel Services: When to Use Which

Exporting SQL Server Database Data to Excel

Introduction

The need to get business data from a SQL Server database (or any other kind of RDBMS for that matter) into Excel for further analysis is universal.  I would venture to say that anyone in any business role from marketer to analyst to salesperson to executive to program manager has had the occasion to say: “I need this data in Excel so that I can crunch it!”

Since getting data into Excel is a common requirement, it stands to reason that there are several different ways to accomplish the task.  For simple, non-stylized, or purely tabular data imports (situations where you don’t really care about styles or fonts or corporate branding) Excel’s out-of-the-box data import solution can be an option.  For more sophisticated scenarios that require a specific look and feel, or something more complex than just straight tabular data dumps there is OfficeWriter.

This article will discuss both methods for getting your data from SQL Server into Excel.

Methods for Exporting Database Data to Excel

As I mentioned there is more than one way to skin the cat here.  Which method you choose depends on what you need to accomplish.

Method 1: Excel-based data access

Continue reading Exporting SQL Server Database Data to Excel