unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,System.Win.ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Edit6: TEdit;
Edit7: TEdit;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
Label5: TLabel;
Edit5: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ExcelApp: Variant;
FSheet: Variant;
sheetno:Integer;
rowno:integer;
sheetname1,edit1text:string;
gezhi,shijian,riqi:Integer;
kaishibanji,banji,banjishu,jieguolineno:Integer;
banjistr:string;
fangan:Integer;
begin//0
ExcelApp:= GetActiveOleObject('Excel.Application');
ExcelApp.visible:=true;
FSheet :=ExcelApp.ActiveWorkbook.Activesheet;
kaishibanji:=StrToInt(Edit4.text); //第个人分配到的班级数
banji:=StrToInt(Edit2.text); //第个人分配到的班级数
banjishu:=StrToInt(Edit1.text) ; //总的班级数
jieguolineno:=StrToInt(Edit3.text) ; //结果放在第几列
fangan:=1; //方案开关
for rowno := StrToInt(Edit6.Text) to StrToInt(Edit7.Text) do begin
Sleep(1000) ;
FSheet.Cells[rowno,jieguolineno].Value :=banji;
banjistr:=IntToStr(banji);
FSheet.Cells[rowno,jieguolineno+1].Value :=Edit5.Text+'('+banjistr+')班';
case fangan of
1:begin //方案1如果班级小于最后一个班级,班级数加1,如果班级等于最大班级,班级不变,方案变成2号方案
if banjikaishibanji then banji:=banji-1
else
if banji=kaishibanji then fangan:=1;
end;
end;
end;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Form1.FormStyle:=fsStayOnTop;
form1.Left:=1420;
form1.top:=600;
end;
object Form1: TForm1
Left = 0
Top = 0
Caption = #22343#34913#20998#29677
ClientHeight = 671
ClientWidth = 960
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
OnShow = FormShow
TextHeight = 15
object Label19: TLabel
Left = 35
Top = 144
Width = 50
Height = 24
Caption = #20174#31532
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label20: TLabel
Left = 169
Top = 144
Width = 50
Height = 24
Caption = #21040#31532
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label21: TLabel
Left = 283
Top = 144
Width = 25
Height = 24
Caption = #34892
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label1: TLabel
Left = 8
Top = 208
Width = 225
Height = 24
Caption = #31532#19968#20010#21516#23398#30340#29677#32423#21495
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 228
Top = 83
Width = 100
Height = 24
Caption = #29677#32423#24635#25968
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label3: TLabel
Left = 8
Top = 264
Width = 250
Height = 24
Caption = #20998#29677#32467#26524#20445#23384#22312#31532#20960#21015
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label4: TLabel
Left = 8
Top = 83
Width = 100
Height = 24
Caption = #24320#22987#29677#32423
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Label5: TLabel
Left = 8
Top = 27
Width = 75
Height = 24
Caption = #24180#32423#65306
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
end
object Button1: TButton
Left = 18
Top = 326
Width = 290
Height = 67
Caption = #24320#22987#20998#29677
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
object Edit6: TEdit
Left = 103
Top = 141
Width = 60
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ImeName = #20013#25991'('#31616#20307') - '#19975#33021#20116#31508#36755#20837#27861
ParentFont = False
TabOrder = 1
Text = '3'
end
object Edit7: TEdit
Left = 228
Top = 141
Width = 49
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ImeName = #20013#25991'('#31616#20307') - '#19975#33021#20116#31508#36755#20837#27861
ParentFont = False
TabOrder = 2
Text = '13'
end
object Edit1: TEdit
Left = 346
Top = 80
Width = 91
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 3
Text = '5'
end
object Edit2: TEdit
Left = 251
Top = 205
Width = 102
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 4
end
object Edit3: TEdit
Left = 264
Top = 261
Width = 101
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 5
end
object Edit4: TEdit
Left = 124
Top = 80
Width = 63
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 6
Text = '1'
end
object Edit5: TEdit
Left = 124
Top = 24
Width = 63
Height = 32
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = #26032#23435#20307
Font.Style = [fsBold]
ParentFont = False
TabOrder = 7
Text = #19968
end
end