-
- //In the excel.php file
- $objActSheet = $objPHPExcel->getActiveSheet();
- //Set the column name
- $objActSheet->setCellValue("b1", "Card Number");
- //Set the width of the column
- $objActSheet->getColumnDimension('b')->setWidth(20);//Change the length value set here
Copy code
2. The characters are excel If you understand it as a number, you usually set the field to text or find a way to add some spaces.
Solution:
-
- //Add data, mainly process the data to be displayed with the chunk_split() function. You can check the specific usage of this function by yourself
- $objActSheet->setCellValue ( "b$i", chunk_split( "123456789 ",4," ") );//Of course, if you don't want users to see spaces between numbers, then set the field value to be divided larger. For example, set 4 in the example to greater than or equal to 9. Can.
Copy code
|