91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

delphi 導出excel

發布時間:2020-07-27 16:31:49 來源:網絡 閱讀:634 作者:鵝倌 欄目:開發技術

Var
  FExcel:OleVariant; //excel應用程序
  FWorkBook :OleVariant; //工作表
  Temsheet:OleVariant; //工作薄
  FPicture:OleVariant;//圖片
  tmpstr:String;
  range:variant;//范圍
  i,j,TemInt:integer;
  TemFileName:String;
  real_american_price:Double;
begin
  if (kind = '小米清單') or (kind = '小商品清單') then
  Begin
    if cxxiaomilist.DataController.RecordCount = 0 then
    begin
      Application.MessageBox(PChar('沒有導出數據!'),'提示',MB_OK + MB_ICONWARNING);
      abort;
    end;

    SaveDialog1.Filter:='.xlsx';
    if SaveDialog1.Execute then
    begin
      TemFileName:=SaveDialog1.FileName+'.xlsx';

      Screen.Cursor:=CrHourGlass;
      TemInt:=0;
      try
        FExcel:= CreateoleObject('excel.Application');
        FWorkBook:=FExcel.WorkBooks.Add(-4167); //新的工作表
        Temsheet:=FWorkBook.Worksheets.Add;
        Temsheet.Name:=kind;
      except
        Application.MessageBox('無法創建Excel文件, 請確認是否安裝了Excel軟件',
          PChar(Application.Title), MB_OK + MB_ICONWarning);
        Exit;
      end;

      Temsheet.Select;
      Temsheet.Range['A1','A1'].RowHeight := 60;

      for i := 1 to 111 do
      begin
        Temsheet.Columns[i].ColumnWidth:=15;
        Temsheet.cells[1,i] := '';
        if i = 1 then
          Temsheet.cells[1,i] := cxxiaomilist.Bands[111].Caption;
        if i = 22 then
          Temsheet.cells[1,i] := cxxiaomilist.Bands[112].Caption;
        Temsheet.cells[2,i] := cxxiaomilist.Bands[i-1].Caption;
        ////////////////////////////////////////////////////////////
        if i < 22 then
           Temsheet.cells[3,i] := cxxiaomilist.Columns[i-1].Caption;
      end;
      Temsheet.Columns[1].NumberFormat:='#####################';

      range:=Temsheet.Range[Temsheet.cells[3,22],Temsheet.cells[3,23]];//選定表格
      range.select;
      range.merge;
      range:=Temsheet.Range[Temsheet.cells[3,22],Temsheet.cells[3,24]];//選定表格
      range.select;
      range.merge;
      Temsheet.Cells[3,22].HorizontalAlignment:=-4108; //字居中
      Temsheet.Cells[3,22] := cxxiaomilist.Bands[112 + 1].Caption;

      range:=Temsheet.Range[Temsheet.cells[3,25],Temsheet.cells[3,26]];//選定表格
      range.select;
      range.merge;
      range:=Temsheet.Range[Temsheet.cells[3,25],Temsheet.cells[3,27]];//選定表格
      range.select;
      range.merge;
      Temsheet.Cells[3,25].HorizontalAlignment:=-4108; //字居中
      Temsheet.Cells[3,25] := cxxiaomilist.Bands[112 + 2].Caption;


      range:=Temsheet.Range[Temsheet.cells[3,109],Temsheet.cells[3,110]];//選定表格
      range.select;
      range.merge;
      range:=Temsheet.Range[Temsheet.cells[3,109],Temsheet.cells[3,111]];//選定表格
      range.select;
      range.merge;
      Temsheet.Cells[3,109].HorizontalAlignment:=-4108; //字居中
      Temsheet.Cells[3,109] := cxxiaomilist.Bands[112 + 30].Caption;

      for I := 0 to cxxiaomilist.DataController.RecordCount - 1 do
      begin
        for j := 1 to cxxiaomilist.ColumnCount do
        begin
          Temsheet.cells[4 + i,j] := VarToStr(cxxiaomilist.DataController.GetValue(i,j-1));
//          if j = 10 then
//          if TryStrToFloat(VarToStr(cxxiaomilist.DataController.GetValue(i,j)),real_american_price) then
//          if real_american_price > 150 then
//          begin
//            Temsheet.Cells[4 + i,j].Interior.Color := clRed;
//            Temsheet.Cells[4 + i,j + 4].Interior.Color := $0075C76B;
//          end;
        end;
      end;



  //    for i:=0 to DBGrid2.Columns.Count - 1 do
  //    begin
  //      Temsheet.Cells[TemInt,i+2]:=DBGrid2.Columns[i].Title.Caption;
  //      Temsheet.Cells[TemInt,i+2].HorizontalAlignment:=-4108; //字居中
  //      Temsheet.Cells[TemInt,i+2].Interior.Color:=clGray;     //單元格背景色
  //      range:=Temsheet.Range[Temsheet.cells[TemInt,i+2],Temsheet.cells[TemInt,i+2]];//選定表格
  //      range.borders.linestyle:=1;//華線
  //    end;
  //
  //    TemInt:=TemInt+1;
  //    //////////////////////////////////////////////
  //    j:=0;
  //    DBGrid2.DataSource.DataSet.First;
  //    while not DBGrid2.DataSource.DataSet.Eof do
  //    begin
  //      Temsheet.Cells[TemInt+j,1].Value:=j+1;
  //      Temsheet.Cells[TemInt+j,1].HorizontalAlignment:=-4108; //字居中
  //      range:=Temsheet.Range[Temsheet.cells[TemInt+j,1],Temsheet.cells[TemInt+j,1]];//選定表格
  //      range.borders.linestyle:=1;//華線
  //
  //      for i:=0 to DBGrid2.Columns.Count - 1 do
  //      begin
  //        Temsheet.Cells[TemInt+j,i+2].Value:=DBGrid2.Fields[i].AsString;
  //        range:=Temsheet.Range[Temsheet.cells[TemInt+j,i+2],Temsheet.cells[TemInt+j,i+2]];//選定表格
  //        range.borders.linestyle:=1;//華線
  //      end;
  //      DBGrid2.DataSource.DataSet.Next;
  //      j:=j+1;
  //    end;


      Application.ProcessMessages;

      Screen.Cursor:=CrDefault;
      FExcel.WorkBooks[1].saveas(TemFileName);//保存文件
      FExcel.workbooks[1].close; //關閉工作表
      Application.ProcessMessages;
      MessageBox(Handle,'導出成功','提示',MB_OK);
      //FExcel.visible:=true;
      FExcel.quit; //關閉Excel
      FExcel := unassigned;
      //shellexecute(0,'open',PChar(ExtractFileName(TemFileName)),nil,PChar(ExtractFilePath(TemFileName)),SW_Show);

    end;
  End;

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

永登县| 金塔县| 奉贤区| 乐至县| 汝城县| 广昌县| 二手房| 巫溪县| 永和县| 新竹县| 泰安市| 隆化县| 平顶山市| 山东省| 正镶白旗| 馆陶县| 库车县| 潼南县| 隆尧县| 莲花县| 民勤县| 额尔古纳市| 桂平市| 高雄县| 白玉县| 安阳县| 泰和县| 阿拉善右旗| 漠河县| 囊谦县| 腾冲县| 雷山县| 平顶山市| 屯昌县| 商洛市| 左贡县| 汶川县| 平远县| 县级市| 甘孜县| 静海县|