I have a template that I want to populate a table using smart markers. Unfortunately, when using the smart marker in the table it inserts rows in the entire sheet which damages other rows outside of the table.
Using the “noadd” option prevents the other tables from being damaged, but it does not expand the table range so it does not solve the issue.
Please advise how to accomplish this.
private class SampleData
{
public string Col1 { get; set; }
public string Col2 { get; set; }
public string Col3 { get; set; }
}
private static string tableSample()
{
WorkbookDesigner wbd = new WorkbookDesigner();
var templatePath = @"table_sample.xlsx";
var testPath = $@"table_sample_{DateTime.Now.ToString("ddMMMyy_hhmmss")}.xlsx";
var testList = new List<SampleData>();
for (int i = 0; i < 5; i++)
{
testList.Add(new SampleData
{
Col1 = i.ToString(),
Col2 = i.ToString(),
Col3 = i.ToString()
});
}
Workbook workbook = new Workbook(templatePath);
wbd.Workbook = workbook;
wbd.SetDataSource("Test", testList);
wbd.Process();
wbd.Workbook.Save(testPath);
return testPath;
}
actual.png (3.2 KB)
template.PNG (2.6 KB)
desired.PNG (2.7 KB)