function createModels(inputHeaders, inputData) {
        table = new Table();
        table.x = settings.margin.left;

        var splitRegex = /\r\n|\r|\n/g;

        // Header row and columns
        var headerRow = new Row(inputHeaders);
        headerRow.index = -1;

        var themeStyles = extend(defaultStyles, themes[settings.theme].table, themes[settings.theme].header);
        headerRow.styles = extend(themeStyles, settings.styles, settings.headerStyles);

        // Columns and header row
        inputHeaders.forEach(function (rawColumn, dataKey) {
            if (typeof rawColumn === 'object') {
                dataKey = typeof rawColumn.dataKey !== 'undefined' ? rawColumn.dataKey : rawColumn.key;
            }

            if (typeof rawColumn.width !== 'undefined') {
                console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.");
            }

            var col = new Column(dataKey);
            col.styles = settings.columnStyles[col.dataKey] || {};
            table.columns.push(col);

            var cell = new Cell();
            cell.raw = typeof rawColumn === 'object' ? rawColumn.title : rawColumn;
            cell.styles = headerRow.styles;
            cell.text = '' + cell.raw;
            cell.contentWidth = cell.styles.cellPadding * 2 + getStringWidth(cell.text, cell.styles);
            cell.text = cell.text.split(splitRegex);

            headerRow.cells[dataKey] = cell;
            settings.createdHeaderCell(cell, {column: col, row: headerRow, settings: settings});
        });
        table.headerRow = headerRow;

        // Rows och cells
        inputData.forEach(function (rawRow, i) {
            var row = new Row(rawRow);
            var isAlternate = i % 2 === 0;
            var themeStyles = extend(defaultStyles, themes[settings.theme].table, isAlternate ? themes[settings.theme].alternateRow : {});
            var userStyles = extend(settings.styles, settings.bodyStyles, isAlternate ? settings.alternateRowStyles : {});
            row.styles = extend(themeStyles, userStyles);
            row.index = i;
            table.columns.forEach(function (column) {
                var cell = new Cell();
                cell.raw = rawRow[column.dataKey];
                cell.styles = extend(row.styles, column.styles);
                cell.text = typeof cell.raw !== 'undefined' ? '' + cell.raw : ''; // Stringify 0 and false, but not undefined
                row.cells[column.dataKey] = cell;
                settings.createdCell(cell, hooksData({column: column, row: row}));
                cell.contentWidth = cell.styles.cellPadding * 2 + getStringWidth(cell.text, cell.styles);
                cell.text = cell.text.split(splitRegex);
            });
            table.rows.push(row);
        });
    }
/**
     * Create models from the user input
     *
     * @param inputHeaders
     * @param inputData
     */
Create models from the user input
@param inputHeaders
@param inputData
Create models from the user input @param inputHeaders @param inputData
function createModels(inputHeaders, inputData) {
        table = new Table();
        table.x = settings.margin.left;
        var splitRegex = /\r\n|\r|\n/g;
        var headerRow = new Row(inputHeaders);
        headerRow.index = -1;
        var themeStyles = extend(defaultStyles, themes[settings.theme].table, themes[settings.theme].header);
        headerRow.styles = extend(themeStyles, settings.styles, settings.headerStyles);
        inputHeaders.forEach(function (rawColumn, dataKey) {
            if (typeof rawColumn === 'object') {
                dataKey = typeof rawColumn.dataKey !== 'undefined' ? rawColumn.dataKey : rawColumn.key;
            }
            if (typeof rawColumn.width !== 'undefined') {
                console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.");
            }
            var col = new Column(dataKey);
            col.styles = settings.columnStyles[col.dataKey] || {};
            table.columns.push(col);
            var cell = new Cell();
            cell.raw = typeof rawColumn === 'object' ? rawColumn.title : rawColumn;
            cell.styles = headerRow.styles;
            cell.text = '' + cell.raw;
            cell.contentWidth = cell.styles.cellPadding * 2 + getStringWidth(cell.text, cell.styles);
            cell.text = cell.text.split(splitRegex);
            headerRow.cells[dataKey] = cell;
            settings.createdHeaderCell(cell, {column: col, row: headerRow, settings: settings});
        });
        table.headerRow = headerRow;
        inputData.forEach(function (rawRow, i) {
            var row = new Row(rawRow);
            var isAlternate = i % 2 === 0;
            var themeStyles = extend(defaultStyles, themes[settings.theme].table, isAlternate ? themes[settings.theme].alternateRow : {});
            var userStyles = extend(settings.styles, settings.bodyStyles, isAlternate ? settings.alternateRowStyles : {});
            row.styles = extend(themeStyles, userStyles);
            row.index = i;
            table.columns.forEach(function (column) {
                var cell = new Cell();
                cell.raw = rawRow[column.dataKey];
                cell.styles = extend(row.styles, column.styles);
                cell.text = typeof cell.raw !== 'undefined' ? '' + cell.raw : ''; 
                row.cells[column.dataKey] = cell;
                settings.createdCell(cell, hooksData({column: column, row: row}));
                cell.contentWidth = cell.styles.cellPadding * 2 + getStringWidth(cell.text, cell.styles);
                cell.text = cell.text.split(splitRegex);
            });
            table.rows.push(row);
        });
    }
function createModels ( inputHeaders , inputData ) { table = new Table ( ) ; table . x = settings . margin . left ; var splitRegex = / \r\n|\r|\n / g ; var headerRow = new Row ( inputHeaders ) ; headerRow . index = - 1 ; var themeStyles = extend ( defaultStyles , themes [ settings . theme ] . table , themes [ settings . theme ] . header ) ; headerRow . styles = extend ( themeStyles , settings . styles , settings . headerStyles ) ; inputHeaders . forEach ( function ( rawColumn , dataKey ) { if ( typeof rawColumn === 'object' ) { dataKey = typeof rawColumn . dataKey !== 'undefined' ? rawColumn . dataKey : rawColumn . key ; } if ( typeof rawColumn . width !== 'undefined' ) { console . error ( "Use of deprecated option: column.width, use column.styles.columnWidth instead." ) ; } var col = new Column ( dataKey ) ; col . styles = settings . columnStyles [ col . dataKey ] || { } ; table . columns . push ( col ) ; var cell = new Cell ( ) ; cell . raw = typeof rawColumn === 'object' ? rawColumn . title : rawColumn ; cell . styles = headerRow . styles ; cell . text = '' + cell . raw ; cell . contentWidth = cell . styles . cellPadding * 2 + getStringWidth ( cell . text , cell . styles ) ; cell . text = cell . text . split ( splitRegex ) ; headerRow . cells [ dataKey ] = cell ; settings . createdHeaderCell ( cell , { column : col , row : headerRow , settings : settings } ) ; } ) ; table . headerRow = headerRow ; inputData . forEach ( function ( rawRow , i ) { var row = new Row ( rawRow ) ; var isAlternate = i % 2 === 0 ; var themeStyles = extend ( defaultStyles , themes [ settings . theme ] . table , isAlternate ? themes [ settings . theme ] . alternateRow : { } ) ; var userStyles = extend ( settings . styles , settings . bodyStyles , isAlternate ? settings . alternateRowStyles : { } ) ; row . styles = extend ( themeStyles , userStyles ) ; row . index = i ; table . columns . forEach ( function ( column ) { var cell = new Cell ( ) ; cell . raw = rawRow [ column . dataKey ] ; cell . styles = extend ( row . styles , column . styles ) ; cell . text = typeof cell . raw !== 'undefined' ? '' + cell . raw : '' ; row . cells [ column . dataKey ] = cell ; settings . createdCell ( cell , hooksData ( { column : column , row : row } ) ) ; cell . contentWidth = cell . styles . cellPadding * 2 + getStringWidth ( cell . text , cell . styles ) ; cell . text = cell . text . split ( splitRegex ) ; } ) ; table . rows . push ( row ) ; } ) ; }
Create models from the user input
 @param inputHeaders
 @param inputData
Create models from the user input @param inputHeaders @param inputData
// Header row and columns // Columns and header row // Rows och cells // Stringify 0 and false, but not undefined