Void clicked () <br/>{< br/> sysexcelapplication Excel; <br/> sysexcelworkbooks books; <br/> sysexcelworkbook book; <br/> sysexcelworksheets; <br/> sysexcelworksheet sheet; <br/> sysexcelcells; <br/> sysexcelcell cell; <br/> sysexcelstyles; <br/> sysexcelstyle style; <br/> int rowcount, recnum, N; <br/> filename _ filenameopen; <br/> xyf_contactstable _ contactstable; <br/> dialog _ d Ialog; <br/> dialogfield dlgpath; <br/> dictenum <br/>; </P> <p> _ dialog = new dialog ('import ...... '); <br/> dlgpath = _ dialog. addfield (typeid (filenameopen); <br/> dictenum = new dictenum (enumname2id ('xyf _ contacststype '); <br/> _ dialog. doinit (); <br/> If (_ dialog. run () <br/>{< br/> try <br/>{< br/> _ filenameopen = dlgpath. value (); <br/> Excel = sysexcelapplication: Construct (); <br/> B Ooks = excel. workbooks (); <br/> books. open (_ filenameopen, true); </P> <p> book = books. item (1); <br/> sheets = book. worksheets (); <br/> Sheet = sheets. itemfromnum (1); <br/> cells = sheet. cells (); <br/> delete_from _ contactstable; </P> <p> rowcount = 2; // data is retrieved from the second row and the field name is stored in the first row. <br/> for (rowcount = 2; cells. item (rowcount, 1 ). value (). BSTR ()! = ""; Rowcount ++) <br/>{< br/> recnum ++; </P> <p> n = 1; <br/> _ contactstable. name = cells. item (rowcount, n ). value (). BSTR (); <br/> N ++; <br/> _ contactstable. namealias = cells. item (rowcount, n ). value (). BSTR (); <br/> N ++; </P> <p> _ contactstable. tel = cells. item (rowcount, n ). value (). BSTR (); <br/> If (! _ Contactstable. tel) <br/> _ contactstable. tel = cells. item (rowcount, n ). value (). tostring (); <br/> If (strscan (_ contactstable. tel, ',', 1, strlen (_ contactstable. tel) <br/> _ contactstable. tel = strreplace (_ contactstable. tel, ',', ''); <br/> If (strscan (_ contactstable. tel ,'. ', 1, strlen (_ contactstable. tel) <br/> _ contactstable. tel = strreplace (_ contactstable. tel ,'. ', ''); <br/> N ++; </P> <p> _ contactstable. tel _ Fixed = cells. item (rowcount, n ). value (). BSTR (); <br/> N ++; <br/> _ contactstable. qq = cells. item (rowcount, n ). value (). double (); <br/> N ++; <br/> _ contactstable. email = cells. item (rowcount, n ). value (). BSTR (); <br/> N ++; <br/> // _ contactstable. xyf_contacststype = dictenum. symbol2value (cells. item (rowcount, n ). <br/> // the English name of symbol2value is converted to an integer value <br/> _ contactstable. xyf_contacststype = dictenum. name2value (Cells. Item (rowcount, n ). <br/> value (). BSTR (); // convert the label value of the name2value Chinese enumeration to an integer value </P> <p> N ++; <br/> _ contactstable. address = cells. item (rowcount, n ). value (). BSTR (); </P> <p> // n ++; <br/> // _ contactstable. photo = cells. item (rowcount, n ). value (). container (); </P> <p> If (_ contactstable. name! = "") <Br/> _ contactstable. doinsert (); </P> <p >}< br/> catch (exception: Error) <br/> excel. quit (); <br/> Info (strfmt ("import into xyf_contactstable of % 1", recnum); <br/> excel. quit (); <br/> xyf_contactstable_ds.executequery (); <br/> xyf_contactstable_ds.research (); <br/>}< br/>}