0

I have a .NET Core 3.0 project, building an Angular web app.

This app has a fairly complicated form system.

In the past this form was actually housed inside of Access, and then VB was used to dump the values into the docx version of the form via the bookmarks.

This whole process is now getting put into our new Angular app.

I need an established method for grabbing the form controls, grabbing the existing docx, and putting those form control values into the docx.

Sadly, there does not seem to be anything that does this. Docxtemplater is weighty, not very well documented, and not a route I would like to take. I would prefer something inside .NET Core to allow this to happen.

I wish I could just execute the old VB script from inside my project to generate the form as it worked flawlessly.

I have tried docxtemplater. I have tried the docx nuget package.

milo
  • 445
  • 5
  • 12
Adam Raetz
  • 61
  • 5
  • .net core (cross-platform portable) and docx (vendor-specific format) naturally do not play well together. docx are zipped collections of opendocumentxml files, so at least there will be a way without automating winword.exe - how did you do it from VB, by instantiating word? pure library/tool requests are off topic. – Cee McSharpface Nov 05 '19 at 16:53
  • 1
    Could you convert the old VB code into method(s) inside the .net Core ? there are tons of VB => C# converters out there that can get you going in the right direction. Better yet, get that old VB code converted into a reusable library/service for future projects that might need it. – PeonProgrammer Nov 05 '19 at 16:54
  • @PeonProgrammer old .NET code is unlikely to be compatible with a .NET core project – James T Nov 18 '19 at 14:24
  • @CeeMcSharpface-it on the contrary, they play very well together. `docx` is a zip package containing XML documents according to the well-defined Open XML format. That's the very reason `docx` and `xlsx` were created. That's what allows *Angular* libraries to generate docx and xlsx files client-side. It's just that most people are interested in *Excel*, not Word – Panagiotis Kanavos Nov 18 '19 at 14:58
  • that's what I wrote: "docx are zipped collections of opendocumentxml files" and "there will be a way without automating winword.exe". that's no contradiction; yet there used to be a choice on first startup of winword, asking for maximum compliance or maximum fidelity - a poor choice either way, sticking with Microsoft specifics not understood by other editors, or losing layout capabilities. – Cee McSharpface Nov 18 '19 at 15:02
  • @AdamRaetz one could say this question is a duplicate of [this one](https://stackoverflow.com/questions/49685641/create-docx-word-document-web-api-net-core-2-0). The answer shows how to use the OpenXML SDK directly to generate docx files.This is far easier than using Access and VB.NET even for .NET Framework projects. Another option would be to use one of the many Javascript or Angular libraries that generate `docx` directly, like [docx](https://www.npmjs.com/package/docx). What you choose depends on your actual requirements – Panagiotis Kanavos Nov 18 '19 at 15:03
  • @CeeMcSharpface-it it's not `at least there will be a way`, it's `that's why it was created in the first place`. To allow Office file generation without having the correspoinding apps installed. There was [a patent lawsuit back](https://en.wikipedia.org/wiki/I4i#Patent_dispute) in 2003 that prevented MS from integrating XML into Word, so they went full XML. – Panagiotis Kanavos Nov 18 '19 at 15:05
  • ok point in case :) MS still has a way to create docx that are not strictly Open Office XML compliant though, somewhat foiling the cross-platform standardization effort. – Cee McSharpface Nov 18 '19 at 15:08

0 Answers0