Author |
Topic  |
|
klunz
Germany
Posts |
Posted - 09/22/2008 : 10:22:14 AM
|
Hi there,
I have the following problem: I am currently writing a Program in OriginC that is suppossed to import two Origin-Projects and plot the data of the 2 projects in one Graph.
The Problem is, each of the potentially imported Origin-Projects contains a table called "Results" with up to 4 Colums: The first column, labeled "Frequency" is allways there, but Columns 2-4, labeled "Absorption", "Extinction" and "Transmission" are optional. They can all be in the file, or just two of them or just one, depending on the things the person using it needs.
To know whats being ploted I would like to read the names of the columns in that worksheet, but I cant find any method to do so. There is "wks.cName$" and wks.ColNum(Name), which i tried to use (the code was something like "string test = Results.cName1; and "double test = wks.ColNum(Absorption)) but neither worked.
To me it seems the problem is that the worksheets are imported and not generated in the program, so there is no declaration, hence the methods are not accepted. I havent found a workaround for this however.
I couldnt find anything other than the above in the help, is there something else maybe in labtalk?
Thanks in advance for your help, have a nice day
Tobi |
|
klunz
Germany
Posts |
Posted - 09/22/2008 : 10:29:45 AM
|
Hm, sorry for the double post, but i get a VBruntime error when trying to edit.
I just wanted to clarify: lets say one of the imported "Results"-Worksheets contains 3 columns, "Frequency", "Absorption" and "Transmission", but the second worksheet contains all four columns, i would like to create one Graph with the two Transmission datasets and one graph with the two Absorption datasets, nothing else. Thats why I need to know whats in which column, and therefore need to read out the column names.
I hope now its understandable ;)
Greetings Tobi |
 |
|
cpyang
USA
1406 Posts |
Posted - 09/22/2008 : 12:43:44 PM
|
Are you using VB? If you are using VB and call Origin via Automation, then the answer is very different then if you are using Origin C and running Origin C via a LabTalk script.
CP
|
 |
|
klunz
Germany
Posts |
Posted - 09/23/2008 : 05:08:40 AM
|
Sorry, that might have been confusing. The runtime VB Error was here, in this forums software.
For the program I dont use VB, its plain OriginC-Code called from within Origin.
Greetings Tobi |
 |
|
greg
USA
1379 Posts |
Posted - 09/23/2008 : 09:03:48 AM
|
The Column class has the methods you need. You don't mention whether these names are the Long Names (AKA Column Labels prior to 8) or the Short Names (AKA Column Names), so here are both:
void AccessNames(string strWks) { // We can access a worksheet by name Worksheet wks(strWks); Column col; string strSN, strLN; // Then use C# to go through the collection of Columns foreach(col in wks.Columns) { col.GetName(strSN); printf("Short Name is %s\n", strSN); strLN = col.GetLongName(); printf("Long Name is %s\n", strLN); } }
|
 |
|
klunz
Germany
Posts |
Posted - 09/25/2008 : 04:57:15 AM
|
Thank you very much. GetLongName is not accepted by the compiler (Im still working with Origin 7.5, maybe thats why), but GetName is working just fine and exactly what I need.
Thanks again Tobi
|
 |
|
|
Topic  |
|
|
|