Liking cljdoc? Tell your friends :D

excel-clj.core

Utilities for declarative creation of Excel (.xlsx) spreadsheets, with higher level abstractions over Apache POI (https://poi.apache.org/).

The highest level data abstraction used to create excel spreadsheets is a tree, followed by a table, and finally the most basic abstraction is a grid.

The tree and table functions convert tree formatted or tabular data into a grid of [[cell]].

Run the (example) function at the bottom of this namespace to see more.

Utilities for declarative creation of Excel (.xlsx) spreadsheets,
with higher level abstractions over Apache POI (https://poi.apache.org/).

The highest level data abstraction used to create excel spreadsheets is a
tree, followed by a table, and finally the most basic abstraction is a grid.

The tree and table functions convert tree formatted or tabular data into a
grid of [[cell]].

Run the (example) function at the bottom of this namespace to see more.
raw docstring

*max-col-width*cljdeprecated

Deprecated -- no longer has any effect.

Deprecated -- no longer has any effect.
sourceraw docstring

*n-threads*cljdeprecated

Deprecated -- no longer has any effect.

Deprecated -- no longer has any effect.
sourceraw docstring

example-workbook-dataclj

source

tableclj

(table tabular-data
       &
       {:keys [headers header-style data-style]
        :or {data-style (constantly {})}})

Build a sheet grid from the provided collection of tabular data, where each item has the format {Column Name, Cell Value}.

If provided headers is an ordered coll of column names header-style is a function header-name => style map for the header. data-style is a function that takes (datum-map, column name) and returns a style specification or nil for the default style.

Build a sheet grid from the provided collection of tabular data, where each
item has the format {Column Name, Cell Value}.

If provided
  headers      is an ordered coll of column names
  header-style is a function header-name => style map for the header.
  data-style   is a function that takes (datum-map, column name) and returns
               a style specification or nil for the default style.
sourceraw docstring

treeclj

(tree t
      &
      {:keys [headers formatters total-formatters min-leaf-depth data-format]
       :or {formatters style/default-tree-formatters
            total-formatters style/default-tree-total-formatters
            min-leaf-depth 2
            data-format :accounting}})

Build a sheet grid from the provided tree of data [Tree Title [[Category Label [Children]] ... [Category Label [Children]]]] with leaves of the shape [Category Label {:column :value}].

E.g. The assets section of a balance sheet might be represented by the tree [:balance-sheet [:assets [[:current-assets [[:cash {2018 100M, 2017 90M}] [:inventory {2018 1500M, 2017 1200M}]]] [:investments {2018 50M, 2017 45M}]]]]

If provided, the formatters argument is a function that takes the integer depth of a category (increases with nesting) and returns a cell format for the row, and total-formatters is the same for rows that are totals.

Build a sheet grid from the provided tree of data
  [Tree Title [[Category Label [Children]] ... [Category Label [Children]]]]
with leaves of the shape [Category Label {:column :value}].

E.g. The assets section of a balance sheet might be represented by the tree
[:balance-sheet
  [:assets
   [[:current-assets
     [[:cash {2018 100M, 2017 90M}]
      [:inventory {2018 1500M, 2017 1200M}]]]
    [:investments {2018 50M, 2017 45M}]]]]

If provided, the formatters argument is a function that takes the integer
depth of a category (increases with nesting) and returns a cell format for
the row, and total-formatters is the same for rows that are totals.
sourceraw docstring

with-titleclj

(with-title grid title)

Write a title above the given grid with a width equal to the widest row.

Write a title above the given grid with a width equal to the widest row.
sourceraw docstring

write!clj

(write! workbook path)

Write the workbook to the given filename and return a file object pointing at the written file.

The workbook is a key value collection of (sheet-name grid), either as map or an association list (if ordering is important).

Write the workbook to the given filename and return a file object pointing
at the written file.

The workbook is a key value collection of (sheet-name grid), either as map or
an association list (if ordering is important).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close