【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.13.17 load_import_filter
Contents
Description
This function is used to load filter from file to tree.
Syntax
int load_import_filter(LPCSTR lpcszFilterName, LPCSTR lpcszDataFile, LPCSTR lpcszPageName, int nLocation, TreeNode& trFilter)
Parameters
- lpcszFilterName
- full path of filter file or filename only. If filename only, the path depend on nLocation.
- lpcszDataFile
- full path of data files.
- lpcszPageName
- target book name.
- nLocation
- 0 - Data file folder
- 1 - Origin working filter folder
- 2 - User filter folder
- 3 - In target Page
- 4 - Full path
- trFilter
- [output] filter tree.
Return
0 = success, -1 = failed, -2 = find function error.
Examples
Before compile this example please run run.LoadOC(Originlab\FileImport.c, 16); in Command Window to load all depentence source files.
#include <..\Originlab\FileImport.h> void load_import_filter_ex() { Page pg = Project.Pages(); // Active Page // Get page book name string strPageName = pg.GetName(); // Get Origin sample folder string strPath = GetAppPath(TRUE) + "Samples\\Import and Export\\"; // List all file names need to imported StringArray saFileNames; saFileNames.Add(strPath + "pCLAMP\\93310C08.DAT"); saFileNames.Add(strPath + "pCLAMP\\93310C10.DAT"); saFileNames.Add(strPath + "pCLAMP\\93311C01.DAT"); // specify .oif filter name, location see the setting of nLocation below. string strFilterName = "pCLAMP"; // import filter tree // about filter settings, refer to imppClamp xfunction tree variable "options" Tree trFilter; int nLocation = 1; // Origin exe folder, more options see the document of load_import_filter function. int nRet; nRet = load_import_filter(strFilterName, saFileNames[0], strPageName, nLocation, trFilter); if ( 0 == nRet ) out_str("Success to load import filter!"); else out_str("Failed to load import filter!\nPlease check strFilterName and nLocation if assigned correctly"); }
Remark
See Also
Header to Include
FileImport.h