XPP 9.2.2 on Windows Server 2012
We have a model in the first column of a table. Some models are too long and crash with the text in the next table column. We cannot change table column widths as they must be the same through the whole book. How do I automatically find the length of the model to squeeze the text using <sw> if the model is too long?
We did this with prices by looking at the value of the number. But I haven't found a way to do this with strings yet. Does anyone have any ideas?
I looked in the macro book but did not see a macro for len() or length() or strlen().
My basic idea was to store the model in a macro like this: <model;HS1234kdkdkdkdkdk>
The <model> macro definition would be something like this: <mc;len($1)]10;sw(&-.5q);nul> <mc; len($1)]15;sw(&-1q);nul>$1
You can use <px>$1<pa>. This sets a system variable %pxwidth.
Then you can test length </mc;%pxwidth]10p;...
You might also generalize this macro by using other sys.vars like %avlnmeas
Wow, thanks! So that %pxwidth takes into account the font size too to give a width in picas or points right? Not characters? That would work even better.
Is there a macro to set the font width to fix the available table cell width? Table cell width for that column should not change at all in the whole job.
Yes, it does. :D All your Christmas' at once!