konrms
6 months ago
545
11
Laravel

How to export laravel blade to word document

Posted 6 months ago by konrms

I want to add export to word functinality to one of my blades in Laravel. I have also asked that at stackoverflow hoping to get some help!

I have already run

composer require phpoffice/phpword

at cmd but I can't succesfully implement my export. Below you can see the blade I want to export to word. It is a very simple blade which takes fist and last name from a db table. I want to add a button at the bottom that exports to word on click. Could you assist please?

<!DOCTYPE html>

<html lang="el">
<head>
    <meta charset="UTF-8">
    <title>Full Name</title>
</head>
<body>

First Name: <b> {{ $name    }}</b><br>
Last Name: <b> {{ $lastname}}</b><br>



</body>
</html>

Please sign in or create an account to participate in this conversation.