I am trying to put data into cells using closedxml
and according to their site we have to set parameters like this on the cells {{TestName}}
but it won't work for me.
This is my code and I am not sure where I am going wrong.
const string outputFile = @"\\Reports\Output\Test.xlsx";
var template = new XLTemplate(@"\\Reports\Test.xlsx");
var test = new models.Test();
test.id = 1;
test.TestName = "ASDF";
test.TestScore = "303";
template.AddVariable(test) //also tried doing it like this.
template.AddVariable("TestScore", "232");
template.AddVariable("TestName", "TESTNAME");
template.SaveAs(outputFile);
Process.Start(new ProcessStartInfo(outputFile) { UseShellExecute = true });
And my excel template looks like this.
Solved it!
Just add template.Generate();
after adding the variables into the template.