Karen
Karen

Reputation: 3

C#, .docx file, SQL

I've build myself a small Windows Form App in C# to help manage my customers. It deals with a local SQL Database, fetches info in it, updates and adds as well.

I'M all done with the bug testing and stuff, the app is almost over. I have a .docx file that's generated from my SQL database already ( I had it prior to the Windows Form Solution).

Thing is, when I have a new customer, if I want to print an invoice or a contract, I have to use the app to add the new client, sell him his stuff and everything and then leave the app, open Word and generate the invoice or contract.

It's a pain :(

I'd like to know if there is a way, in C# to just, like fill in the .docx file and print it with the use of a single button. I don't want Microsoft Word to pop in my screen or anything, I just want it to be instant, just so that the user doesn't see it has anything to do with Word.

So far, the button only updates the database.

I am willing to spend time reading about new languages or anything that would provide a solution preventing me to build another app or another Word Template. I'd like to work with what I already have available... if possible of course.

Edit: **What I have : A working app to manage customers and my database A .docx template file with text zones that I fill from the DB

**What I need : A way to fill in the blanks in my contratcs with C# without opening Microsoft Word. + print that file.

Upvotes: 0

Views: 410

Answers (1)

Mark Lakata
Mark Lakata

Reputation: 20838

If you want to just print something, I would avoid using Word for that, and use PDF as the intermediate file. You could try itextsharp (free) library.

Upvotes: 1

Related Questions