2.5.25 Units


Description

The Units as part of column property

Syntax

VB: Property Get/Let Units As String
C++: LPCSTR Units
C#: string Units

Remark

Examples

VBA

Connect to the running Origin. Set the properties of Column(0), and then send data to this column. You can see the result in Origin. Then, get the properties from Origin, and output them to Excel sheet.

Public Sub Setting()
    Dim app As Origin.ApplicationSI
    Dim Wks As Origin.Worksheet
    Dim Data(1 To 100) As Double
    Dim ii As Integer
    For ii = 1 To 100
        Data(ii) = ii * 0.375 + 274
    Next
 
    Set app = New Origin.ApplicationSI
    Set Wks = app.FindWorksheet("")
 
    'Set the ShortName of the column
    Wks.Columns(0).Name = "CH1"
    'Set the Type of the column
    Wks.Columns(0).Type = COLTYPE_Y
    'Set the LongName of the column
    Wks.Columns(0).LongName = "Temperature"
    'Set the Units of the column
    Wks.Columns(0).Units = "C Degree"
    'Set the Comments of the column
    Wks.Columns(0).Comments = "example"
 
    'Send data to the column
    Wks.Columns(0).SetData (Data)
    
    'Get the properties of the column, and output them to Excel sheet
    Range("A1") = Wks.Columns(0).Name
    Range("A2") = Wks.Columns(0).Type
    Range("A3") = Wks.Columns(0).LongName
    Range("A4") = Wks.Columns(0).Units
    Range("A5") = Wks.Columns(0).Comments
 
End Sub

C#

Using Origin;
static void Setting()
{
    double[] Data = new double[100];
    for (int ii = 0; ii < 100; ii++)
    {
        Data[ii] = ii * 0.12 + 3.75;
    }

    Origin.ApplicationSI app = new Origin.ApplicationSI();
    Worksheet wks = app.FindWorksheet("");

    //Set the ShortName of the column
    wks.Columns[0].Name = "CH1";
    //Set the Type of the column
    wks.Columns[0].Type = COLTYPES.COLTYPE_Y;
    //Set the LongName of the column
    wks.Columns[0].LongName = "Temperature";
    //Set the Units of the column
    wks.Columns[0].Units = "C Degree";
    //Set the Comments of the column
    wks.Columns[0].Comments = "example";

    //Send data to the column
    wks.Columns[0].SetData(Data, 0);

    //Get the properties of the column, and output them to console
    Console.WriteLine(wks.Columns[0].Name + "\n"
                    + wks.Columns[0].Type + "\n" 
                    + wks.Columns[0].LongName + "\n" 
                    + wks.Columns[0].Units + "\n" 
                    + wks.Columns[0].Comments + "\n");

    Console.ReadLine();

}

Version Information

8.0SR2

See Also

SetData | Name | Type | LongName | Comments | Worksheet.Labels | Worksheet.LabelVisible