4.61 FAQ-872 Why can't I set column names in my script, e.g. using wks.addCol or wks.col.name?
Last Update: 4/27/2021
Starting with Origin 2017, workbooks support a simplified worksheet cell notation, similar to MS Excel. When this cell notation is turned on column Short Names are not editable and cannot be reordered, even via LabTalk.
In Origin 2017, Origin 2018, and Origin 2018b, workbooks created with LabTalk commands like
win -t or the X-Function
newbook have this column naming restriction turned off by default. But, starting with Origin 2019, those workbooks will have the column naming restriction turned on by default. This is a change that LabTalk scripters should take notice of.
If you want this restriction turned off so you can change column short names in a workbook created by either the
win -t command or the
newbook X-Function, you should run the following line code (assuming the new book is active):
page.XLColName=0; // remove column short name restriction
If you need the same code to work on Origin versions prior to 2017, then you can insert this variation before your renaming code:
If you are using Origin 2019 or later and want to make sure the column naming restriction is turned off for all calls to
win -t or
newbook without modifying each individual script, you can set the system variable
@RCN=7 in the System Variables dialog.
Keywords:short name restriction, spreadsheet cell notation, reorder