Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making it support Doubles and Booleans. A simple hack to work around #24

  • Loading branch information...
commit 636a59c93a0e1017aaeeaaae2b17313b03339f2d 1 parent 2ac3ef8
@folone authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/main/scala/info/folone/scala/poi/Workbook.scala
View
9 src/main/scala/info/folone/scala/poi/Workbook.scala
@@ -1,8 +1,10 @@
import org.apache.poi._
import hssf.usermodel._
import java.io.{ File, FileOutputStream, OutputStream, InputStream, FileInputStream }
+import scala.util.control.Exception.allCatch
import scalaz._
import syntax.applicative._
+import std.option._
import effect.IO
package info.folone.scala.poi {
@@ -19,7 +21,12 @@ package info.folone.scala.poi {
cells foreach { cl
val Cell(index, data) = cl
val cell = row createCell index
- cell setCellValue data
+ (allCatch.opt(data.toDouble),
+ allCatch.opt(data.toBoolean)) match {
+ case (Some(d), None) cell.setCellValue(d)
+ case (None, Some(b)) cell.setCellValue(b)
+ case _ cell.setCellValue(data)
+ }
val height = data.split("\n").size * row.getHeight
row setHeight height.asInstanceOf[Short]
}
Please sign in to comment.
Something went wrong with that request. Please try again.