Message-ID: <2057723792.8041.1711629798962.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8040_1353623609.1711629798962" ------=_Part_8040_1353623609.1711629798962 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The BindCellData method is used to assign single values to data m=
arkers with ExcelTemplate.
To mark where single values on a template would go, place a single objec= t data marker, formatted:%%=3D$variablename.
=20 =20public class StringDataSource { private string recipientName; private string recipientCompany; /// <summary> /// Build the report with ExcelTemplate /// </summary> public void GenerateReport() { this.recipientName =3D "Jon Smith"; this.recipientCompany =3D "SoftArtisans"; // Create an instance of SoftArtisans ExcelTemplate ExcelTemplate xlt =3D new ExcelTemplate(); // Open the template workbook string templatePath =3D @"..\..\ExcelTemplateF= iles\StringDataSourceTemplate.xlsx"; xlt.Open(templatePath); // Bind the variables to the template datamarkers // %%=3D$RecipientName xlt.BindCellData(recipientName, "RecipientName", xlt.= CreateDataBindingProperties()); // %%=3D$RecipientCompany xlt.BindCellData(recipientCompany, "RecipientCompany"= , xlt.CreateDataBindingProperties()); // Process the template to populate it with the Data Source dat= a xlt.Process(); // Save the report by streaming to the client xlt.Save(@"..\..\ExcelOutputFiles\StringDataSource_output.= xlsx"); } }=20