2.5.3 Comments


Description

Set and get the comments of a Worksheet Column object.

Syntax

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

Remark

Examples

VBA

This example will connect to the running Origin, set the first column's properties, send data to the column, and then it will copy the column's properties into the Excel worksheet.

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 | Units | Worksheet.Labels | Worksheet.LabelVisible