Skip to content

HTML Table styling #2283

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

Closed
vicotec opened this issue Aug 29, 2022 · 3 comments
Closed

HTML Table styling #2283

vicotec opened this issue Aug 29, 2022 · 3 comments

Comments

@vicotec
Copy link

vicotec commented Aug 29, 2022

Is your feature request related to a problem? Please describe.

I need to generate a docx file containing a html table. However, the default styling of the table has no cellpadding whatsoever, makign it look a bit ugly. I could manually create the table, row for row, cell for cell, in phpword, but that seems like an unnecessary workaround.

Describe the solution you'd like

More stylings possible for HTML tables, e.g. cellPadding, or working margins/paddings in table cells

Describe alternatives you've considered

Manually parsing my html string and creating the table in phpword

@Progi1984
Copy link
Member

@vicotec Hi, Could you send me some code, for analyzing it, please ?

@Progi1984 Progi1984 added the Status: Waiting for feedback Question has been asked, waiting for response from PR author label Aug 22, 2024
@vicotec
Copy link
Author

vicotec commented Aug 22, 2024

@Progi1984 sure thing!
just to make sure, I've also updated to version 1.2.0, but the issue still exists.

        Settings::setOutputEscapingEnabled(true);

        $word = new PhpWord();
        $section = $word->addSection();

        $writer = IOFactory::createWriter($word, 'Word2007');
        $html = '<table><tr><th style="text-align: left; vertical-align: top; border: 1px solid black; padding: 4px; font-weight: bold;">test A</th><td style="text-align: left; vertical-align: top; border: 1px solid black; padding: 4px;">test B</td></tr></table>';

        Html::addHtml($section, $html, false, false);

        $name = 'printtest.docx';

        $writer->save($name);

@Progi1984 Progi1984 added Bug Report and removed Change Request Status: Waiting for feedback Question has been asked, waiting for response from PR author labels Aug 22, 2024
@Progi1984 Progi1984 added this to the 1.3.0 milestone Aug 22, 2024
@Progi1984 Progi1984 modified the milestones: 1.3.0, 1.3.1 Sep 1, 2024
@Progi1984
Copy link
Member

Fixed in #2697 by @Azamat8405.

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

No branches or pull requests

2 participants