Open remesq opened 2 years ago
Hi, Yes it's possible.
I don't know about MVC/Razor, but here's an example with WPF, creating a visual with fields, a comboBox and a button to click to create the docx invoice, based on a template invoice as in the Words sample.
I have an object Client, with the different properties which are the visual field. When they are filled, I pass this Client object to the CreateInvoiceFromTemplate() method to replace the template document custom properties with ones the Client object contains.
Here's the full example: 418.txt
Thank you.
Much appreciated @XceedBoucherS. This is right on point.
I'm wondering if there is a way to set this up using an intranet. I was looking at the Invoice Sample, and it's actually spot on with what I am looking to do. I just can't figure out the best way to hook this up so that I can just input the information into some text fields or other controls (radio button, etc.). I use MVC/Razor web pages to input data for other stuff, and I was thinking to leverage that to just fill in the Invoice data and then click a button to generate a Word file.
I was thinking to just try using a call to, for example,
CreateInvoice()
on a button click and then hooking my models properties in to replace theCustomProperty
, but it isn't that easy, is it? So, something like:templateDoc.AddCustomProperty( new CustomProperty( "InvoiceNumber", new invoiceNumber ) );
Basically, I am just trying to determine if DocX would work for me before I go further, and needed to test it out.
Does anyone know of any resources to accomplish something like this. I tried looking through the documentation but nothing stood out. If I missed something obvious forgive me in advance.