B4J Question [SOLVED] jPOI how to return 'value' in formular cell?

Discussion in 'B4J Questions' started by Mashiane, Jul 10, 2019.

  1. Mashiane

    Mashiane Expert Licensed User


    SOLUTION: https://www.b4x.com/android/forum/t...ls-text-property-display-value.99907/#content

    I have a large worksheet with a lot of columns that have formulas. I want to read the worksheet and save the values to a database. I am able to read the rest of the data however the formulas are returned as is.

    How can I ensure that when ...

    1. Open the workbook, all formulars are updated?
    2. Then when I read a cell, the value/result of the formular is returned and not the formular?


    This is what I'm testing

    'return the cell value
    Sub PoiGetCell(cell As PoiCell, bFormulasAsValues As Boolean) As String
    If cell.IsInitialized = True Then
    Select Case cell.CellType
    Case cell.TYPE_NUMERIC
    Return cell.ValueNumeric
    Case cell.TYPE_STRING
    Return cell.ValueString
    Case cell.TYPE_FORMULA
    If bFormulasAsValues = False Then
    Return cell.ValueFormula
    Return cell.Value
    End If
    Case cell.TYPE_BLANK
    Return ""
    Case cell.TYPE_BOOLEAN
    Return cell.ValueBoolean
    Case cell.TYPE_ERROR
    Return ""
    Case Else
    Return cell.Value
    End Select
    Return ""
    End If
    End Sub
    Last edited: Jul 10, 2019
  2. OliverA

    OliverA Expert Licensed User

  3. Mashiane

    Mashiane Expert Licensed User

    Thanks @OliverA , let me try this out!
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice