I had a similar case but I already had the proper width and height, what I was looking for is the autoadjust for the text to be writen inside the cell, the method is:
Format::setTextWrap();
Today there are many good libraries mainly the is one in composer, but sometimes you cant just upgarde your PHP version that easy.