In my company, we're doing a lot of custom sized drawing.
So I want to know if it's possible to create a format fitting to the drawing paper size. And how, if yes.
I don't want to create a new format for each new custom size I need.
When a format is larger than the paper size, Creo will (or at least is supposed to) automatically fit it to the paper size. Just make sure you pick your intended paper size for output and have the plot set to "Full Plot".
Correct. If you want to make sure the paper scale always agrees with the drawing scale, then you should only use formats (and drawing sizes) that exactly match the actual paper size. In that case, you would only need a couple of formats (A and B) and then simply adjust the drawing's scale so everything fit.
You can't have it both ways. Either you reduce the drawing scale so everything fits on your paper sized format, or you leave the drawing full scale, use a big enough format so everything fits, and then let Creo scale it all to fit the selected paper when actually printing.
Noting that this is asked in Customization, you could make a Toolkit (or other API) app that interrogates the current size of the drawing, loads a format 'variable_mm.frm' that you've made, adjusts the size, moves and stretches the draft entities, adjusts the title block, saves it as 'variable_mm_<width>_<height>.frm' and puts that format in the drawing.
You will have multiple .frm files then, but you won't have to do much work for each one you make.