【问题标题】:How do you format a Word document content control bound to a Custom Xml Part如何格式化绑定到自定义 Xml 部件的 Word 文档内容控件
【发布时间】:2021-06-24 16:58:46
【问题描述】:

我们有一个 Word 文档,其中包含一个绑定到自定义 Xml 部件的表格。其中一个字段是绑定到文本内容控件的日期。格式为 MMM dd, yyyy。如何将日期格式更改为其他格式(例如 MM/dd/yyyy)?

有问题的报告列定义如下:

column(DateName, Format("Date Name", 0, 4)
{
}

令人沮丧的是,格式返回完整的月份名称,这意味着长月份名称可能有很多不必要的包装。

这是我迄今为止尝试过的:

1. Created a Report extension and added 2 additional columns
   a. Formatted column used with Text Content Control
      works as expected
   b. Date column used with Date Picker Content Control
      Report does NOT honor formatting properties set in Content Control
      Always displays with the time component

add(DatasetName)
{
    column(DateName_Formatted; Format("Date Name", 0, '<Month,2>/<Day,2>/<Year4>') 
    { 
    }
    column(DateName_Date; "Date name") 
    { 
    }
}

这对我来说似乎很荒谬,但似乎我们必须编写一个报告扩展来显示一个格式化的日期。

也许这在未来的版本中会变得更好。毕竟,不久前您还必须创建一个全新的报表才能将另一列添加到数据集中。

【问题讨论】:

    标签: report saas dynamics-business-central word-contentcontrol


    【解决方案1】:

    日期格式化为文本的原因是报告可能以任何语言运行。在布局中格式化日期可能会导致接收者的语言与其预期的日期格式不匹配。

    在输出之前格式化日期可以解决这个问题,因为日期将根据报表当前使用的语言进行格式化(在报表执行期间可能会更改)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-24
      相关资源
      最近更新 更多