1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
void importFromExcel()
{
    myTable myTable;
    COMVariant  COMVariant1;
    SysExcelApplication app;
    SysExcelWorkbooks   Workbooks;
    SysExcelWorkbook    Workbook;
    SysExcelWorksheets  Worksheets;
    SysExcelWorksheet   Worksheet;
    SysExcelCells       Cells;
    SysExcelCell        RCell;
    int                 i;
    #excel
    app = SysExcelApplication::construct();
    Workbooks = app.Workbooks();
    COMVariant1 = new COMVariant();
    COMVariant1.bStr("C:\\myExcel.xls");
    Workbook = Workbooks.Add(COMVariant1);
    Worksheets = Workbook.worksheets();
    Worksheet = Worksheets.itemFromName("myTable");
    Cells = Worksheet.Cells();
 
    i = 2;
 
    RCell = Cells.Item(i, 1);
    ttsbegin;
    while(RCell.Value().bStr() != '')
    {
        myTable.Field1Id = RCell.value().bStr();
        RCell = Cells.Item(i, 2);
        myTable.Field2 = RCell.value().bStr();
        RCell = Cells.Item(i, 3);                                                 
        myTable.FieldInt = str2int(RCell.value().toString());    
        RCell = Cells.Item(i, 4);                                                   
        myTable.FieldReal = str2num(RCell.value().toString());  
        RCell = Cells.Item(i, 5);
        myTable.FieldDate = RCell.value().date();
 
        myTable.insert();
        i++;
        RCell = Cells.Item(i, 1);
    }
    ttscommit;
}