【问题标题】:What is the M2DOC Eclipse Capella command to maximize an image in a Word page?在 Word 页面中最大化图像的 M2DOC Eclipse Capella 命令是什么?
【发布时间】:2021-07-20 13:22:13
【问题描述】:

在 Word 页面中最大化图像的 M2DOC Eclipse Capella 命令是什么?

我试试这个代码:

{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}

但是给我这个错误:

{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 ([]).

但是我已经插入了所有的 Sirius 包 uri。

非常感谢!

【问题讨论】:

    标签: m2doc


    【解决方案1】:

    您正在使用 DRepresentation 调用服务 getHeight(),您应该在 MImage 上调用它:

    rep.asImage().getHeight()
    

    但是为了优化,你可以使用 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}
    

    【讨论】:

      猜你喜欢
      • 2021-09-30
      • 2020-10-29
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-14
      • 1970-01-01
      相关资源
      最近更新 更多