Is there a way to make text adjust so that it divides lines of text so that it occupies the least amount of horizontal space while having the same number of lines as it would normally have. The images bellow are an example of normal text and what I'm looking for.
Please give a "real text" example.
Hope this is kind of what you meant.
I'm not quite sure if I understand your issue.
Just using centre aligned text and doing the desired line breaks with Shift+Enter does not work, does it?
I mean, yes. However, I wanted to know if there was a way to automatize this process, as I intend to use data sets in my project.
OK, that is a new aspect. Thanks for the elaboration.
But I think you will have to provide some more infos.
For example, are you looking for some fixed horizontal spreading (e.g. 80 mm maximum width)? Or a minimum size? Or something else?
It may also help to provide a sample Illustrator file (.ai) including data sets and including further instructions that may describe the request as detailed as possible.
As for further instructions, there are some. The font size is 7 pt. The length of the box is 5.5 cm, and the height of the box is 1.6 cm. They are both fixed and, therefore, the maximum dimensions of the box. None of the texts that are to be put in that box wouldn't normally fit in it. The need for the text to occupy the least horizontal space is purely visual, and the need for the text to have the same number of lines as it normally would is, in the case of the text already occupying the four lines that box can hold, to make sure the text will still fit in it.
As for the file, it still doesn't have data sets implemented. However, I can provide it in its current state, if it is of any help. If it is, the box I refer to is the second from the bottom, but the same idea should apply for the box first from the bottom. I"ll send the file as this Google Drive file, because, for some reason, when I try to attach it to the reply, I get a "The attachment's test test.ai content type (application/postscript) does not match its file extension and has been removed." error message. Hope it works.
Another question: InDesign is definitely out of the question for you?
No, I guess, as long as it is able to solve the problem.
… IMHO better than Illustrator I think …
But it's hard to say - without real text examples.