Microsoft Word umk d2 sirtqi docx




Download 1,55 Mb.
Pdf ko'rish
bet23/24
Sana10.06.2024
Hajmi1,55 Mb.
#262343
1   ...   16   17   18   19   20   21   22   23   24
Bog'liq
maruza3

 
Hisobot 
tugmasining 
onClick 
xodisasiga quyidagicha kod yozamiz: 
AnsiString fish,ty,kurs,guruh, manzil,tel; 
app=CreateOleObject("Excel.Application"); //
Excelni ishga tushirish 
uchun 


110 
app.OlePropertySet("visible",true); 
//
Excelni 
ko’rinishini 
taminlash uchun 
app.OlePropertySet("SheetsInNewWorkbook",3); //
Yangi ishchi kitob 
sozlash 
books=app.OlePropertyGet("WorkBooks"); //
Yangi ishchi kitob xosil 
qilish
books.OleProcedure("Add"); //open widestring 
book=books.OlePropertyGet("Item",1); //
ma’lum bir kitob belgilab 
olinadi 
sheets=book.OlePropertyGet("WorkSheets"); 
sheet=sheets.OlePropertyGet("Item",1); 
sheet.OlePropertySet("Name",WideString("Hisobot"));//
kitobda 
Hisobot
 nomli sahifa ochildi 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,1); 
cell.OlePropertySet("Value",WideString("Hisobot")); 
//jadval 
ustunlari sarlovhasi yaratiladi 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,1); 
cell.OlePropertySet("Value",WideString("FISH")); 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,2); 
cell.OlePropertySet("Value",WideString("Tug'ilgan yili")); 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,3); 
cell.OlePropertySet("Value",WideString("Kursi")); 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,4); 
cell.OlePropertySet("Value",WideString("Guruhi")); 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,5); 
cell.OlePropertySet("Value",WideString("Manzili")); 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",2,6); 
cell.OlePropertySet("Value",WideString("Telefon raqami")); 
ADOTable1->First(); 
for (int i=0; iRecordCount; i++) 

fish=ADOTable1->FieldByName("fish")->AsString; 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,1); 
cell.OlePropertySet("Value",WideString(fish)); 
ty=ADOTable1->FieldByName("ty")->AsVariant; 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,2); 
cell.OlePropertySet("Value",WideString(ty)); 
kurs=ADOTable1->FieldByName("kurs")->AsVariant; 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,3); 
cell.OlePropertySet("Value",WideString(kurs)); 
guruh=ADOTable1->FieldByName("guruh")->AsVariant; 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,4); 
cell.OlePropertySet("Value",WideString(guruh)); 
manzil=ADOTable1->FieldByName("manzil")->AsVariant; 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,5); 
cell.OlePropertySet("Value",WideString(manzil)); 
tel=ADOTable1->FieldByName("tel")->AsVariant; 


111 
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+3,6); 
cell.OlePropertySet("Value",WideString(tel)); 
ADOTable1->Next(); 

Hisobot tugmasi bosilganda ma’lumotlar MS Excel ga quyidagicha 
jo’natiladi: 
Hisobotni Microsoft Excell dasturida ko’rinishi. 

Download 1,55 Mb.
1   ...   16   17   18   19   20   21   22   23   24




Download 1,55 Mb.
Pdf ko'rish