遇到一个问题请大家帮帮忙!
现在做一个东西,需要把EXCEL导入ACCESS数据库,现在已经实现,然后在导出本来是竖排的格式例如: 
人员编号 姓名      考勤日期 上班1 下班1 上班2 
00010  孟宪凤 2007-06-15 06:47 17:47 
00010  孟宪凤 2007-06-16 08:50 21:04 
00010  孟宪凤 2007-06-17 08:32 17:05 
00010  孟宪凤 2007-06-18 06:59 17:34 
00010  孟宪凤 2007-06-19 07:13 17:32 
变成: 
人员编号     00010               00010       00010                 00010                     
姓名         孟宪凤             孟宪凤             孟宪凤               孟宪凤 
考勤日期   2007-06-15         2007-06-16     2007-06-17         2007-06-18 
上班1     06:47              08:50           08:32               06:59 
下班1     17:47              21:04           17:05               17:34 
上班2 

解决方案 »

  1.   

    读取EXcel处的代码作些文章不可以么
      

  2.   

    在Access中实现下面那个表不太好实现,应为每列中的数据类型都是不一样的
      

  3.   

    function   ReadExcelToGrid(ExcelFileName:string;Cur_grid:TStringGrid;number_row,number_col,caption_row,caption_col,start_row,start_col:integer;caption_CH,caption_EN:string):integer;
    var
        sheet:   TSpreadSheet;
        i,j,cur_rowcount,result_val:integer;
        temp_val:string;
    begin
            result_val:=0;
            with   TMSExcel.Create(nil)   do
            begin
                try
                    try
                    //showmessage(ExcelFileName);
                    LoadFromFile(ExcelFileName);
                    except
                        showmessage( "读入Excel文件出错 ");
                        result_val:=-1;           //未完,还有英文对话框
                        result:=-1;
                    end;
                    sheet   :=   Sheets.SpreadSheet(0)   ;
                    if   Assigned(sheet)   then
                    begin
                        {temp_val:=   getvstr(sheet.Cells.GetValue(caption_col-1,   caption_row-1));
                        showmessage(temp_val);     }                    temp_val:=getvstr(sheet.Cells.GetValue(caption_col-1,   caption_row-1));
                        if   not   ((temp_val < > " ")   and   (pos(caption_Ch,temp_val) >0)   and   (pos(caption_en,temp_val) >0))   then
                        begin
                            ////8-9   日增加一行提示
                            //showmessage( "显示文件题头的名字:     "   +   temp_val   );
                            showmessage( "您选择的文件不是 "+caption_CH);
                            result_val:=-1;
                            result:=-1;           //未完,还有英文对话框
                            exit;
                        end
                        else
                        begin
                            cur_rowcount:=   start_row-1;
                            for   i   :=   start_row   to   sheet.Cells.UsedRowCount   do     //从excel文件的第二行开始读入,(第一行是标题)
                            begin
                                    temp_val:=getvstr(sheet.Cells.GetValue((number_col-1),   i));
                                    //   if   (temp_val= " ")   and   (i >number_row-1)   then   break;
                                    for   j   :=   start_col-1   to   sheet.Cells.UsedColCount   do
                                    begin
                                        temp_val:=getvstr(sheet.Cells.GetValue(j,   i));
                                        Cur_grid.Cells[j,cur_rowcount]   :=   getvstr(sheet.Cells.GetValue(j,   i));
                                    end;
                                    cur_rowcount:=cur_rowcount+1;
                                    Cur_grid.RowCount:=   Cur_grid.RowCount+1;
                            end;
                          end;
                      end;
                finally
                    Free;
                end;
            end;
            if     result_val=0   then
            begin
                cur_rowcount:=Cur_grid.RowCount-1     ;
                for   i:=   start_row-1   to   Cur_grid.RowCount-1   do
                begin
                    try
                          temp_val:=   getvstr(cur_grid.Cells[(number_col-1),i]);
                          if   (temp_val= " ")   and   (i >number_row-1)   then
                          begin
                              Cur_grid.RowCount:=   Cur_grid.RowCount   -   1;
                              cur_rowcount:=cur_rowcount-1;
                          end;
                      except
                          break;
                      end;
                end;
              end;
          result:=result_val;end;