NewDataRange

From OriginLab Wiki

(Difference between revisions)(Link to this page as [[OriginCOM:Worksheet-NewDataRange]])
Jump to: navigation, search
Revision as of 01:11, 11 August 2008 (edit)
Cpyang (Talk | contribs)
(Description)
← Previous diff
Revision as of 10:02, 20 August 2008 (edit) (undo)
Uploader (Talk | contribs)

Next diff →
Line 1: Line 1:
{{DISPLAYTITLE:NewDataRange}} {{DISPLAYTITLE:NewDataRange}}
 +[[category:PM]]
==Description== ==Description==
Line 6: Line 7:
==Syntax== ==Syntax==
<code><pre> <code><pre>
-VB: Function NewDataRange([ TypeOrRange1 As ByVal Object ], [ RangeNext1 As ByVal Object ], [ RangeNext2 As ByVal Object ], [ RangeNext3 As ByVal Object ], [ RangeNext4 As ByVal Object ] ) As DataRange+VB: Function NewDataRange([ r1 As ByVal Object ], [ c1 As ByVal Object ], [ r2 As ByVal Object ], [ c2 As ByVal Object ] ) As DataRange
</pre></code> </pre></code>
<code><pre> <code><pre>
-C++: DataRange NewDataRange(Variant TypeOrRange1, Variant RangeNext1, Variant RangeNext2, Variant RangeNext3, Variant RangeNext4 )+C++: DataRange NewDataRange(_variant_t r1, _variant_t c1, _variant_t r2, _variant_t c2 )
</pre></code> </pre></code>
<code><pre> <code><pre>
-C#: DataRange NewDataRange(Variant TypeOrRange1, Variant RangeNext1, Variant RangeNext2, Variant RangeNext3, Variant RangeNext4 )+C#: DataRange NewDataRange(var r1, var c1, var r2, var c2 )
</pre></code> </pre></code>
==Parameters== ==Parameters==
-; TypeOrRange1+; r1
-:: --+: --
-; RangeNext1+; c1
-:: --+: --
-; RangeNext2+; r2
-:: --+: --
-; RangeNext3+; c2
-:: --+: --
-; RangeNext4+
-:: --+
==Return== ==Return==

Revision as of 10:02, 20 August 2008


Contents

Description

Creating a DataRange object.

Syntax

VB: Function NewDataRange([ r1 As ByVal Object ], [ c1 As ByVal Object ], [ r2 As ByVal Object ], [ c2 As ByVal Object ] ) As DataRange
C++: DataRange NewDataRange(_variant_t r1, _variant_t c1, _variant_t r2, _variant_t c2 )
C#: DataRange NewDataRange(var r1, var c1, var r2, var c2 )

Parameters

r1
--
c1
--
r2
--
c2
--

Return

Remark

Examples

VBA

Connect to the running Origin. Set a new data range in the active worksheet, and then send data to it. You can see the result in Origin.

Public Sub NewDataRange()
    Dim app As Origin.ApplicationSI
    Dim Wks As Origin.Worksheet
    Dim range As Origin.DataRange
    Dim Data1(1 To 100) As Double
    Dim Data2(1 To 100) As Double
    Dim ii As Integer
    For ii = 1 To 100
        Data1(ii) = ii * 0.125
        Data2(ii) = ii + 3.75
    Next
 
    Set app = New Origin.ApplicationSI
    Set Wks = app.FindWorksheet("")
 
    'Set the new range, which starts from row 0 and col 0
    Set range = Wks.NewDataRange(0, 0)
    range.SetData (Data1)   'Send 1D data array to this range
 
    'Set another new range, which starts from row 0 and col 1
    Set range = Wks.NewDataRange(0, 1)
    range.SetData (Data2)
 
End Sub

C#

using Origin;
static void NewDataRange()
{
    object Default = System.Type.Missing;
    double[] Data1 = new double[100];
    double[] Data2 = new double[100];
    for (int ii = 0; ii < 100; ii++)
    {
        Data1[ii] = ii * 0.125;
        Data2[ii] = ii + 3.75;
    }
 
    Origin.ApplicationSI app = new Origin.ApplicationSI();
    Worksheet wks = app.FindWorksheet("");
 
    DataRange range = wks.NewDataRange(0, 0, 0, -1, -1);
    range.SetData(Data1, Default, Default);
 
}

Version Information

8.0SR2

See Also

DataRange.SetData