Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.6K
Views
Combinar y centrar celdas en phpspreadsheet

Estoy buscando horas en el documento pero no tengo nada para fusionar y centrar horizontalmente.

alguien me puede ayudar como hacer esto?

mi último código:

 $spreadsheet = new Spreadsheet(); $excel = $spreadsheet->getActiveSheet(); $spreadsheet->getProperties()->setTitle($name_sheet)->setCreator('Creator'); $excel->mergeCells('A1:W1'); $excel->mergeCells('A2:W2'); $excel->mergeCells('A3:W3'); //how to make cells A1 till W1 to be centered cell?
over 4 years ago · Santiago Trujillo
1 answers
Answer question

1

Así es como centré todas las celdas y formateé todos los bordes.

 $last_row = count($data) + 6;

$sheet->getStyle('A5:Y' . $last_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
$sheet->getStyle('A5:Y' . $last_row)->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);

$borders = [
 'borders' => [
 'allBorders' => [
 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
 'color' => ['argb' => '000'],
 ],
 ],
];

$sheet->getStyle('A5:Y' . $last_row)->applyFromArray($borders);
almost 4 years ago · Omar Crespo Carrazana Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!