Skip to content

All topics  /  Laravel

Laravel 7 Generate Word Document From HTML Example

Laravel ·

Hi Guys,

Here, i will show you how to works laravel 7 generate word document. i would like to share with you laravel 7 generate word document.

You'll learn laravel 7 generate docx. This article will give you simple example of create doc file in php laravel 7 example. You just need to some step to done create word document file in laravel 7.

Here i give you full example of generate word document file example like create route. So you have to just follow example.

Create Route:


Now,we need to create route for generate word document file in laravel 7.So following add route fille path.

following path:/routes/web.php

<?php
Route::get('docs-generate', function(){
    $headers = array(
        "Content-type"=>"text/html",
        "Content-Disposition"=>"attachment;Filename=myGeneratefile.doc"
    );

    
    $content = '<html>
            <head><meta charset="utf-8"></head>
            <body>
                <p>My Blog Laravel 7 generate word document from html Example - Nicesnippets.com</p>
                <ul><li>Php</li><li>Laravel</li><li>Html</li></ul>
            </body>
            </html>';

    
    return \Response::make($content,200, $headers);
});

It will help you...