The JSON file to initialize the report - Stefanius67/XFPDF GitHub Wiki
Nearly all properties, that define the appearance and format of the data report can be defined in a JSON file and be passed with the initGrid()
method.
Here is an example of such a definition file, that contains all posible settings. The file must not contain all available settings - missing properties are initialized with a default value.
It is recommendet to call the initGrid() method immediatly after creating a XPDF instance (or in the constructor of a class extending XPDF).
Note:
Don't copy the code below since the JSON-Format doesn't support the comments that are used to explain the entries!
You can use thexfpdf-sample.json
file from the root of this repository as template for your own definition instead.
{
//-----------------------------------------------------------------------
// all font definitions MUST contain
// - font: "Times", "Arial", "Courier", "Symbol" or any userdefined font
// - style: "" -> regular, "B" -> bold, "I" -> italic, "U" -> underline
// ... or any combination of
// - size: fontsize in PT
//-----------------------------------------------------------------------
// the font used for the top line in the pageheader
"fontHeader" : { "name" : "Times", "style" : "B", "size" : 14 },
// the font used for the subline in the pageheader (subject)
"fontSubject" : { "name" : "Times", "style" : "BI", "size" : 9 },
// the font used in the pagefooter
"fontFooter" : { "name" : "Arial", "style" : "I", "size" : 8 },
// the font used in the colheaders of the table
"fontColHeader" : { "name" : "Arial", "style" : "B", "size" : 10 },
// the font used in the subheader, carryover, subtotals and totals lines in the table
"fontSubHeader" : { "name" : "Arial", "style" : "", "size" : 10 },
// the font used in all other datarows in the table
"fontRows" : { "name" : "Arial", "style" : "", "size" : 9 },
// height of the tablerows in mm
"fltLineHeight" : 6.0,
//-----------------------------------------------------------------------
// all subsequent color values have to be specified in CSS color notation
// !!! DO NOT use CSS color constants !!!
//-----------------------------------------------------------------------
// the textcolor used for the pageheader and subject
"strHeaderTextColor" : "#000000",
// the drawcolor used for the double underline of the page header
"strHeaderDrawColor" : "#404040",
// the textcolor used for the pagefooter
"strFooterTextColor" : "#000000",
// the drawcolor used for the overline of the pagefooter
"strFooterDrawColor" : "#404040",
// the textcolor used for the coll header cells
"strColHeaderTextColor" : "#fff",
// the fillcolor used for the coll header cells background
"strColHeaderFillColor" : "#4F5B93",
// the textcolor used for the subheader, carryover, subtotals and totals
"strSubHeaderTextColor" : "#000000",
// the fillcolor used for the subheader, carryover, subtotals and totals background
"strSubHeaderFillColor" : "#AAD",
// the textcolor used for the data cells
"strRowTextColor" : "#000000",
// the drawcolor for all table borders
"strRowDrawColor" : "#404040",
// the fillcolor used for the data cells background of each 2'nd row,
// if "bStripped" is activated
"strRowFillColor" : "#CCF",
// if set to true, each second row is filled wit the backgroundcolor
// specified in "strRowFillColor"
"bStripped" : true,
// border of the cells, can be "T", "R", "B", "L" (top, left, bottom, right),
// any combination or numeric value 1 for all
"border" : 1,
// if set to true, totals and subtotals are calculated for all cols marked
// with FLAG_TOTALS_CALC
"bCalcTotals" : false,
// if set to true, a totals row at the end of each page is generated
"bPageTotals" : false,
// if set to true, each page starts with an carry over row after the column headers
"bCarryOver" : false,
// the text used in the ending totals row in the cell marked with FLAG_TOTALS_TEXT
"strTotals" : "",
// the text used in the page totals row in the cell marked with FLAG_TOTALS_TEXT
"strPageTotals" : "",
// the text used in the carry over row in the cell marked with FLAG_TOTALS_TEXT
"strCarryOver" : "",
// the charset used from the script
"strCharset" : "UTF-8",
// locale to use for the formatting of numbers, currencies, date and time
"strLocale" : "de_DE.utf8, de_DE",
// format for date-time cells - expects a IntlDateFormatter compliant pattern
"strFormatDT" : "dd.MM.yyyy / HH:mm",
// format for date cells - expects a IntlDateFormatter compliant pattern
"strFormatD" : "EEE, dd.MM.yyyy",
// format for time cells - expects a IntlDateFormatter compliant pattern
"strFormatT" : "HH:mm",
// count of decimal digits for numerical cells
"iNumberDecimals" : 2,
// prefix before numbers in numerical cells
"strNumberPrefix" : null,
// suffix after numbers in numerical cells (e.g. unit, dimension)
"strNumberSuffix" : "%"
}