Can auto resize font size and keep column widths,row height

Topics: Developer Forum, Project Management Forum, User Forum
Sep 11, 2008 at 10:01 AM

   Can resize font size and keep column widths, row height
Sep 11, 2008 at 6:16 PM
Not sure exactly what you mean. Can you post some example that shows what you are trying?
Sep 18, 2008 at 8:14 AM
1. usually I set font size at No. 10
2. When there are a lot of characters, I hope it can    automatically adjust to smaller font size
    while keeping the same column width and row height.
Sep 18, 2008 at 1:21 PM
In MS Office Excel you do this as follows:

Format Cells > Alignment > Shrink to fit (checkbox)

In PHPExcel the corresponding method is:

Feb 18, 2010 at 5:28 AM

In Reference to Threads:

why setAutoSize(true) does not work ? 
setAutoSize not working as intended? 

And this.

I've been trying to get either setShrinkToFit(true) or setAutoSize(true) to work without any success. I am using svn-39887 at the moment.

Most Recent Attempt code sample:


	$objPHPExcel->getActiveSheet()->getStyle(GetExcelColumn($colNum). 3)->getAlignment()->setShrinkToFit(true);
Where GetExcelColumn is a function to get the correct 1-indexed column letter.

What am I doing wrong here? 


Feb 18, 2010 at 10:10 PM

Check this post for a full example demonstrating shrink-to-fit: