Java netbeans

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 91E20
    New Member
    • Mar 2021
    • 5

    Java netbeans

    How to insert image from jlabel to Excel file using Java netbeans?

    I have a desktop application developed in netbeans, what I really want is the Fileinputstream for image from jlabel field to Excel file, I don't know how to insert image from jlabel field to Excel spreadsheet, but I can insert text to the Excel file but I can't insert image from jlabel to Excel file, please help
    Last edited by Niheel; Mar 14 '21, 04:08 AM. Reason: more details for the question
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    How to insert image from jlabel to Excel file using Java netbeans?
    More details required.

    Comment

    • dev7060
      Recognized Expert Contributor
      • Mar 2017
      • 656

      #3
      Not sure what you mean when you say "from JLabel field". JLabel is a component to display text or images in a container. Show the code and mention the API being used.

      Comment

      • 91E20
        New Member
        • Mar 2021
        • 5

        #4
        I just posted the application interface from Netbeans but I really want is
        The person image you seeing on the interface there I want to add it to Excel spreadsheet but I don't know the code to export that image from the application to Excel spreadsheet, but am exporting the texts, only the person image I don't know how to export to the Excel spreadsheet.
        Attached Files

        Comment

        • dev7060
          Recognized Expert Contributor
          • Mar 2017
          • 656

          #5
          show the code and mention the api being used.
          ^^    ⠀⠀   ⠀⠀   ⠀⠀    ⠀⠀  

          Comment

          • 91E20
            New Member
            • Mar 2021
            • 5

            #6
            Dev7060, am so sorry that you are patient with me in understanding
            my problem because am new to programming but I appreciate your efforts.

            I just posted the code of my problem, the API I used is Swing in java netbeans
            that is what am using to develop the application.
            So please see attached the code for clarification.
            Attached Files

            Comment

            • dev7060
              Recognized Expert Contributor
              • Mar 2017
              • 656

              #7
              ClassCastExcept ion is thrown when there exists no relationship between the classes. The question regarding API was asked with respect to the excel and database. From the attachment, I'm assuming Apache POI and Apache Derby are being used. The question is how are you reading the image. You may not need to extract anything from the label at all. Derby has a special data type to store binary data called Binary Large Object (BLOB).
              Code:
              Blob blob = result.getBlob("photo");
              InputStream inputStream = blob.getBinaryStream();
              where result holds the reference of the ResultSet object.

              Comment

              Working...