Skip to content

C# based template engine for generating Word documents

License

Notifications You must be signed in to change notification settings

Wildcatii/SharpDocx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharpDocx

NuGet MIT AppVeyor

C# based template engine for generating Word documents

Generating documents with SharpDocx is a two step process. First you create a view in Word. A view is a Word document which also contains C# code. Code can be inserted anywhere, e.g. <%= DateTime.Now %> would insert the current date and time.

The next step is to create documents based on this view. This requires two lines of code:

var document = DocumentFactory.Create("view.cs.docx");
document.Generate("output.docx");

Out of the box SharpDocx supports inserting text, tables, images and more. See the Tutorial sample (here's the view and the controller).

If you want, you can specify a view model to be used in your view. Then you could write things like <% foreach (var item in Model.MyList) { %>. See the Model sample.

If you want to do something that's not supported by SharpDocx, you can do so by creating your own document subclass. See the Inheritance example.

About

C# based template engine for generating Word documents

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.7%
  • Smalltalk 2.3%