Skip to content

Table Cell Gap #11

Description

@dgofman

We need an option to control gaps between row cells. I am suggesting to add "line-height" CSS style.

Here is Example:

Line 113:

function getFontObject(data, defaultfont) {
        var result = {},
            fonts = documentTemplateData.fonts || {},
            deffnt = defaultfont || fonts.default || defaultFont;

        if (typeof data === 'string') {
            if (data in fonts) {
                result = fonts[data];
            }
        } else if (typeof data === 'object') {
            result = data;
        }

        return {
            name: result.name || deffnt.name,
            size: result.size || deffnt.size,
            color: result.color || deffnt.color,
            line_height: result.line_height || 0
        };
    }

Line 775

var currentCellHeight = (writeText(document, cellData.text, currentCellPositionLeft + x_offset, currentCellPositionTop + 1, cellData.format).y - currentCellPositionTop) + 0.75 + (cellData.font.line_height || 0);

Test:

doc.addTable('content', [
        [{
            border: {
                color: '#000',
                style: 'normal',
                position: ['top'],
                linemode: true
            }
        }],
        [{
            text: 'Cell 1-1',
            font: {size: 9, line_height: 100},
        }, {
            text: 'Cell 1-2',
        }],
        [{
            text: 'Cell 2-1',
            font: {size: 9, line_height: 50},
        }, {
            text: 'Cell 2-2',
            font: {size: 9, line_height: 50},
        }]
    ]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions