B4J Code Snippet [XLUtils] [jPOI5] Detect/unhide hidden rows and columns in a worksheet

B4X:
Dim i As Int
Dim theSheet As PoiSheet = ...
Dim joTheSheet As JavaObject = theSheet
Dim theSheetWriter As XLSheetWriter = ...
Dim theSheetLastRow1 As Int = theSheet.LastRowNumber + 1 ' One-based index of the last row in the sheet
Dim theSheetLastCol0 As Int = theSheet.GetRow(0).Cells.Size - 1 ' Zero-based index of the last column in the sheet's first row

For i = 0 To theSheetLastCol0
    Dim columnIsHidden As Boolean = joTheSheet.RunMethod("isColumnHidden", Array(i))
    If columnIsHidden Then joTheSheet.RunMethod("setColumnHidden", Array(i, False)) ' Unhide the column
Next

For i = 1 To theSheetLastRow1
    Dim joRow As JavaObject = theSheetWriter.GetRow(XL.AddressName("A" & i))
    Dim rowIsHidden As Boolean = joRow.RunMethod("getZeroHeight", Null)
    If rowIsHidden Then joRow.RunMethod("setZeroHeight", Array(False)) ' Unhide the row
Next
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…