首页 > 代码库 > dxSpreadSheet动态切换Sheet

dxSpreadSheet动态切换Sheet


procedure TForm1.btnShowCaptionClick(Sender: TObject);
var
  objWorksheet: TdxSpreadSheetTableView;
  i: integer;
  strList: TStringlist;
begin
  strList := TStringlist.Create;
  strList.Add(‘当前工作簿包括以下工作表:‘);
  for i := 0 to SpreadSheet.SheetCount - 1 do
  begin
    objWorksheet := SpreadSheet.Sheets[i] as TdxSpreadSheetTableView;
    strList.Add(objWorksheet.Caption);
  end;
  ShowMessage(strList.Text);
  strList.Free;
end;

procedure TForm1.btnActiveShtClick(Sender: TObject);
var
  indexLastSheet : integer;
begin
  indexLastSheet := SpreadSheet.SheetCount - 1;
  SpreadSheet.ActiveSheetIndex := indexLastSheet;
end;

dxSpreadSheet动态切换Sheet