skip to Main Content

In our project, we used the latest version of maatwebsite which is 3.1

We want to set the first value for example in E1.

In lower version, they have the setcellValue.

Question: Does 3.1 have the equivalent setCellValue?

Note: I tried the startCell but that is not what I want, it moves all the columns

2

Answers


  1. maatwebsite uses phpspreadsheet.

    Having maatwebsite object, you can get phpspreadsheet underlying object with macro, and after that, you can manipulate sheet with phpspreadsheet methods, for example setCellValue.

    Login or Signup to reply.
  2. If you are talking about exporting, this may be the answer WithCustomStartCell. Yet it only available for ToCollection method.

    namespace AppExports;
    
    use AppInvoice;
    use MaatwebsiteExcelConcernsFromCollection;
    use MaatwebsiteExcelConcernsWithCustomStartCell;
    
    class InvoicesExport implements FromCollection, WithCustomStartCell
    {
        public function collection()
        {
            return Invoice::all();
        }
    
        public function startCell(): string
        {
            return 'B2';
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search