This tool will parse an existing docx file and merge it with for example json data. And saves the merged document (result) as a new docx file which can be downloaded. It has a lot of nice and powerful options, like insert table data, images (qr), etc.
I have downloaded the source.zip but I see all kind of .ts files (TypeScript). So no JavaScript.
My question is: Can this tool be implemented in a NetTalk Web project? That would be very cool!! A complete web mail merge solution!
I don’t know enough about the repo, but you maybe able to implement docx-templates in a NetTalk Web project, but since it’s written in TypeScript (TS), you’ll need to transpile it into JavaScript (JS) first. Tools like Visual Studio Code with TypeScript extensions make this process simple. Once installed, you can use the TypeScript compiler (tsc) to convert the .ts files into .js files.
NetTalk allows you to call JavaScript functions directly from your web application, so once the TypeScript code is transpiled into JavaScript, you can integrate the resulting .js files into your project and call the functions as needed. (A hole other topic)
I hadn’t studied the repo in detail but noticed it’s TypeScript-based. If Node.js is required (which appears to be the case for docx-templates), you could create a Node.js server app acting as an API. This API could run on a different port or be hosted separately. Your NetTalk Web Server would send a request to the API and consume the returned result.
It’s definitely doable, though it would introduce you to some new technologies in the process, If you’re up for the challenge.
I have developed a similar solution with office inside long ago. With the same logic for excel and word too. I have even developed the template that extract info from cpcs reports and creates excel output on the fly. At the time I struggled to explain the idea to my boss so I took the liberty to do it quickly , while he was 3 days on vacation
I have embedded in the excel “template” also some logic for filtering and totaling.
It was fun and I repeated the same idea in c# and php for some other projects.
Imagine that you have a special sheet where you format excel cells. For example bold, underline, number format.
After filling the report sheet you can remove the template sheet. The logic is same for word.
Everything doable with office inside.
And doable also with php so web solution.
But you are talking about nettalk web solution.Since this will be hosted locally by you I suppose it is no problem to create a c# project that will open a tcp socket where your nettalk web will send info what to merge and how. Never done nettalk web but nettalk yes and I suppose you can open from nettalk web a socket to your local server.
I’m looking for a pure Web solution and docx-templates could be the solution if I can make it work with NetTalk. There’s no MS Word at server side, so we can’t use CS Office Inside, which would be a too heavy server load btw.
My program heavily uses merging Html and Rtf for resp. E-mails and letters. The Html templates with merge tokens are made with a stand alone editor (window forms Text Control). The Rtf templates with merge tokens are made with a stand alone version of MS Word, merged and opened in the same Ms Word before printing. I first tried it with the Clarion rtf editor (available in Anyscreen) but it doesn’t allow columns which i need for ie invoice line items.
I asked Marko Golem if i can use the same technique in a AnyScreen App? Or do i need a server side editor like Word 365 or …?
He answerd:
You can use javascript object which can hold any html / javascript page. You can check provided AnyScreen demo application in your clarion examples folder.