我正在尝试用SharePoint格式化BDC (业务数据目录)定义中的一个字段,并使用一千个分隔符。
这在BDC定义中似乎是不可能的,只有通过SharePoint设计器(!)才能实现。我目前得到的字段是System.Decimal,所以它显示为12345.98,但我希望它显示为12,345.98。
你知道它是否可以通过BDC XML定义来实现吗?
<Parameter Direction="Return" Name="@ContactTotals">
<TypeDescriptor TypeName="System.Data.IDataReader, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" IsCollection="true" Name="Reader">
<TypeDescriptors>
<TypeDescriptor TypeName="System.Data.IDataRecord, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Record">
<TypeDescriptors>
<TypeDescriptor TypeName="System.Int32" IdentifierName="dim_claims_key" Name="dim_claims_key" />
<TypeDescriptor TypeName="System.Decimal" Name="total_outstanding" DefaultDisplayName="Total Outstanding (USD)" />
<TypeDescriptor TypeName="System.Decimal" Name="total_paid" DefaultDisplayName="Total Paid (USD)" />
<TypeDescriptor TypeName="System.Decimal" Name="total_incurred" DefaultDisplayName="Total Incurred (USD)" />
</TypeDescriptors>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</Parameter>
</Parameters>干杯
尼克
发布于 2009-12-05 00:34:20
XML是一种元语言,不打算格式化或表示信息,它描述和存储其他词汇表。考虑到这一点,答案是:不,您不能仅使用XML来实现您所要求的。
推荐的方法是在您正在使用的BDC列表视图或BDC Item View way部件中使用XSLT 元素。如果您通过其他方式使用数据,则可以在渲染期间轻松地格式化输出。
假设你有一段代码显示了你的decimal类型:
<xsl:value-of select="$ColName_0" />您需要将其封装为(基于链接中的示例):
<xsl:value-of select="format-number($ColName_0, '#.###,00', 'euro')"/>您可以在Modify Shared webpart菜单中找到menu部件的XSLT,或者,正如您所说的那样,使用SharePoint Designer。
发布于 2009-12-06 07:03:54
用于在TypeDescriptor元素上定义Complex Formatting的Seems possible。由于我没有合适的环境来测试这个解决方案,下面的定义似乎是有效的,并解决了您的特定场景:
<Parameter Direction="Return" Name="@ContactTotals">
<TypeDescriptor TypeName="System.Data.IDataReader, ..."
IsCollection="true" Name="Reader">
<!-- note this -->
<Properties>
<Property Name="ComplexFormatting"
Type="System.String" />
</Properties>
<TypeDescriptors>
<TypeDescriptor TypeName="System.Data.IDataRecord, ..." Name="Record">
<TypeDescriptors>
<TypeDescriptor TypeName="System.Int32"
IdentifierName="dim_claims_key"
Name="dim_claims_key" />
<TypeDescriptor TypeName="System.Decimal"
Name="total_outstanding"
DefaultDisplayName="Total Outstanding (USD)" />
<!-- note this -->
<Properties>
<Property Name="FormatString"
Type="System.String">{0:#.###,00}</Property>
</Properties>
</TypeDescriptor>
...
</TypeDescriptors>
</TypeDescriptor>
</TypeDescriptors>
</TypeDescriptor>
</Parameter>
</Parameters>注意,正如MSDN文档中所警告的,"ComplexFormatting is slow"。也许坚持使用F.Aquino answer会更好
https://stackoverflow.com/questions/1804510
复制相似问题