https://bz.apache.org/bugzilla/show_bug.cgi?id=63108

--- Comment #4 from aditsu <[email protected]> ---
It's not a simple fix because of the 2nd problem
I wrote some workaround code in kotlin:

fun Sheet.getRealColumnWidth(columnIndex: Int): Int {
        if (this !is XSSFSheet) return getColumnWidth(columnIndex)
        val col: CTCol? = columnHelper.getColumn(columnIndex.toLong(), false)
        val width = if (col == null || !col.isSetWidth) realDefaultColumnWidth
else col.width
        return (width * 256).roundToInt()
}

val XSSFSheet.realDefaultColumnWidth: Double get() {
        // <HAX>
        val fld = XSSFSheet::class.java.getDeclaredField("worksheet")
        fld.setAccessible(true)
        @Suppress("UNCHECKED_CAST")
        val worksheet = fld.get(this) as CTWorksheet
        // </HAX>

        val pr: CTSheetFormatPr? = worksheet.sheetFormatPr
        return pr?.defaultColWidth ?: 8.0
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to