0

I am using laravel-excel package to import a xlsx file into my database. I have followed their guide and everything is working fine except i lose all styling from the cells.

For example i have in the cell:

The quick brown fox jumps over the lazy dog

But i always get it without bold:

The quick brown fox jumps over the lazy dog

I have searched everywhere and there doesnt seem to be a solution for this? Also i couldnt find any other package that would do the trick.

Is this even possible? Here is my code for importing.

        $this->output->title('Update starting!');

        (new DocumentsImport)->withOutput($this->output)->import( storage_path('app/docs/research2.xlsx'));

        $this->info('Update finished!');

And the DocumentsImport class:

public function model(array $row)
    {
        if (!isset($row[2]))
        {
            return null;
        }

        return new Document([
            'slug' => $row[31],
            'order' => $row[1],
            'date_issued' => $this->convertToDate($row[2]),
            'system_link' => $row[3],
            'website_link' => $row[4],
            'comments' => nl2br($row[5]),
            'full_doc_text' => nl2br($row[6]),
            'doc_title' => nl2br($row[7]),
            'backend_autolink_text' => nl2br($row[8]),
            'backend_autolink_text_second' => nl2br($row[9]),
            'year_issued' => $row[25],
            'doctype' => $row[10],
            'doctype_user' => $row[11],
            'sanctions_programs' => $row[12],
            'tags' => $row[13],
            'legal_provision' => $row[14],
            'legal_provision_states' => $row[15],
            'legal_provision_type' => $row[26],
            'legal_character' => $row[16],
            'special_tags' => $row[17],
            'specific_good' => $row[18],
            'country_entity' => $row[19],
            'relation_entity' => $row[20],
            'aggregate_penalty' => $row[21],
            'penalty_amount' => $row[22],
            'egregious' => $row[23],
            'vd' => $row[24],
            'multiple_agencies' => $row[28],
            'liability' => $row[29],
            'criminal' => $row[32],
            'transshipment_country' => $row[33],
            'price' => $row[38],
        ]);
    }
Shile
  • 1,063
  • 3
  • 13
  • 30

0 Answers0