Sharepoint 2010中快速部件的数字格式 [英] Numeric formatting for Quick Parts from Sharepoint 2010

查看:97
本文介绍了Sharepoint 2010中快速部件的数字格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Word 2010和Sharepoint 2010彼此之间并没有很好地互动(有点)......

Word 2010 and Sharepoint 2010 are not playing nicely with each other (sort of)...

以下是这种情况: 我有一个Word模板文档,其中包含与文档库中的数字Sharepoint字段对应的一些快速部件。  Sharepoint字段的格式设置为使用逗号显示数千个,例如百万群组。 Word中的
与文档信息面板显示我可以在数字字段中键入一个值,它在DIP中正确显示。 但Word文档中相应的快速部分只显示为1000000,即没有正确的逗号分隔。 
当我查看快速部件的属性(突出显示快速部件,单击开发人员选项卡并单击属性)时,Word似乎将内容控件视为文本(它正在应用"默认段落样式"和所有替代的
样式都是用于文本)。 

Here's the situation:  I have a Word template document that contains some Quick Parts corresponding to numeric Sharepoint fields in a document library.  The Sharepoint fields are formatted to show thousands with a comma, e.g. 1,000,000.  While in Word with the Document Information Panel showing I can type a value into a numeric field and it appears correctly in the DIP.  But the corresponding Quick Part within the Word document just appears as 1000000, i.e. without the correct comma separation.  When I look at the properties of the Quick Part (highlight the Quick Part, click the Developer tab and click Properties), Word appears to be treating the Content Control as Text (it's applying the "Default Paragraph Style" and all the alternative styles are for text). 

我想知道我是否可以对基础XML做些什么来解决这个问题。 以下是我遇到此问题的快速部件之一的XML(我认为):

I'm wondering if I can do something to the underlying XML to fix this.  Here is the XML for one of the Quick Parts for which I'm having this problem (I think):

我测试了将我需要的格式放入"PageNum"中。我在另一个文档的Header中插入的字段,发现包含格式代码的XML部分,\#$#,## 0.00:

I tested putting the formatting that I need into a "PageNum" field that I inserted in the Header of another document and found this section of XML that contained the formatting code,\# $#,##0.00 :

有没有办法更改快速部件的类型,以便Word将其识别为一个数字或添加某种XML来进行我需要的格式化? 还是我完全走错了路? 

Is there a way to either change the type of the Quick Part so Word recognizes it as a numeric or add some sort of XML to do the formatting I need?  Or am I totally going down the wrong path? 

再次提前感谢您提供给我的任何帮助。  Carol。

Thanks in advance again for any help you can give me.  Carol.

推荐答案

嗨Carol

Hi Carol

我认为无论如何应用数字格式内容控件,与您对字段的操作方式相同。

I don't think there's anyway to apply numeric formatting to a content control, the same way you can do to a field.

严格地说,从Word API的角度来看,这是本论坛的主题,您可以在文档中的VBA项目中使用EVENT来跟踪ContentControlBeforeStoreUpdate event将逗号插入到文本中。

Speaking strictly from the Word APIs point of view, which is the main topic of this forum, you could use an EVENT in a VBA project in the document to track the ContentControlBeforeStoreUpdate event insert the commas into the text.

XML可以定义数字字段的数字格式(看起来就像你在DIP端所拥有的那样),但是当一个数字字段时,它会应用于存储的文本。 XML解析器显示XML。在绑定到元素的内容控件
中显示CustomXMLPart内容时Word不使用此功能。

XML can define number formatting for numeric fields (which appears to be what you have at the DIP end), but that's applied to the stored text when an XML parser displays the XML. Word doesn't use this when displaying CustomXMLPart content in a content control bound to an element.


这篇关于Sharepoint 2010中快速部件的数字格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆