PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 5, 2022

[FIXED] How to set auto-line break PhpExcel?

 October 05, 2022     php, phpexcel     No comments   

Issue

I'm using PHPExcel to generate some excel export. Excel has an autoline break feature. How can i activate this ?

My customer use only Microsoft Excel, so it don't have to support others programs.

Any ideas ?

I may use something like this : how to make New lines in a cell using phpexcel But that's more a kind of hack, than a real solution.

UPDATE : See, once columns are merged, wrap text fail. I tryied to add wrap text upon every column merged, but it don't affect result.

enter image description here

UPDATE 2 :

The cells are merged, then i add wrap text, then i add text.


Solution

Set the column to a fixed width; setWrapText(true) for the cells, and see what happens.

Look at the second sheet created in /Tests/05featuredemo.php for an example.

You only need to use \n if you want to control exactly where a line wraps



Answered By - Mark Baker
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing