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
 Forum for Origin C
 WorkBook. Worksheet management
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dkudlay

USA
22 Posts

Posted - 06/07/2010 :  8:51:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.1
Operating System: XP

Hello, In my application, there will be a lot of worksheets / matrices generated. I am looking for a best way to manage worksheets. One idea I have is to maintain a Book with all worksheets as separate tabs. I am having difficulty finding the methods I need to get this accomplished.
wks.Create() nor okoc_create_workbook() give me ways to Modify Long AND Short names. And I can't find anywhere the name of the template that is used by wks.Create() to use with okoc_create_workbook that would generate similar Workbook as created by default by Origin (With first 3 rows yellow). I also can't seem to find any functions to add and remove the worksheet to a book. Help please.

Summary -
1) - Access and modify Workbook Long and Short names.
2) - Template name to create standard workbook (Workbook, Book doesn't work)
3) - API to Attach and Remove Worksheets to/from Workbook.

Thank you,

Dimitry.

Penn

China
644 Posts

Posted - 06/08/2010 :  05:20:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dimitry,

1)
In the OriginObject class, four methods are provided for accessing and modifying Workbook Long and Short names. They are GetName, GetLongName, SetName and SetLongName.

2)
The default template name is "Origin". If no changes have been done on this default template, the following code can be used to create a new workbook by using "Origin" template.

void testCreate()
{
	WorksheetPage wp;
	wp.Create("Origin");
}

You can refer to Create method for more information.

3)
Every worksheet has its own workbook, if you want to "attach" one worksheet to another workbook, you can use the AddLayer method to add the current worksheet to another workbook, and then use the Destroy method to remove the current worksheet. For example:

void testAddLayer()
{
	Worksheet wks = Project.ActiveLayer();  // get the active worksheet
	WorksheetPage wp; 
	wp.Create("Origin");  // create a new workbook
	wp.AddLayer(wks);  // add the active worksheet to the newly created workbook
	wks.Destroy();  // destroy the active worksheet
}


Penn
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