Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8559411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:02:15+00:00 2026-06-11T16:02:15+00:00

I am writing a bit of code to read an excel file. At this

  • 0

I am writing a bit of code to read an excel file. At this point I am trying to determine the type of a cell.

    val wb:HSSFWorkbook= new HSSFWorkbook(fileInput)
    val sheet:HSSFSheet = wb.getSheetAt(0);
    val rows    = sheet.rowIterator()

    while(rows.hasNext()){
     var    row = rows.next()
    val cells = row.cellIterator()
    while(cells.hasNext()){
   val cell = cells.next()
   println(cell.getCellType()== org.apache.poi.hssf.usermodel.HSSFCell.CELL_TYPE_NUMERIC)}}     

It says

   value CELL_TYPE_NUMERIC is not a member of object org.apache.poi.hssf.usermodel.HSSFCell 

I dont understand why i cannot access this field. Could you please help on that.

regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:02:17+00:00Added an answer on June 11, 2026 at 4:02 pm

    Scala treats static fields a bit different. In scala there are no static fields, so scala builds virtual objects for the static fields in java classes. As CELL_TYPE_NUMERIC is not defined on org.apache.poi.hssf.usermodel.HSSFCell but on org.apache.poi.ss.usermodel.Cell, you can’t access it from there, because inheritance is not taken into account on static members. You can access the field directly:

    scala> org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC
    res1: Int = 0
    

    If inheritance was taken into account, this would lead to inconsistencies with how scala objects work. In scala a companion object does not inherit anything from the companion of the classes superclass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a bit of code to upload a file from the device to
I'm writing a bit of code to help me with some math stuff. I'm
I often end up writing a bit of code twice when using a loops.
I'm writing a bit of JNI code where a DLL running in the process
I'm having issues with a bit of code that I am writing in C#.
I'm writing a program for an exercise that will read data from a file
I'm trying to open a file for read/write. I've been developing on Ubuntu, and
Hey so I'm trying to clean up my code a bit, and I just
When I run this code to load a jpeg file I get a crash
I'm pretty new to C and thought I'd learn a bit more. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.