Jump to content

Excel Deki Verileri Liste Yazdırmak


darendeli
 Share

Recommended Posts


ProcessClose("EXCEL.EXE")
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <Excel.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=mp
$Form1 = GUICreate("Excel Tarihler Arası Veri Sorgulayıcı", 354, 187, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
;$Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 121, 25,  0x0003 + 0x0040  + $WS_VSCROLL)
$Combo1 = GUICtrlCreateCombo("", 8, 8, 121, 25,  BitOR($GUI_SS_DEFAULT_COMBO,$CBS_DROPDOWNLIST))
;$Combo1 = _GUICtrlComboBoxEx_Create($Form1,"ComboBoxEx",8,8,121,25)
GUICtrlSetOnEvent(-1, "Combo1Change")
$Combo2 = GUICtrlCreateCombo("", 136, 8, 129, 25,  BitOR($GUI_SS_DEFAULT_COMBO,$CBS_DROPDOWNLIST))
GUICtrlSetOnEvent(-1, "Combo2Change")
$Button1 = GUICtrlCreateButton("Sorgula", 272, 8, 73, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Excel'e Aktar", 272, 50, 73, 25)
GUICtrlSetOnEvent(-1, "Button2Click")
$Group1 = GUICtrlCreateGroup("Gelen", 8, 40, 121, 137)
$Label1 = GUICtrlCreateLabel("1 :", 16, 56, 100, 17)
GUICtrlSetOnEvent(-1, "Label1Click")
$Label2 = GUICtrlCreateLabel("2 :", 16, 80, 100, 17)
GUICtrlSetOnEvent(-1, "Label2Click")
$Label3 = GUICtrlCreateLabel("3 :", 16, 104, 100, 17)
GUICtrlSetOnEvent(-1, "Label3Click")
$Label4 = GUICtrlCreateLabel("4", 16, 128, 100, 17)
GUICtrlSetOnEvent(-1, "Label4Click")
$Label5 = GUICtrlCreateLabel("5", 16, 152, 100, 17)
GUICtrlSetOnEvent(-1, "Label5Click")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Giden", 136, 40, 129, 137)
$Label6 = GUICtrlCreateLabel("1 :", 144, 56, 100, 17)
GUICtrlSetOnEvent(-1, "Label6Click")
$Label7 = GUICtrlCreateLabel("2 :", 144, 80, 100, 17)
GUICtrlSetOnEvent(-1, "Label7Click")
$Label8 = GUICtrlCreateLabel("3 :", 144, 104, 100, 17)
GUICtrlSetOnEvent(-1, "Label8Click")
$Label9 = GUICtrlCreateLabel("4 :", 144, 128, 100, 17)
GUICtrlSetOnEvent(-1, "Label9Click")
$Label10 = GUICtrlCreateLabel("5 :", 144, 152, 100, 17)
GUICtrlCreateLabel("*******.Org",270,170,100,75)
GUICtrlSetOnEvent(-1, "Label10Click")
GUICtrlCreateGroup("", -99, -99, 1, 1)

;GUICtrlSendMsg($Combo1, $CB_SETMINVISIBLE, 99999999, 0)


#EndRegion ### END Koda GUI section ###

$yol = FileOpenDialog("Excel Dosyasını Seçiniz",@ScriptDir,"Excel Dosyaları (*.xlsx;*.xls)")
if @error then
	Exit
else
$baglan = _Excel_BookOpen($yol,0)


$sayi = 2

While 1
	$sayi += 1
	$oku = _Excel_RangeRead($baglan,$sayi,1)
	if $oku = "" then ExitLoop
	;if $sayi = 367 then exitloop

	If $sayi = 2 Then
		;_GUICtrlComboBoxEx_AddString($Combo1,DTFormat($oku),"")
		GUICtrlSetData($Combo1, DTFormat($oku), DTFormat($oku))
		GUICtrlSetData($Combo2, DTFormat($oku), DTFormat($oku))
	Else
		GUICtrlSetData($Combo1, DTFormat($oku))
		GUICtrlSetData($Combo2, DTFormat($oku))
	EndIF
WEnd

_GUICtrlComboBox_SetCurSel($Combo1,0)
_GUICtrlComboBox_SetCurSel($Combo2,0)

GUISetState(@SW_SHOW)
;_GUICtrlComboBoxEx_ShowDropDown($Combo1, True)
endif

While 1
	Sleep(100)
WEnd





Func Button1Click()
 $tarih1 = _GUICtrlComboBox_GetCurSel($Combo1)+2
 $tarih2 = _GUICtrlComboBox_GetCurSel($Combo2) +2



Yazdir($label1,2,1,$tarih1,$tarih2)

Yazdir($label2,3,2,$tarih1,$tarih2)
Yazdir($label3,4,3,$tarih1,$tarih2)
Yazdir($label4,5,4,$tarih1,$tarih2)
Yazdir($label5,6,5,$tarih1,$tarih2)

Yazdir($label6,8,1,$tarih1,$tarih2)
Yazdir($label7,9,2,$tarih1,$tarih2)
Yazdir($label8,10,3,$tarih1,$tarih2)
Yazdir($label9,11,4,$tarih1,$tarih2)
Yazdir($label10,12,5,$tarih1,$tarih2)


EndFunc
Func Combo1Change()

EndFunc
Func Combo2Change()

EndFunc
Func Form1Close()
_Excel_BookClose($baglan)
Exit
EndFunc

Func DTFormat($DT)
    If StringLen($DT) = 14 Then
        $YYYY = StringLeft($DT,4)
        $MM = StringMid($DT,5,2)
        $DD = StringMid($DT,7,2)
        $HH = StringMid($DT,9,2)
        $MN = StringMid($DT,11,2)
        $SS = StringRight($DT,2)
        Return $DD & "." & $MM & "." & $YYYY
    EndIf
    Return -1
EndFunc

Func Button2Click()
	 $tarih1 = _GUICtrlComboBox_GetCurSel($Combo1)+2
 $tarih2 = _GUICtrlComboBox_GetCurSel($Combo2) +2
ExcelYazdir(2,1,$tarih1,$tarih2)
ExcelYazdir(3,2,$tarih1,$tarih2)
ExcelYazdir(4,3,$tarih1,$tarih2)
ExcelYazdir(5,4,$tarih1,$tarih2)
ExcelYazdir(6,5,$tarih1,$tarih2)

ExcelYazdir(8,1,$tarih1,$tarih2)
ExcelYazdir(9,2,$tarih1,$tarih2)
ExcelYazdir(10,3,$tarih1,$tarih2)
ExcelYazdir(11,4,$tarih1,$tarih2)
ExcelYazdir(12,5,$tarih1,$tarih2)
MsgBox(0,0,"Veriler Excel'e Aktarıldı!")
	EndFunc

	func ExcelYazdir($kolon,$tur,$tarih1,$tarih2)
	 $satir1toplam = 0
 for $i = $tarih1 to $tarih2
$deger1 =_Excel_RangeRead($baglan,$i+1,$kolon)
$satir1toplam += $deger1
;MsgBox(0,0,$satir1toplam)
Next
if $tur = 1 then
	_Excel_RangeWrite($baglan,"1",369,$kolon)
	_Excel_RangeWrite($baglan,$satir1toplam,370,$kolon)
	;GUICtrlSetData($nesne,"MED :" & $satir1toplam)
ElseIf $tur = 2 Then
	_Excel_RangeWrite($baglan,"2",369,$kolon)
	_Excel_RangeWrite($baglan,$satir1toplam,370,$kolon)
ElseIf $tur = 3 Then
	_Excel_RangeWrite($baglan,"3",369,$kolon)
	_Excel_RangeWrite($baglan,$satir1toplam,370,$kolon)
ElseIf $tur = 4 Then
	_Excel_RangeWrite($baglan,"4",369,$kolon)
	_Excel_RangeWrite($baglan,$satir1toplam,370,$kolon)
ElseIf $tur = 5 Then
	_Excel_RangeWrite($baglan,"5",369,$kolon)
	_Excel_RangeWrite($baglan,$satir1toplam,370,$kolon)
EndIf


	endfunc





func Yazdir($nesne,$kolon,$tur,$tarih1,$tarih2)
	 $satir1toplam = 0
 for $i = $tarih1 to $tarih2
$deger1 =_Excel_RangeWrite($baglan,$i+1,$kolon)
$satir1toplam += $deger1
;MsgBox(0,0,$satir1toplam)
Next
if $tur = 1 then
	GUICtrlSetData($nesne,"1 :" & $satir1toplam)
ElseIf $tur = 2 Then
	GUICtrlSetData($nesne,"2 :" & $satir1toplam)
ElseIf $tur = 3 Then
	GUICtrlSetData($nesne,"3 :" & $satir1toplam)
ElseIf $tur = 4 Then
	GUICtrlSetData($nesne,"4 :" & $satir1toplam)
ElseIf $tur = 5 Then
	GUICtrlSetData($nesne ,"5 :" & $satir1toplam)
EndIf


	endfunc


Func Form1Maximize()

EndFunc
Func Form1Minimize()

EndFunc
Func Form1Restore()

EndFunc

Func Label1Click()

EndFunc
Func Label2Click()

EndFunc
Func Label3Click()

EndFunc
Func Label4Click()

EndFunc
Func Label5Click()

EndFunc
Func Label6Click()

EndFunc
Func Label7Click()

EndFunc
Func Label8Click()

EndFunc
Func Label9Click()

EndFunc
Func Label10Click()

EndFunc

Soyle Bir Kod Var Yalnız Verileri Aktarmıyor 0 olarak Donüyor Hepsi...

Örnek Excel  Bu     =      

Please register to see this content.

 

Edited by darendeli
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...