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;
}
}