4.20 FAQ-379 如何获取列的名称,单位等?

Last Update: 10/26/2022


使用列标签字符

例如:

// Gets or sets the long name of first column in active sheet
col(1)[L]$ = ;

// Gets or sets the units of first column in active sheet
col(1)[U]$ = ;

// Gets or sets first Parameter row of first column in active sheet
col(1)[P1]$ = ; 

// Gets or sets first User Defined row of first column in active sheet
col(1)[D1]$ = ;

col() 只接受列名或索引作为参数。如果您需要使用计算得出列号,请使用 wcol()。 例如:

//Gets or sets the comments of the column with the short name 'ii' in active sheet
//Does not return the third column. 
ii=3;
col(ii)[C]$ = ;
//Gets or sets the F(x)= formula of the third column in the active sheet
ii=3;
wcol(ii)[O]$ = ;
//Loop through worksheet setting every even-numbered-column comment equal to the units of the column before it for the active sheet
nCols=wks.GetNumCols();
for (ii=0;ii<nCols;ii=ii+2){
wcol(2+ii)[C]$=wcol(1+ii)[U]$;
};
:列标签行都是具有字符串属性的,所以需要将其赋予给字符串变量。

Keywords:header, labels, 表头,标签