Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If a multidimensional array (Object[,]) or a jagged array (Object[][]) contains multiple rows, PowerPointWriter will import all the rows using built-in repeating behavior. To import a single row of data using a multidimensional or jagged array, the array can only contain a single row of data. For more information about using arrays to import multiple rows of data, please see Importing Multiple Rows of Data.

Example:
One dimensional array:

Code Block
csharp
csharp
titleC#
            string[] values = {"Hello World", "subtitle"};
            string[] colNames = {"header", "subtitle"};
            DataBindingProperties DataProps = pptt.CreateDataBindingProperties();

            pptt.BindData(values, colNames, "DataSource1", DataProps);
Code Block
vbnet
vbnet
titlevb.net
        Dim values = New String() {"Hello World", "subtitle"}
        Dim colNames = New String() {"header", "subtitle"}
        Dim DataProps As DataBindingProperites = pptt.CreateDataBindingProperties();

        pptt.BindData(values, colNames, "DataSource1", DataProps);

Two dimensional array:

Example

Code Block
csharp
csharp
titleC#


          PowerPointTemplate pptt = new PowerPointTemplate();
          pptt.Open(@"C:\DataBinding\ArrayBindingTemplate.pptx");
          string[][] twodim = {
               new string[]{"Watertown", "MA", "02472"},
               new string[]{"Washington", "DC", "20500"}
               };
          string[] names = {"City", "State", "Zip"};
          pptt.BindData(twodim,
               names,
               "TwoDimArray",
               pptt.CreateDataBindingProperties());
          pptt.PreserveStrings = true;
          pptt.Process();
          pptt.Save(Page.Response,
               "ArrayBinding.pptx",
               false);
        
Code Block
vb.net
vb.net
titlevb.net


          Dim pptt As New PowerPointTemplate()
          pptt.Open("C:\DataBinding\ArrayBindingTemplate.pptx")
          Dim twodim()() As String = New String()() { _
               New String(){"Watertown", "MA", "02472"}, _
               New String(){"Washington", "DC", "20500"}, _
               }
          Dim names As String() = {"City", "State", "Zip"}
          pptt.BindData(twodim, _
               names, _
               "TwoDimArray", _
               pptt.CreateDataBindingProperties())
          pptt.PreserveStrings = True
          pptt.Process()
          pptt.Save(Page.Response, _
              "ArrayBinding.pptx", _
               False)
        

Custom objects

TO FILL IN AFTER THE MULTIPLE ROWS WITH NOTE ABOUT "ONLY 1 ROW OF DATA"

...