(chapter-start 'caxlsx “core caxlsx functions and macros”)

(assign xls-dsl {})

(def xls-dsl.sheet (name . body)

`(with (xls-worksheet (xls/worksheet/new xls-package ,name)
        xls-row-number 1)
   ,@body))

(def xls-dsl.style (rules)

`(xls/style/new xls-package ,rules))

(def xls-dsl.row (items options)

`(do
   ,(if options
      `(xls/row/new xls-worksheet ,items ,options)
      `(xls/row/new xls-worksheet ,items))
   (++ xls-row-number)))

(def xls-dsl.column-widths (widths)

`(xls/worksheet/column-widths xls-worksheet widths))

(mac xls workbooks

`(returnlet xls-package (xls/package/new)
   ,@(pre-compile-each xls-dsl workbooks)))