The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Delete columns in a project
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bbb208

USA
6 Posts

Posted - 12/19/2014 :  6:22:19 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,

I have 50 workbooks in a origin project, I need delete 10 (e.g. 1, 5, 10...) columns of each workbook. Does anybody know how to do this with Labtalk or Origin C?

Thanks a lot

cdrozdowski111

USA
247 Posts

Posted - 12/19/2014 :  8:36:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi bbb208,

Based on the information you provide - "(e.g. 1, 5, 10...)", the columns you want to delete do not follow a regular interval, so you can get what you want by modifying the following simple LabTalk script.

The script loops through every single worksheet in your whole project and deletes the columns specified by their index in the "delete col(#);" LabTalk commands.

1) Make a copy of your project file for backup.
2) Open the Script Window.
3) From the Script Window Edit menu, set the execution to "None".
4) Copy and paste the below script into the window.
5) Add/remove/modify as many "delete col(#)" commands as you need. (Heed comments in script!!!)
6) From the Edit menu, set the execution to "LabTalk".
7) Select/highlight all the script and press the Enter key on your keyboard. The script will run.


// Loop through all worksheets in entire project
doc -e LB {

	// Delete columns by column index (indices start at 1 from left to right)
	// BUT, you MUST delete from highest index to lowest (delete from right to left)

	delete col(10);
	delete col(5);
	delete col(1);
}


For more information abotu looping through obejcts in your project, see:
http://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs#Looping_over_Workbooks_and_Worksheets
http://www.originlab.com/doc/LabTalk/ref/Document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000