Copy Sparkline by Specifying Data Range and Location of Sparkline Group

[ ]

To copy a sparkline to other cells in Microsoft Excel:

  1. Select the cell containing the sparkline.
  2. Select Edit Data from the Sparkline section of the Design tab.
  3. Select Edit Group Location & Data.
  4. Specify the data range and location.
  5. Click OK.

Aspose.Cells provides the SparklineCollection.Add(dataRange, row, column) method to specify a sparkline group’s data range and location. The following sample code loads the source Excel file as shown in the screenshot above, then accesses the first sparkline group and adds data ranges and locations in the sparkline group. Finally, it writes the output Excel file on disk which is also shown in the screenshot above.