Reduce text length to fit cell width in a smart manner
- by Andrei Ciobanu
Hello,
I am in project where we are building a simple web calendar using Java EE technologies.
We define a table where every row is an employee, and every column represents an hour interval. The table width and column widths are adjustable. In every cell we have a text retrieved from a database, indicating what the employee is doing / should do in that time interval.
The problem is that sometimes the text in cells is getting bigger than the actual cell.
My task is to make the text more "readable" by reducing it's length in a "smart way" so that it can fit in the cell more "gracefully".
For example if initially in a cell I have: "Writing documents", after the resize I should retrieve: "Wrtng. dcmnts" or "Writ. docum." so that the text can fit well.
Is there a smart way to do it ? Or removing vocals / split the string in two is enough ?