Spread for ASP.NET 11 Product Documentation
CopyTo Method (ExcelSparklineGroup)
Example 


FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > ExcelSparklineGroup Class : CopyTo Method
The one-dimensional System.Array that is the destination of the elements copied from ICollection. The System.Array must have zero-based indexing.
The zero-based index in array at which copying begins.
Copies the elements of the ICollection to a System.Array, starting at a particular System.Array index.
Syntax
'Declaration
 
Public Sub CopyTo( _
   ByVal array() As ISparkline, _
   ByVal arrayIndex As Integer _
) 
'Usage
 
Dim instance As ExcelSparklineGroup
Dim array() As ISparkline
Dim arrayIndex As Integer
 
instance.CopyTo(array, arrayIndex)
public void CopyTo( 
   ISparkline[] array,
   int arrayIndex
)

Parameters

array
The one-dimensional System.Array that is the destination of the elements copied from ICollection. The System.Array must have zero-based indexing.
arrayIndex
The zero-based index in array at which copying begins.
Exceptions
ExceptionDescription
array is null.
arrayIndex is less than 0.
array is multidimensional or arrayIndex is equal to or greater than the length of array or the number of elements in the source ICollection is greater than the available space from arrayIndex to the end of the destination array or the type ISparkline cannot be cast automatically to the type of the destination array.
Example
This example creates a sparkline in a cell.
fpSpread1.Sheets[0].RowCount = 10;
fpSpread1.Sheets[0].ColumnCount = 10;
fpSpread1.Sheets[0].SetClip(0, 0, 1, 5, "1\t2\t3\t4\t5");
fpSpread1.Sheets[0].SetClip(1, 0, 1, 5, "5\t4\t3\t2\t1");
fpSpread1.Sheets[0].SetClip(2, 0, 1, 5, "1\t2\t3\t2\t1");

FarPoint.Web.Spread.ExcelSparkline es = new FarPoint.Web.Spread.ExcelSparkline(0, 6, fpSpread1.Sheets[0], new FarPoint.Web.Spread.Model.CellRange(0, 0, 1, 5));
FarPoint.Web.Spread.ExcelSparkline es1 = new FarPoint.Web.Spread.ExcelSparkline(1, 6, fpSpread1.Sheets[0], new FarPoint.Web.Spread.Model.CellRange(1, 0, 1, 5));
FarPoint.Web.Spread.ExcelSparkline es2 = new FarPoint.Web.Spread.ExcelSparkline(2, 6, fpSpread1.Sheets[0], new FarPoint.Web.Spread.Model.CellRange(2, 0, 1, 5));

FarPoint.Web.Spread.ExcelSparklineGroup esg = new FarPoint.Web.Spread.ExcelSparklineGroup(new FarPoint.Web.Spread.ExcelSparklineSetting(), FarPoint.Web.Spread.SparklineType.Column);

esg.Add(es);
esg.Add(es1);
esg.Add(es2);
esg.Clear();
fpSpread1.Sheets[0].SparklineContainer.Add(esg);

FarPoint.Web.Spread.ISparkline[] dest = new FarPoint.Web.Spread.ISparkline[3];
int startIndex = 0;
esg.CopyTo(dest, startIndex);

FarPoint.Web.Spread.ExcelSparkline esl;
FarPoint.Web.Spread.ExcelSparkline esl1;
for (int i = 0; i < 3; i++)
{
    esl = (FarPoint.Web.Spread.ExcelSparkline)esg[i];
    esl1 = (FarPoint.Web.Spread.ExcelSparkline)dest[i];
    listBox1.Items.Add(esl.Row.ToString());
    listBox1.Items.Add(esl1.Row.ToString());
    listBox1.Items.Add(esl.Column.ToString());
    listBox1.Items.Add(esl1.Column.ToString());
    listBox1.Items.Add(esl.Formula.ToString());
    listBox1.Items.Add(esl1.Formula.ToString());
}
FpSpread1.Sheets(0).RowCount = 10
FpSpread1.Sheets(0).ColumnCount = 10
FpSpread1.Sheets(0).SetClip(0, 0, 1, 5, "1" + Chr(9) + "2" + Chr(9) + "3" + Chr(9) + "4" + Chr(9) + "5")
FpSpread1.Sheets(0).SetClip(1, 0, 1, 5, "5" + Chr(9) + "4" + Chr(9) + "3" + Chr(9) + "2" + Chr(9) + "1")
FpSpread1.Sheets(0).SetClip(2, 0, 1, 5, "1" + Chr(9) + "2" + Chr(9) + "3" + Chr(9) + "2" + Chr(9) + "1")

Dim es As New FarPoint.Web.Spread.ExcelSparkline(0, 6, FpSpread1.Sheets(0), New FarPoint.Web.Spread.Model.CellRange(0, 0, 1, 5))
Dim es1 As New FarPoint.Web.Spread.ExcelSparkline(1, 6, FpSpread1.Sheets(0), New FarPoint.Web.Spread.Model.CellRange(1, 0, 1, 5))
Dim es2 As New FarPoint.Web.Spread.ExcelSparkline(2, 6, FpSpread1.Sheets(0), New FarPoint.Web.Spread.Model.CellRange(2, 0, 1, 5))

Dim esg As New FarPoint.Web.Spread.ExcelSparklineGroup(New FarPoint.Web.Spread.ExcelSparklineSetting(), FarPoint.Web.Spread.SparklineType.Column)

esg.Add(es)
esg.Add(es1)
esg.Add(es2)
esg.Clear()
FpSpread1.Sheets(0).SparklineContainer.Add(esg)

Dim dest As FarPoint.Web.Spread.ISparkline() = New FarPoint.Web.Spread.ISparkline(2) {}
Dim startIndex As Integer = 0
esg.CopyTo(dest, startIndex)

Dim esl As FarPoint.Web.Spread.ExcelSparkline
Dim esl1 As FarPoint.Web.Spread.ExcelSparkline
For i As Integer = 0 To 2
    esl = DirectCast(esg(i), FarPoint.Web.Spread.ExcelSparkline)
    esl1 = DirectCast(dest(i), FarPoint.Web.Spread.ExcelSparkline)
    listBox1.Items.Add(esl.Row.ToString())
    listBox1.Items.Add(esl1.Row.ToString())
    listBox1.Items.Add(esl.Column.ToString())
    listBox1.Items.Add(esl1.Column.ToString())
    listBox1.Items.Add(esl.Formula.ToString())
    listBox1.Items.Add(esl1.Formula.ToString())
Next
See Also

Reference

ExcelSparklineGroup Class
ExcelSparklineGroup Members