Category Archives: OfficeWriter

Using WordWriter to merge Word Documents

Several of our consulting projects have had a similar need: programatically merge multiple Word documents into a single Word file. Using SoftArtisans’ WordWriter, this task is fairly easy. In this article, I’ll show you how. If you’re not a current WordWriter user, you can download a free evaluation and follow along!

When you use WordWriter to merge documents, the page setup of the destination document you are merging into is used for all pages. (This follows the same behavior as Word.) If you create a new document to merge into, you’re resulting document will have default formatting.

If you want to preserve the formatting of each document that you are merging, insert a section break in your final output file before merging each document. You will then need to copy the formatting information from each document to the section you just created. Some types of document formatting that you may want to preserve include: margins; paper size or orientation; page borders; vertical alignment; and number of columns. (Text formatting, such as font, font size, text color are preserved, so you don’t need to manually set these.) Continue reading Using WordWriter to merge Word Documents

Refactoring XmlWriter

I found this link interesting: http://elegantcode.com/2009/06/19/refactoring-xmlwriter/

XmlWriter and XmlReader are convenient and one of the fastest ways of creating XML, but they are kind of ugly sometimes. I wrote a class that encapsulated these methods into XmlFilter, which makes it easy to change pieces of an XML file without writing the same scaffolding over and over again, and without using an XmlDocument (which is quite a bit slower and consumed more memory than I preferred.)

The next release of Officewriter should be significantly faster (roughly 2 to 4 times as fast, according to current benchmarks) than the 4.0 release for parsing Excel 2007 files. This is mostly because I replaced a section of code that used the XmlDocument with a custom written replacement which was more specific to my needs. I don’t think the .NET framework (at least parts of it) was written with performance in mind, but I’ll get into that in a later blog post.

SQLServer.com’s Jonathan Spink Reviews OfficeWriter for SQL Server Reporting Services

The following is an excerpt from SQLServer.com’s Jonathan Spink as he reviews OfficeWriter’s integration with SQL Server Reporting Services (SSRS). Read the full review here.

“…The idea behind OfficeWriter is to extend the functionality of software users are already familiar with, i.e. Excel and Word, so they’re able to both acquire the data they need and arrange it into a useful form. While OfficeWriter does come in two more specific forms, ExcelWriter and WordWriter, this review looks at the version developed for use with SQL Server Reporting Services (SSRS), available in both 2000 and 2005 incarnations.

In order to take advantage of the different parts of this system, the OfficeWriter for SSRS package comes in two parts. The Designer is what you use to create the reports, either in Excel or Word, while the Renderer sits on the Reporting Services server.

This then is the OfficeWriter approach: from the Ms Office front-end, reports are produced in the SSRS XML-based RDL format, then uploaded to the SSRS ReportServer database, like any report produced using Visual Studio (VS). This means that they can also be viewed in Report Manager along with any other SSRS reports you have.”

[Read the full review]