...
Code Block |
---|
WT.Save(Page.Response, "Part1_Output.docx", false); |
The final output should resemble this:
Final Code
Code Block |
---|
using SoftArtisans.OfficeWriter.WordWriter;
...
//Instantiate a new WordTemplate object
WordTemplate WT = new WordTemplate();
//Open the template file
WT.Open(Page.MapPath("//templates//Part1_Invoice_Template.docx"));
//Create the array of details values
object[] detailsArray = { "Jane", "Doe", DateTime.Now.ToString("MM/dd/yy"), "104.97", "4.46", "109.43" };
//Create the array of column names
string[] detailColNames = {"FirstName", "LastName", "Date", "Subtotal", "Tax", "Total" };
//Get the order info datatable using GenericParser
DataTable dtOrderInfo = GetCSVData("//data//OrderInfo.csv");
//Set the data sources to import a single row of data for each source
WT.SetDataSource(dtOrderInfo);
WT.SetDataSource(detailsArray, detailColNames, "OrderDetails");
//Process to import the data to the template
WT.Process();
WT.Save(Page.Response, "Part1_Output.docx", false);
|
Downloads
You can download the code for the Basic WordWriter Tutorials as a Visual Studio solution, which includes the Simple Expense Summary.
- TODO: Add Link