This project is read-only.

Introduction

The document generator can be used as a component in .Net application to generate documents in OOXML or ODF format.

Installation

Document generator does not require any installation. Download the zip file with the latest version and extract the contents to a directory of choice.

Getting Started

Setup the project

  1. Create a new console project in Visual Studio
  2. Add a reference to the dll’s for the document generation:
    • DocumentGenerator.dll
    • DocumentFormat.OpenXml.dll (This is the dll for the OOXML SDK)
    • ICSharpCode.SharpZipLib.dll (This dll is needed for creating ODF files)

Create a new document

Create a new instance of the TextDocument object:

var doc = TextDocument.Create(fileName, true);

fileName: The name of the document, that will be used to save the document.

true: Indicates that the component can override an existing file with the same name.

Add a paragraph to the document:

var paragraph = doc.AddParagraph(Header, Text, Level);

Header: The header of the paragraph

Text: The text of the paragraph

Level: The paragraph level. This value is used to associate the paragraph with a style, e.g. Level =1 will associate the header with the style Header 1

Save the document

doc.Save(DocumentType);

DocumentType: DocumentType.OOXMLTextDocument saves the document as OOXML and DocumentType.ODFTextDocument saves the document as ODF.

More Info

More info about the possibilties of the library can be found here .

Last edited Apr 3, 2013 at 6:05 PM by Chicoo, version 5

Comments

No comments yet.