Excel template engine
Scala
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project add coverage Jul 12, 2018
src ver up Jul 12, 2018
.gitignore initial commit Jun 26, 2018
.travis.yml add coverage Jul 12, 2018
README.md
build.sbt

README.md

Build Status Coverage Status

Asta4e

This library provide a template engine functionality for Excel for scala.

Feature

  • retrieve data from Excel and convert them to Map[String, Any] or a case class

  • create Excel from Map[String, Any] or a case class

Required

  • scala 2.11 or
  • scala 2.12

Usage

add dependency like the below

libraryDependencies ++= Seq(
      "com.axtstar" %% "asta4e" % "0.0.4"
)
  • get bind data from Excel

    The function needs 2 Excel files, first template Excel contains ${}. Second is data Excel file which contains data as exact same location as template Excel file.

val target = ExcelMapper.getDataAsTemplate(
        "template.xlsx",
        "data.xlsx")

             then, return to binddata to target

  • set bind data to Excel

    The function also needs 2 input Excel, first is Excel as same as the above, second is layout template Excel which copy to output data, asta4e does not manipulate excel layout.

import com.axtstar.asta4e.converter.E._
ExcelMapper.setDataAsTemplate(
        "template.xlsx",
        "data_template.xlsx",
        "output.xlsx",
        "A1" -> "test1" &
        "A2" -> null &
        "A3" -> "test3" &
        "A4" -> 1
)

             output Excel.

             com.axtstar.asta4e.converter.E._ is companion utilites for implicit conversion and gethering separeted tuple to Map.

LICENSE

Copyright 2018 axt

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.