-
Notifications
You must be signed in to change notification settings - Fork 8
/
MetodoGeraRam_Original.txt
60 lines (56 loc) · 1.98 KB
/
MetodoGeraRam_Original.txt
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
uses ComObj;
Procedure tform1.GerarRAM(Modelo, modelo2, turmafolder, Nome, turma, prof, mid, finalex, oral: string);
var
a: variant;
b: string;
begin
a:= CreateOleObject('Excel.Application');
a.displayalerts:= false;
if modelo2 = '1'then
begin
if modelo = 'mod1' then
a.workbooks.open(extractfilepath(paramstr(0))+'CCAA-RAM-8-lessons.xlsm');
if modelo = 'mod2' then
a.workbooks.open(extractfilepath(paramstr(0))+'CCAA-RAM-10-lessons.xlsm');
if modelo = 'mod3' then
a.workbooks.open(extractfilepath(paramstr(0))+'CCAA-RAM-12-lessons.xlsm');
end
else
begin
if modelo = 'mod1' then
a.workbooks.open(extractfilepath(paramstr(0))+'KidCCAA-RAM-8-lessons.xlsm');
if modelo = 'mod2' then
a.workbooks.open(extractfilepath(paramstr(0))+'KidCCAA-RAM-10-lessons.xlsm');
if modelo = 'mod3' then
a.workbooks.open(extractfilepath(paramstr(0))+'KidCCAA-RAM-12-lessons.xlsm');
end;
a.workbooks[1].sheets[1].cells[29,3]:= nome;
a.workbooks[1].sheets[1].cells[29,8]:= turma;
a.workbooks[1].sheets[1].cells[29,11]:= prof;
a.workbooks[1].sheets[1].cells[67,2]:= mid;
a.workbooks[1].sheets[1].cells[67,10]:= finalex;
a.workbooks[1].sheets[1].cells[67,12]:= oral;
b:= GetStrNumber(a.version);
if strtoint(b) < 120 then
a.workbooks[1].saveas(Configquery1.fieldbyname('Caminhorams').asstring+'\'+combobox3.items.strings[combobox3.itemindex]+'\'+Turmafolder+'\'+nome+'.xlsm')
else
a.workbooks[1].saveas(Configquery1.fieldbyname('Caminhorams').asstring+'\'+combobox3.items.strings[combobox3.itemindex]+'\'+Turmafolder+'\'+nome+'.xlsm', 52);
a.quit;
end;
function GetStrNumber(const S: string): string;
var
vText : PChar;
begin
vText := PChar(S);
Result := '';
while (vText^ <> #0) do
begin
{$IFDEF UNICODE}
if CharInSet(vText^, ['0'..'9']) then
{$ELSE}
if vText^ in ['0'..'9'] then
{$ENDIF}
Result := Result + vText^;
Inc(vText);
end;
end;