(add-sheet-names replacements)
For replacements that don't have an explicit sheet name, add a unique one.
For replacements that don't have an explicit sheet name, add a unique one.
(build-base-output template-file output-file)
Build an output file with all the rows stripped out. This keeps all the styles and annotations while letting us write the spreadsheet using streaming so it can be arbitrarily large
Build an output file with all the rows stripped out. This keeps all the styles and annotations while letting us write the spreadsheet using streaming so it can be arbitrarily large
(cell-seq sheet)
Return a lazy seq of cells on the sheet in row major order (that is, across and then down)
Return a lazy seq of cells on the sheet in row major order (that is, across and then down)
(charts-from-file excel-file)
Extract the chart info from a file
Extract the chart info from a file
(copy-row translation-table wb sheet src-row dst-row)
Copy a single row of data from the template to the output, and the styles with them
Copy a single row of data from the template to the output, and the styles with them
(copy-styles wb src-row dst-row)
Copy the styles from one row to another. We don't really copy, but rather assume that the styles with the same index in the source and destination are the same. This works since the destination is a copy of the source.
Copy the styles from one row to another. We don't really copy, but rather assume that the styles with the same index in the source and destination are the same. This works since the destination is a copy of the source.
(create-missing-sheets! excel-file replacements chart-data)
Updates the excel file with any missing sheets, referred to by :sheet-name in the replacements.
Updates the excel file with any missing sheets, referred to by :sheet-name in the replacements.
(create-temp-xlsx-file prefix)
Create a temp file with correct headers to be opened by OPCPackage
Create a temp file with correct headers to be opened by OPCPackage
(expand-replacements replacements)
Expand any keys of the form [start end] in the replacement map to being individual row keys
Expand any keys of the form [start end] in the replacement map to being individual row keys
(extract-charts workbook)
Get all the charts on the various sheets and return their XML as a dictionary keyed by sheet name. Then, delete the charts from the original workbook.
This is necessary because POI has a bug cloning sheets with charts on them. See https://github.com/tomfaulhaber/excel-templates/issues/7 for info.
Get all the charts on the various sheets and return their XML as a dictionary keyed by sheet name. Then, delete the charts from the original workbook. This is necessary because POI has a bug cloning sheets with charts on them. See https://github.com/tomfaulhaber/excel-templates/issues/7 for info.
(filter-zip-file input-file output-file rules)
Filter zip file copies the zip file deleting and modifying the entries according to the rules provided
Filter zip file copies the zip file deleting and modifying the entries according to the rules provided
(formula? cell)
Return true if src-cell has a formula
Return true if src-cell has a formula
(get-sheet-names wb)
Get all the sheet names in a workbook in the order they appear
Get all the sheet names in a workbook in the order they appear
(get-sheets wb)
Get all the sheet objects in a workbook in the order they appear
Get all the sheet objects in a workbook in the order they appear
(get-template template-file)
Get a file by its pathname or, if that's not found, use the resources
Get a file by its pathname or, if that's not found, use the resources
(get-val cell)
Get the value from a cell depending on the type
Get the value from a cell depending on the type
(has-formula? sheet)
returns true if any of the cells on the sheet are calculated
returns true if *any* of the cells on the sheet are calculated
(indexed coll)
For the collection coll with elements x0..xn, return a lazy sequence of pairs [0 x0]..[n xn]
For the collection coll with elements x0..xn, return a lazy sequence of pairs [0 x0]..[n xn]
(inject-data-row data-row translation-table wb sheet src-row dst-row)
Take the data from the collection data-row and set the cell values in the target row accordingly. If there are any nil values in the source collection, the corresponding cells are not modified.
Take the data from the collection data-row and set the cell values in the target row accordingly. If there are any nil values in the source collection, the corresponding cells are not modified.
(insert-charts workbook chart-data src-sheet dst-sheet src-index target-loc)
Add the charts back into the sheets
Add the charts back into the sheets
(memfnx method n-args)
Like memfn, but gives n-args arguments so I don't have to name them.
Like memfn, but gives n-args arguments so I don't have to name them.
(normalize replacements)
Convert replacements to their verbose form.
Convert replacements to their verbose form. * TODO allow single map of replacements to default sheet (0)) * make sheet-datas vectors * add explicity :sheet-name to each sheet-data
(pad-sheet-rows! sheet replacements)
Make sure that the sheet has at least the rows it needs to handle the incoming replacements.
Make sure that the sheet has at least the rows it needs to handle the incoming replacements.
(render-to-file template-file output-file replacements)
Build a report based on a spreadsheet template
Build a report based on a spreadsheet template
(render-to-stream template-file output-stream replacements)
Build a report based on a spreadsheet template, write it to the output stream.
Build a report based on a spreadsheet template, write it to the output stream.
(replacements-by-sheet-name replacements)
Convert replacements to a map of concrete sheet name -> sheet data map.
{'Sheet1' [{:sheet-name 'Sheet1-1' ...} {:sheet-name 'Sheet1-2' ...}]}
=>
{'Sheet1-1' {...} 'Sheet1-2' {...}}
Convert replacements to a map of concrete sheet name -> sheet data map. {'Sheet1' [{:sheet-name 'Sheet1-1' ...} {:sheet-name 'Sheet1-2' ...}]} => {'Sheet1-1' {...} 'Sheet1-2' {...}}
(row-map? data)
Returns true if this structure is a row-map. The difference between a row map and a worksheet map is that a row map doesn't contain any other maps and a worksheet map does.
Returns true if this structure is a row-map. The difference between a row map and a worksheet map is that a row map doesn't contain any other maps and a worksheet map does.
(set-formula wb cell formula)
Set the formula for the given cell
Set the formula for the given cell
(set-val wb cell val)
Set the value in the given cell, depending on the type
Set the value in the given cell, depending on the type
(xml-to-str xml-data)
Generate an XML string from parsed XML using clojure.xml
Generate an XML string from parsed XML using clojure.xml
(zip s1 s2)
mix together two seqs like (zip [a b c] [x y z]) => [[a x] [b y] [c z]]
mix together two seqs like (zip [a b c] [x y z]) => [[a x] [b y] [c z]]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close