What is the M2DOC Eclipse Capella command to maximize an image in a Word page?
I try this code:
{m:for rep | lc.representationByDescriptionName('Logical Architecture Blank')}
{m:if rep.getHeight() > rep.getWidth()}
{m:rep.asImage().setHeight(600)}
{m:else}
{m:rep.asImage().setWidth(400)}
{m:endif}
But give me this error:
{m:if rep.getHeight() >= rep.getWidth()} Invalid if statement: Couldn't find the 'getHeight(org.eclipse.sirius.viewpoint.DRepresentation)' serviceInvalid if statement: Couldn't find the 'getWidth(org.eclipse.sirius.viewpoint.DRepresentation)' serviceInvalid if statement: The predicate never evaluates to a boolean type ([]).
But I have insert all the sirius package uri.
Thank you so much!
You are using the DRepresentation to call the service getHeight(), you should call it on the MImage:
rep.asImage().getHeight()
But for optimization, you can use a let:
{m:for rep | lc.representationByDescriptionName('Logical Architecture Blank')}
{m:let image = rep.asImage()}
{m:if image.getHeight() > image.getWidth()}
{m:image.setHeight(600)}
{m:else}
{m:image.setWidth(400)}
{m:endif}
{m:endlet}
{m:endfor}