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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 import_file() and int nIndexLayer

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Alexander N Posted - 10/06/2009 : 06:51:05 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR6
Operating System:Win XP Pro

Hi guys,

I might have found a bug: If I add a new layer to the active worksheet and use then import_file with nIndexLayer = 1 or 2 for the just added new layer, I get an import error.

If I use nIndexLayer=0 I can import the data, but then my old sheet is overwritten. Here's a code snippet based on the help file:

bool importCVC(string strFile) {
	LT_execute("run.LoadOC(Originlab\FileImport.c, 16);");
	Page pg = Project.Pages(); // Active Page
	string strPageName = pg.GetName();
	pg.AddLayer("fit");
	pg = Project.Pages();

    // Get page active layer index
    int nIndexLayer = pg.Layers().GetIndex()+1;
    
    // specify .oif filter name
    string strFilterName = "Test";
 
    int nRet = import_file(strPageName, nIndexLayer, strFile, strFilterName);
 
 
    if ( 0 == nRet ) {
        out_str("Success to import!");
    	return true;
	} else {
        out_str("Failed to import!");
        return false;
	}
}
2   L A T E S T    R E P L I E S    (Newest First)
Alexander N Posted - 10/09/2009 : 07:33:54 AM
Ok, thanks a lot. This solution works better than mine.
Iris_Bai Posted - 10/08/2009 : 10:14:33 PM
Hi,

nIndexLayer is 0 offset. Please use the following code to get the index of newly added layer.

int nIndexLayer = pg.AddLayer("fit");

Iris

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000