Sample Code
WordTemplate Samples
- Basic String Datasource — This is a basic demo that inserts data into a template document that has two merge fields.
- Business Envelopes — Dynamically create a standard business-style #10 envelope with WordTemplate.
- Calendar Sample — Create a calendar document for any month/year combination.
- Fax Sheet Cover — A fax cover sheet with recipient and sender information, created by WordTemplate.
- Form Letter Demo — Generate a form letter with WordTemplate.
- Insert Image Demo — WordTemplate can insert images from byte arrays or ADO.NET objects into your Word documents.
- Mailing Labels Demo — This demo reads customer data from a database and creates standard-sized 5160 mailing labels. Put some label paper into your printer and see for yourself!
- Mail Merge Demo — Emulate a Word mail merge using WordTemplate. A document will be created with each recipient's letter on a new page. Take care of all of your mail merge production with one print job.
- Nested Mail Merge Demo — Emulate a Word mail merge using WordTemplate, featuring new nested repeat block technology. A document will be created with each recipient's letter on a new page, complete with a nested table of orders. Take care of all of your mail merge production with one print job.
- Nested Product Catalog Demo — Use the new features of the WordTemplate object to create feature-rich reports that were previously only possible with many lines of code. This sample uses nested repeat blocks to produce a report very much like the Word Application Product Catalog.
- Purchase Order Demo — A generic purchase order document with a header section and an expanding Word table for detail rows.
- WordWriter Formulas — This demo illustrates some of the formulas available for WordTemplate in OfficeWriter 4.1 and above.
WordApplication Samples
- Form Letter Formatting — Generate a form letter with WordTemplate, then pass it to WordApplication to have formatting applied based on the user's selections.
- Merge Documents — WordWriter allows you to insert elements from separate documents. You can use this functionality to copy/paste document elements into different files, or to easily merge Word documents. This sample demonstrates how to merge three different Word documents into one unified document.
- Product Catalog Sample — An AdventureWorks Product Catalog with formatting, tables, lists, nested data, and images.
- Sales Report Sample — Demonstrates usage of the WordApplication and WordTemplate objects together. Generates a nested-data sales report from AdventureWorks data.
- Search and Replace — Demonstrates how to use regular expressions with WordWriter to easily search and replace text.
- Setting a Watermark — Dynamically place custom watermarks on a Word document using the WordApplication object.