/*------------------------------------------------------------------------------* * File Name: GetSetASCIMPStructure.c * * Creation: ER, 01/17/05 * * Purpose: Programming Example * * Copyright (c) OriginLab Corp.2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 * * All Rights Reserved * * * * Modification Log: * *------------------------------------------------------------------------------*/ #include ///////////////////////////////////////////////////////////////////////////////// // This example shows how to get and set the ASCIMP structure stored in a // worksheet. The ASCIMP structure is used for importing by the // "Import ASCII" and "Import Multiple ASCII" buttons/menu items. // Note that the Import Wizard uses filters (OIF) for saving import settings. // void get_set_ascimp_structure() { // Declare worksheet using active layer Worksheet wks = Project.ActiveLayer(); if( !wks ) { printf("Active layer is not a worksheet!\n"); return; } // Get ASCIMP structure from worksheet into a tree ASCIMP ascimp; wks.GetASCIMP(ascimp); Tree tr; tr = ascimp; // Report settings out_str("Current ASCIMP settings:"); out_tree(tr); // You can then directly change the ASCIMP settings // such as: ascimp.iHeaderLines = 4; // Number of header lines // And import a file using the changed settings with code such as: // wks.ImportASCII(strFile, ascimp); // Settings can be saved to the worksheet with code such as: wks.SetASCIMP(ascimp); // Save settings to worksheet // Note that to make the change effective for any future // instance of the worksheet, you will need to resave the // worksheet template. } /////////////////////////////////////////////////////////////////////////////////