r0bb077
r0bb077

Reputation: 752

Creating word documents within a c# application?

I've been searching on ways to create letters using a C# Windows Form application in Visual Studio based on information from a local SQL server. I've seen some other topics but each answer seems to be really different.

My knowledge is pretty basic about this and wouldn't mind a step in the right direction. Is it actually possible? is there a better solution rather than creating word documents?

I only really need to be able to create a word document which has some text and and tables is this possible?

Upvotes: 1

Views: 307

Answers (2)

Kiru
Kiru

Reputation: 3565

  1. If you are creating a document of same kind with different data then use a Word template (.dotx) and use content controls or bookmarks in the document.

Advantage: Saves your time in manipulating with formatting and alignment in the document

  1. Then use Open XML to just replace your content controls or bookmarks with the values.

Advantage: You dont need Word Interop assemblies to be deployed. Faster and recommended by Microsoft.

Upvotes: 2

Dave Cousineau
Dave Cousineau

Reputation: 13158

Depending on your needs, you could either simply copy a pre-existing file, or if you need to modify the document from code, you can use Microsoft Office Automation. (see C# office 2010 automation)

Upvotes: 0

Related Questions