PIVOT TABLES ARE HERE!
OfficeWriter 8.4 packs a powerful punch with exciting new features, most notable of which is ExcelApplication support for PivotTables in OOXML (XLSX, XLSM) files. ExcelWriter already supports the use of PivotTables in ExcelTemplate and SSRS reports, but now you can programmatically create, manipulate, and remove PivotTables with ExcelApplication.
The new PivotTable API gives you the freedom to:
- Create PivotTables from scratch (see our tutorial on Creating a Basic PivotTable)
- Add and manipulate PivotTable fields – data value fields, column labels, row labels, and report filter page fields
- Access common settings like empty/error values, refresh data when opening a file, and the number of cached items to retain
With the API you also have the ability to change the data source of a PivotTable. If you want to copy a worksheet with a PivotTable on it, now you can point the data source of the copied PivotTable to relevant data, rather than have it point to the original data source. Details on how to use CopySheet with PivotTables are in OfficeWriter Answers.
Not a PivotTable expert just yet? Not a problem. We have a guide that breaks down the different parts of PivotTables before you jump into the API.
NEW WORDTEMPLATE PROPERTIES
The new WordTemplate.BookmarksToRemove property lets you specify a set of bookmarks to be removed from the template file. The bookmarks, as well as all of the content inside, is removed in the output file. You can remove optional content from your DOCX and DOCM template files just by wrapping it in bookmarks.
For example, I can wrap a table of contents in a bookmark and if a user doesn’t want the table of contents in their output file, I can just remove it in the code.
With WordTemplate.SetDocumentProperty, you can customize the built-in document properties (a full list is available here). This includes properties that can’t be accessed from Word, such as ‘Last Saved By’ and ‘Revision Number.’
Other new features include:
- Improved support for Excel statistical formulas
- Ability to convert numeric strings to numbers with ExcelApplication’s ImportData
A comprehensive list of new features and bug fixes is available in our change log.