Created
October 14, 2018 00:32
-
-
Save ciferkey/393fec4083f9c68a8233257ad34c7a18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Sheet.row(rowNumber: Int? = null, block: Row.() -> Unit): Row { | |
return createRow(rowNumber ?: physicalNumberOfRows).apply(block) | |
} | |
fun Row.cell(value: Any? = null, column: Int? = null, block: Cell.() -> Unit = {}): Cell { | |
val cell = createCell(column ?: physicalNumberOfCells) | |
when (value) { | |
is Calendar -> cell.setCellValue(value) | |
is Date -> cell.setCellValue(value) | |
is Boolean -> cell.setCellValue(value) | |
is Double -> cell.setCellValue(value) | |
is String -> cell.setCellValue(value) | |
is RichTextString -> cell.setCellValue(value) | |
} | |
return cell.apply(block) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment