FreeReportv0.9.0한국어

Report definition

A report is a JSON object: page setup, default font, parameters, styles and bands of positioned elements. Every property of the definition explained.

A report is a JSON object: page setup, a default font, optional parameters and styles, and bands of positioned elements. The layout engine binds it to data and produces pages; the viewer, printing, PDF and Excel all draw those same pages, so they match.

{
  "name": "거래처별 매출",
  "page": { "size": "A4", "orientation": "portrait", "margins": 15 },
  "font": { "family": "Nanum Gothic", "size": 9 },
  "sort": ["customer", "date"],
  "bands": {
    "title": { "height": 14, "elements": [
      { "type": "text", "x": 0, "y": 0, "w": 180, "h": 10, "text": "거래처별 매출", "style": { "fontSize": 16, "bold": true } }
    ] },
    "columnHeader": { "height": 7, "elements": [
      { "type": "text", "x": 0, "y": 0, "w": 30, "h": 7, "text": "일자", "style": { "bold": true, "border": true } },
      { "type": "text", "x": 30, "y": 0, "w": 110, "h": 7, "text": "거래처", "style": { "bold": true, "border": true } },
      { "type": "text", "x": 140, "y": 0, "w": 40, "h": 7, "text": "금액", "style": { "bold": true, "border": true } }
    ] },
    "detail": { "height": 6, "elements": [
      { "type": "field", "x": 0, "y": 0, "w": 30, "h": 6, "expr": "date", "format": "yyyy-MM-dd", "style": { "border": true } },
      { "type": "field", "x": 30, "y": 0, "w": 110, "h": 6, "expr": "customer", "suppressRepeated": true, "style": { "border": true } },
      { "type": "field", "x": 140, "y": 0, "w": 40, "h": 6, "expr": "amount", "format": "#,##0", "style": { "border": true, "align": "right" } }
    ] },
    "summary": { "height": 8, "elements": [
      { "type": "text", "x": 0, "y": 1, "w": 180, "h": 7, "text": "합계 {sum(amount):#,##0}원 ({koreanAmount(sum(amount))})", "style": { "align": "right", "bold": true } }
    ] },
    "pageFooter": { "height": 8, "elements": [
      { "type": "text", "x": 0, "y": 2, "w": 180, "h": 5, "text": "{page} / {pages}", "style": { "align": "center" } }
    ] }
  }
}
NameTypeDescription
namestringReport name; used for file names and the output event.
pagePageSetupPaper size, orientation and margins.
font{ family, size, color }Default font of the report (default Nanum Gothic 9pt).
stylesRecord<string, Style>Named styles; elements refer to them with styleName.
paramsRecord<string, ParamDefinition>Report parameters shown in the viewer's parameter panel.
dataSourcestringWhich array in the data holds the detail rows (default "rows").
sortstring[]Sort detail rows, e.g. ["region", "-amount"] ("-" = descending).
filterExprKeep only rows where the expression is truthy.
bandsobjecttitle, pageHeader, columnHeader, groups, detail, summary, pageFooter, noData.
pageHeaderSkipFirstbooleanDo not print the page header on the first page.
fillEmptyRowsbooleanFill the rest of each page with blank detail rows (form tables).
watermarkstring | Watermark | Watermark[]Text or image marks behind (or over) the content.
embossEmboss | Emboss[]Raised seals, logos or text pressed into the paper.

All positions and sizes are millimetres from the top-left of the band. Font sizes are points.