2.42.13 LabelVisible
Description
Show or hide some labels on worksheet
Syntax
VB: Property Get/Let LabelVisible(Type As ByVal LABELTYPEVALS ) As Boolean
C++: bool LabelVisible(LABELTYPEVALS Type )
C#: bool LabelVisible(LABELTYPEVALS Type )
Parameters
- Type
- one of the LABELTYPEVALS enumeration. For example LT_LONG_NAME
Remark
Examples
VBA
Connect to the running Origin. We will set some labels of the sheet as visible. You can see result in Origin. Then, get the status of all labels, and output them to Excel sheet.
Public Sub getLabelVisible()
Dim app As Origin.ApplicationSI
Dim Wks As Origin.Worksheet
Dim Data(1 To 100) As Double
Dim bRet As Boolean
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 labels as visible
Wks.Labels ("LUSE") 'Set "LongName", "Units", "Spark line" and "Even Sampling" labels as visible
Wks.Columns(0).LongName = "Temperature"
Wks.Columns(0).Units = "C degree"
bRet = Wks.Columns(0).SetEvenSampling(0, 20)
'Send data to the column
Wks.Columns(0).SetData (Data)
'Get status from Origin, and output to Excel sheet
Range("A1") = Wks.LabelVisible(LT_LONG_NAME)
Range("A2") = Wks.LabelVisible(LT_UNIT)
Range("A3") = Wks.LabelVisible(LT_COMMENT)
Range("A4") = Wks.LabelVisible(LT_SPARKLINE)
Range("A5") = Wks.LabelVisible(LT_SAMPLE_RATE)
Range("A6") = Wks.LabelVisible(LT_PARAM)
Range("A7") = Wks.LabelVisible(LT_USER_DEF_LABEL)
End Sub
VB
Sub LabelVisible()
Dim app As Origin.IOApplication
Dim wks As Origin.Worksheet
app = New Origin.ApplicationSI
wks = app.FindWorksheet("")
If wks Is Nothing Then
MsgBox("Can not find active worksheet")
Exit Sub
End If
wks.LabelVisible(Origin.LABELTYPEVALS.LT_UNIT) = False 'hide Unit on each column
End Sub
C#
using System; // for Console
using Origin; // for Origin
static void WriteLineVisibleState(string strLabel, bool bVisible)
{
Console.Write(strLabel + " label is ");
if( bVisible )
Console.WriteLine("Visible");
else
Console.WriteLine("Hidden");
}
static void OutputLabelsVisible()
{
ApplicationSI app = new ApplicationSI();
Worksheet wks = app.FindWorksheet(""); // Get the active worksheet
WorksheetPage wbook = (WorksheetPage)wks.Parent; // Get workbook
Console.WriteLine("Active worksheet is " + wks.Name + " in workbook " + wbook.Name);
WriteLineVisibleState("Comment", wks.get_LabelVisible(Origin.LABELTYPEVALS.LT_COMMENT));
WriteLineVisibleState("Long Name", wks.get_LabelVisible(Origin.LABELTYPEVALS.LT_LONG_NAME));
WriteLineVisibleState("Parameter", wks.get_LabelVisible(Origin.LABELTYPEVALS.LT_PARAM));
WriteLineVisibleState("Sparkline", wks.get_LabelVisible(Origin.LABELTYPEVALS.LT_SPARKLINE));
WriteLineVisibleState("Unit", wks.get_LabelVisible(Origin.LABELTYPEVALS.LT_UNIT));
Console.WriteLine("\nPress a key to exit.");
Console.ReadKey();
}
Version Information
8.0SR2
See Also
Labels | Column.LongName | Column.Units | Column.Comments
|