I was assigned the following task: to create a document template (doc / excel) , and then in the application to fill in this template with data from the database and then send it to the service using the API.

Immediately in my head appeared the option of installing on the server with the application Microsoft Offic, a creation on this server of the Word / Excel templates, filling in and sending to the service, but I don't want to put Microsoft Office on the server with the application.

Then I thought about Google Docs, but the problem is that the application will be used in China, but they don’t have access to Google. Accordingly This option disappears.

Actually, what other options exist?

  • What is the office format? If docx / xlsx - use the OpenXML SDK. - Zufir
  • Yes, docx and xlsx. - Maxim Shinkarev
  • Are you even going to write on what? - tutankhamun
  • Application on c #, asp.net - Maxim Shinkarev

2 answers 2

As an option to use Visual Studio Tools For Office (VSTO). It is possible to create: Add-Ins and Templates for MS EXCEL, MS Word. In the MS Excel template code, add the process of loading data from the database, for example, on an event: opening an Excel workbook.

    I found an excellent library TemplateEngine.Docx, I work with it.

    No installation of Word'a on the server is required, while documents are quickly and simply processed.