Skip to main content

export-data

PRO

The functionality is available in PRO Edition only

Builds an export payload from the current board view and sends it to a remote export service (PDF/PNG) or to a host-supplied function (for example, for client-side xlsx generation).

Usage​

type ExportConfig = {
url?:
| string
| ((
data: ExportConfig,
records: KanbanCard[],
helpers: ExportHelpers
) => void);
format?: string;
fileName?: string;
skin?: string;
paper?: PaperConfig;
excel?: ExcelConfig;
};
FieldTypeDescription
urlstring | functionTransport selector. A string URL POSTs a hidden form to the export service. A function receives the payload directly. Omitting url assembles but doesn't dispatch.
formatstringExport format: "pdf", "png", "xlsx", etc. Default: "pdf".
fileNamestringOutput file name (without extension). Default: "tasks".
skinstringServer-side theme (see below). Default: "willow".
paperPaperConfigPDF/PNG page options (see below).
excelExcelConfigExcel-specific options (see below).

skin values:

  • "dark", "willow-dark" - WillowDark theme
  • "print" - Print theme
  • "bw" - PrintBW theme
  • any other value - Willow theme (default)

PaperConfig:

FieldTypeDescription
fitSizebooleanFit content to page size
sizestring | { width: number; height: number }Page size (e.g. "A4")
landscapebooleanLandscape orientation
stylesstring | string[]Extra CSS; URLs are fetched and inlined
margins{ top?, bottom?, left?, right? }Page margins in px
headerstringPage header HTML
footerstringPage footer HTML
scalenumberRender scale factor

ExcelConfig:

FieldTypeDescription
sheetNamesstring[]Sheet names in the workbook
dateFormatstringDate format string
indent"native" | "spaces"Indentation style

Function transport records: the visible cards, flattened. Ordinary boards use column order. Swimlane boards use lane, then column, then cell order.

ExportHelpers (passed to function transports):

FieldTypeDescription
post(url: string, data: Record<string, string>) => voidHidden-form POST helper
serialize(value: any) => stringJSON serializer with Date handling

The exported view drops empty and collapsed columns. Swimlane boards keep lane order and lane headers.

The action handler is async. It resolves true after it dispatches the payload, or after it schedules the capture pass for custom cardContent / cardCss / columnCss. It doesn't report whether the download succeeded.

Trigger​

import { version } from "@svar-ui/vue-kanban";

api.exec("export-data", {
url: "https://export.svar.dev/kanban/" + version,
format: "pdf",
skin: "print",
});

Export to xlsx using a function transport:

api.exec("export-data", {
url: (cfg, records, helpers) => {
// build xlsx from records client-side
},
format: "xlsx",
});

Observe​

api.on("export-data", ev => {
console.log("Export triggered:", ev.format);
});

Intercept​

api.intercept("export-data", ev => {
// cancel export for empty boards
const state = api.getState();
return state.viewData.columns.some(c => c.cards.length > 0);
});

Component handler​

<Kanban
:cards="cards"
:columns="columns"
:onexportdata="(ev) => console.log('Exported:', ev.format)"
/>