Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Cell Gap #11

Open
dgofman opened this issue Jan 7, 2016 · 1 comment
Open

Table Cell Gap #11

dgofman opened this issue Jan 7, 2016 · 1 comment

Comments

@dgofman
Copy link

dgofman commented Jan 7, 2016

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},
        }]
    ]);
@LitixThomas
Copy link
Member

You mean a fixed table cell height, right? That is what happens, when I check your code. Or the real gap between two text lines? Like this http://www.w3schools.com/cssref/pr_dim_line-height.asp :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants