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
 Origin Forum
 How do you obtain wks name?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

northpig87

Canada
2 Posts

Posted - 03/05/2009 :  2:05:56 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Pro8 SR4 V8.0951(B951)
Operating System: WINDOWS XP SP2

Hello everyone, first post here

I have an Origin C code that does fit to a series of worksheet. the problem is I need to specify each worksheet's name in column#1 of a seperate worksheet. So i'm wondering if there's an easier way to fill up a worksheet's column with the names of the other worksheets within the folder.

my stupid attempt was renaming my files to 5 10 15 20 etc (simple name) which is easy to fill up a column with their names but I get the following message:

Illegal Worksheet name:
0 Modified to
A0

Illegal Worksheet name:
5 Modified to
A5

><. So a worksheet name cannot be a simple number?

Thank you so much!!!

GZ_MOD

9 Posts

Posted - 03/05/2009 :  10:32:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Worksheet name must begin with character, cannot be numeric. So if set worksheet name to 10, will auto change to A10.
By the way, you can try to worksheet page name:
void test_get_name()
{
Worksheet wks = Project.ActiveLayer();
string str = wks.GetPage().GetName();
out_str(str);
}

In Origin can put string to worksheet, so no need set worksheet name to numeric. Please change back worksheet name to string and try the following codes to put page names of other worksheet in this folder to the active worksheet first column.


// put other worksheet names to this active worksheet.
void PutNameToWks()
{	
	Worksheet wks = Project.ActiveLayer(); 
	
	int nCol = 0; // put to first column
	int nRow = 0;
	
	string strName;
	Folder fld = Project.ActiveFolder();
	foreach(PageBase page in fld.Pages) 
    {
    	if(EXIST_WKS == page.GetType())
    	{
        	strName = page.GetName();
        	if( wks.GetPage().GetName() != strName )
        	{
	         	wks.SetCell(nRow, nCol, strName);
	        	nRow++;
	       		printf("%s\n", strName );   
        	}     	
    	}
    }
}



Iris Bai
OriginLab
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