B4J Library jExcel library

Tayfur

Well-Known Member
Licensed User
Longtime User
No. You can set an image with jPOI library.

I recived an error!


B4X:
Sub Class_Globals
    Private fx As JFX
    Private EtiketForm As Form
    Private ComboBox_firma As ComboBox
    Private ComboBox_Parca As ComboBox
    Private ComboBox_lotNo As ComboBox
   
    Private book1 As ReadableWorkbook
    Private book2 As ReadableWorkbook
    Private Woorkbook_Sheets As Map
    Private ExcelAdi1 As String
    Private ExcelAdi2 As String
    Private Button_test As Button
    Private TableView_Firma As TableView
    Private TableView_ParcaList As TableView
    Private TableView_ambar As TableView
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
    ExcelAdi1 ="\\server\KALITE_RAPOR\-DATABASE-\DATABASE.xls"
    ExcelAdi2 ="\\server\DEPO\AMBAR.xls"
    EtiketForm.Initialize("FormEtiket",800,600)
    EtiketForm.RootPane.LoadLayout("Form_Koli_Etiket")
    EtiketForm.WindowHeight=768
    EtiketForm.WindowWidth=1024
    EtiketForm.Show
    EtiketForm.Title="KOLI / KASA ETIKET BASMA FORMU"
    Temizle
   
   
       
End Sub



Public Sub Show
    EtiketForm.Show
End Sub

private Sub ExcelYukle1(filename As String)
    If filename <> "" Then
        'progress1.Visible = True
        book1.InitializeAsync("book1", "", filename)
    End If
End Sub

private Sub ExcelYukle2(filename As String)
    If filename <> "" Then
        'progress1.Visible = True
        book2.InitializeAsync("book2", "", filename)
    End If
    If book2.IsInitialized =False Then
        fx.Msgbox(EtiketForm,"hata dosya açılmadı","")
    End If
End Sub
Sub Book2_Ready (Success As Boolean)
    ' hafızaya yüklene exceli sayfa sayfa MAP yükleniyor, daha sonra kullanmak için
    'progress1.Visible = False
    Log("bok-2")
    If Success Then
       
        Woorkbook_Sheets.Initialize
        For i = 0 To book2.NumberOfSheets - 1
            Dim sheet As ReadableSheet = book2.GetSheet(i)
            Log("book2 "&sheet.Name)
            If sheet.Name="AMBAR" Then
                sheet.GetAllAsync("Sheet_ambar")
                Exit
            End If
       
           
        Next
        fx.Msgbox( EtiketForm,"Sayfa adedi:"& Woorkbook_Sheets.Size,"")
    Else
        fx.Msgbox( EtiketForm,"Error loading file.","")
    End If
   
End Sub

Sub Book1_Ready (Success As Boolean)
    ' hafızaya yüklene exceli sayfa sayfa MAP yükleniyor, daha sonra kullanmak için
    'progress1.Visible = False
    Log("bok-1")
    If Success Then
        Dim z As Int
        z=0
        Woorkbook_Sheets.Initialize
        For i = 0 To book1.NumberOfSheets - 1
            Log("bok-2:"&i)
            Dim sheet As ReadableSheet = book1.GetSheet(i)
            If sheet.Name="PART_LIST" Then
                Log("bok-z:"&i)
                sheet.GetAllAsync("Sheet_database")
                z=z+1
            End If
            If sheet.Name="EPOSTA" Then
                Log("bok-zz:"&i)
                sheet.GetAllAsync("Sheet_eposta")
                z=z+1
            End If
            If z>1 Then Exit
        Next
        fx.Msgbox( EtiketForm,"Sayfa adedi:"& Woorkbook_Sheets.Size,"")
    Else
        fx.Msgbox( EtiketForm,"Error loading file.","")
    End If
   
End Sub

Sub Sheet_ambar_ValuesAvailable (Success As Boolean, Values As List)
   
    'progress1.Visible = False
    If Success Then
        For rowCounter = 0 To Values.Size - 1
           
            Dim row() As String = Values.Get(rowCounter)
            If rowCounter = 0 Then
                TableView_ambar.SetColumns(row)
            Else
                TableView_ambar.Items.Add(row)
            End If
        Next   
    Else
        Log(LastException)
    End If
End Sub


'-parca ad boy koli içi adet vs  bilgileri vs yuklendi tabloya
Sub Sheet_database_ValuesAvailable (Success As Boolean, Values As List)
    Log("databes-1 :")
    'progress1.Visible = False
    If Success Then
        For rowCounter = 0 To Values.Size - 1
            Log("databes-1 :"&rowCounter)
            Dim row() As String = Values.Get(rowCounter)
            If rowCounter = 0 Then
                TableView_ParcaList.SetColumns(row)
            Else
                TableView_ParcaList.Items.Add(row)
            End If
        Next   
    Else
        Log(LastException)
    End If
   
    If TableView_Firma.Items.Size>0 And TableView_ParcaList.Items.Size>0 Then
        ExcelYukle2(ExcelAdi2)
    End If
   
End Sub

Sub Sheet_eposta_ValuesAvailable (Success As Boolean, Values As List)
    Log("eposta :")
    'progress1.Visible = False
    If Success Then
        For rowCounter = 0 To Values.Size - 1
            Log("eposta :"&rowCounter)
            Dim row() As String = Values.Get(rowCounter)
            If rowCounter = 0 Then
                TableView_Firma.SetColumns(row)
            Else
                TableView_Firma.Items.Add(row)
            End If
        Next   
    Else
        Log(LastException)
    End If
    If TableView_Firma.Items.Size>0 And TableView_ParcaList.Items.Size>0 Then
        ExcelYukle2(ExcelAdi2)
    End If
   
End Sub



'comboya firma isimleri yükleni DATABASE>>eposta
Private Sub Firma_yukle
   
    Dim i As Int
    i = 1
    Do Until True 'Trim(Sayfa5.Cells(i + 1, 1) & "") = "0" Or Trim(Sayfa5.Cells(i + 1, 1) & "") = ""
        i = i + 1
        ComboBox_firma.Items.Add(i)
    Loop 'Trim(Sayfa5.Cells(i + 1, 1) & "") = "0" Or Trim(Sayfa5.Cells(i + 1, 1) & "") = ""
End Sub

Sub ComboBox_firma_SelectedIndexChanged(Index As Int, Value As Object)
fx.Msgbox(EtiketForm,"xxx","xxx")   
End Sub

Sub ComboBox_Parca_SelectedIndexChanged(Index As Int, Value As Object)
fx.Msgbox(EtiketForm,"xxx","xxx")   
End Sub

Sub ComboBox_lotNo_SelectedIndexChanged(Index As Int, Value As Object)
    fx.Msgbox(EtiketForm,"xxx","xxx")
End Sub



'Exc

Sub Button_test_MouseClicked (EventData As MouseEvent)
    'ExcelOpen_Action(ExcelAdi)
    TemizleTablo
   
    ExcelYukle1(ExcelAdi1)
   
End Sub

Private Sub TemizleTablo
    TableView_ambar.Items.Clear
    TableView_Firma.Items.Clear
    TableView_ParcaList.Items.Clear
End Sub
Private Sub Temizle
    ComboBox_Parca.Items.Clear
    ComboBox_firma.Items.Clear
    ComboBox_lotNo.Items.Clear
   
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…