Message-ID: <415811969.8335.1711642737655.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8334_416948590.1711642737655" ------=_Part_8334_416948590.1711642737655 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Data Marker Options

Data Marker Options

Intro

Data markers have mult= iple switches and options that are available for use in ExcelTemplate workb= ooks.

The Data Marker Options used in this example are:

Code

=20
public class DataMarkerOptions
    {
 
        /// <summary>
        /// Build the report with ExcelT=
emplate
        /// </summary>
        public void GenerateReport()
        {
              // This 2D =
Object[][] array will hold the values to be imported

              object[,] values =3D {
                              //employee ID 
                              {1, 2, 3, 4},
                              //Last Name   
                              {"Davolio", "Fuller", &qu=
ot;Leverling", "Peacock"},
                              //First Name 
                              {"Nancy", "Andrew", "=
;Janet", "Margaret"},
                              //Title
                              {"Sales Rep", "VP of Sales&quo=
t;, "Sales Rep", "Sales Rep"},
                              //Zip         
                              {"02139","02144","23=
451","00213"}
                            };

 
            // These=
 are the field names
            string[]=
 colnames =3D { "EmployeeID", "LastName", "FirstNa=
me", "Title", "Zip" };
 
            // Creat=
e an instance of ExcelTemplate
            ExcelTem=
plate xlt =3D new ExcelTemplate();
 
            // Open =
the template workbook
                    =
    string templatePath =3D @"..\..\ExcelTemplateFiles\DataMarkerOptio=
nsTemplate.xlsx";

            xlt.Open=
(templatePath);
 
            // Pass =
colnames and values arrays to BindData()
            DataBind=
ingProperties bindingProperties =3D xlt.CreateDataBindingProperties();
            bindingP=
roperties.MaxRows =3D ExcelTemplate.ALL_ROWS;
            bindingP=
roperties.Transpose =3D true;
            xlt.Bind=
Data(values, colnames, "dSource", bindingProperties);
 
            // Call =
the process() method to populate the template with the data source values
            xlt.Proc=
ess();
 
            // Save =
the report
            xlt.Save=
(@"..\..\ExcelOutputFiles\DataMarkerOptions_output.xlsx");
         }
    }
=20

Downloads

------=_Part_8334_416948590.1711642737655--