
This topic summarizes the basic things that you ought to know to make use of drag-and-drop file import.
Contents |
When files are dropped into Origin, they are handled by one of two import routines.
When files are dropped into the Origin workspace, Origin does the following:
Origin Import Filters are created with the Import Wizard. When creating an import filter with the Import Wizard, the normal sequence of events is to open the Import Wizard, select a data file, then step through a sequence of Wizard pages in which you interactively parse the file, select file and window naming options, select header information to be stored and re-used, etc. When you have finalized your import settings, you can store them as an import filter (saving the filter is highly recommended if you plan to import the same or similar files in the future).
When creating an import filter, you have the option of (1) saving the filter with an Origin child window or (2) you can save the filter to a separate Origin Import Filter file (.OIF). The only real advantage to saving the filter with the child window is that the filter travels with the window itself and, thus, it becomes part of the Origin project file (OPJ) or child window file. The other option -- saving the filter as a separate .OIF file -- allows you to select the filter on the first page of the Import Wizard, then click Finish (the filter contains all necessary import instructions). Both child window-based filters and OIF files support drag-and-drop file import.
Another benefit of creating an import filter is that once created, the filter can be tweaked to import files that vary somewhat in their structure, without having to completely recreate every import specification. Filters are easily shared with colleagues, allowing standardization of import file handling among different work groups or geographically remote work sites.
Once defined, your import filter can be narrowly targeted to work only with, say, a particular file name (or variations on that file name) or it can be broadly targeted by specifying that it apply to all files with a particular file extension. For instance, you might work with an instrument that automatically names data files in sequence using a scheme something like XYZ_001.CSV, XYZ_002.CSV, XYZ_003.CSV. Using the "*" wildcard character, you could target the filter at all .CSV files in your data file folder by specifying that the filter apply to any file with the name "*.CSV." Conversely, you could narrowly target the filter by specifying that the filter apply only to CSV files named "XYZ*.CSV."
When defining an import filter for ASCII, binary or user-defined file types, you must specify a Target Window and Target Window Template. Note that Data Types other than User-Defined are limited to Target Window = Workbook. Note, too that User-Defined allows you to bypass specifying the Target Window and Target Window Template if window creation is to be handled by your Origin C code (in which case, the code would handle window creation).
The Target Window merely specifies the type of child window that will receive the imported data. The Target Window Template, on the other hand, is a specific (named) window template with custom configuration and format settings. The Target Window Template is used when drag-and-drop import operations call for creating new windows.
Assuming that you have defined an import filter, if you drag-and-drop one or more data files into an active window and that window is of the Target Window type, then Origin will import the file(s) using the new window/new worksheet/new column settings specified in the filter. If, for instance, (1) the filter Import Mode is set to Start New Columns and (2) the file(s) are dropped onto a workbook window (the Target Window type specified in the filter), then the file(s) are imported and added as columns into the active worksheet in the active workbook. If the active sheet had empty columns, they would be filled first. In this case, the active workbook was of the correct Target Window type and each file required only the creation of new columns. No new windows needed to be created so, therefore, the Target Window Template was not used.
If the filter Import Mode had been set to Start New Books, then the first file dropped would import into the active workbook if the columns in the active sheet were empty (again -- the Target Window was of the correct type), and each subsequent file would import into new workbook windows created using the Target Window Template. Note that the Target Window Template may, or may not, be the same template that the active workbook window was based upon. However, the default Target Window Template (<Default> from the drop-down list on the Import Wizard Source page) is the default Origin worksheet or matrix template. Unless you have chosen a different default template, this would be ORIGIN.OTW (worksheet) or ORIGIN.OTM (matrix).
All third-party file types that have build-in support are importable by drag-and-drop, owing to the fact that import filters for these file types are built into Origin. You can use the Filter Manager to specify whether the drag-and-drop import mode should be turned on/off for a specific file type. The Filter Manager can be opened by selecting Tools: Import Filter Manager from the Origin menu.
You can add drag-and-drop support for new files by defining an import filter using the Import Wizard. You will need a representative data file and you should know something about the type of data that your file contains (whether it contains ASCII or binary data, or is of another type).
Some things to consider when deciding how to target your import filter and where to save it: