locked
Word 2007: Applying decimal point format to numeric Quick Parts RRS feed

  • Question

  • Here's my scenario.

    I have one document library with a series of columns. One of these is a number field. It has the decimal point set to 1, with a view of showing numbers in the "x.x" format. As far as SharePoint is concerned, this works.

    I've used a Quick Part in Word (docx format) to capture this field but here is where my problem starts. The captured number is coming through as a single digit, without the decimal "x" format.

    The Quick Part options within Word seem fairly limited, but this may be down to my limited understanding of how they work.  Can anyone here advise on the possibility of setting a decimal point format on a Quick Part?

    Note for the moderating team: As my points total will show, I'm very active within the TechNet, the bulk of my time is spent within the SharePoint forums, so I'd respectfully ask for this post to stay within the Word forums.

    Many thanks, Steven


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/

    Monday, June 17, 2013 3:19 PM

All replies

  • This problem is caused by the fact that Sharepoint stores the value as "1" (or at least, delivers it via the XML in Word as "1") whether you enter it as 1 or 1.0. Sharepoint also delivers the bit of schema that says it should be displayed as 1d.p. Sharepont itself obviously honours that bit of schema (where ma:decimals is set to "1"), and so does InfoPath when it maintains the display in the Document Information Panel. But Word just displays whatever is in the XML. There is some more about this here:

    http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/e3c64d0b-fc97-47d4-97ec-c611984c6507

    and here

    http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/de2272f1-0c03-43a4-8bc9-78917cc5992d

    You can also consider modifying the value in the XML (so that Word will display it correctly) using the XML store update event, but that willl require code somewhere. It's also possible to get SharePoint to modify the value on its way out of SharePoint and/or on its way back in (I haven't looked at that in depth, but it may be an area you are familiar with.Iit may be possible to modify it using InfoPath - also never pursued that and it depends on whether you are in a position to use a custom DIP.


    Peter Jamieson

    • Marked as answer by Max Meng Friday, June 21, 2013 8:11 AM
    • Unmarked as answer by Steven Andrews Friday, June 21, 2013 9:54 AM
    Tuesday, June 18, 2013 3:03 PM
  • Hi Peter,

    Appreciate the links.  I'll check these out and will post further questions / solutions as I get them.

    Many thanks,
    Steven


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/

    Tuesday, June 18, 2013 4:49 PM
  • Hi Peter,

    A follow-up question.

    Can you advise where the XML that sets these values resides and how I'd be able to take a look at it?  I'm assuming it either sits within the Hive/14 files or within the Word Installation directory?


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/

    Thursday, June 20, 2013 10:16 AM
  • I have no idea where SharePoint itself stores the XML (or whatever it stores) that defines the columns in a library (presumably in its SQL Server database somewhere).

    But when you open your .docx from SharePoint, SharePoint creates/populates a number of Custom XML Parts, which are all stored in the Word document. One of these parts contains the data from your SharePoint library columns, and another contains a number of schemas. The schemas are dynamically generated from the information about the columns in the SharePoint library.

    So if you take a sample document, and look at its Open XML, you should be able to find this stuff. To do that with a document called mydoc.docx, you can

     a. rename the document to mydoc.docx.zip

     b. open the zip file

     c. open the "customXml" folder within that

     d. open each of the files named "itemn.xml" (e.g. "item4.xml"). Unless you have masses of data or custom XML parts are being used for other purposes in your documents, typically the largest of those will contain the schemas, and the last of them will contain the SharePoint data. 

    If you don't have one, getting hold of an XML editor such as Microsoft's freebie XML Notepad (it's a download somewhere) will probably help a lot.

    In the schema XML document, there are in fact a number of schemas. You will probably find the stuff you need in the first one, whose targetNamespace is http://schemas.microsoft.com/office/2006/metadata/properties. Within that, look for the xsd:element element whose name is "properties".


    Peter Jamieson

    • Marked as answer by Max Meng Friday, June 21, 2013 8:11 AM
    • Unmarked as answer by Steven Andrews Friday, June 21, 2013 9:54 AM
    Thursday, June 20, 2013 10:33 AM
  • Just a note to the mods, I've unmarked the answers that were marked up I'm still looking into this.  Peter will get his points when I mark the posts up.

    Thanks,
    Steven


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/

    Friday, June 21, 2013 9:55 AM
  • OK by me, Steven. Interested in finding solutions/workarounds, not points!


    Peter Jamieson

    Friday, June 21, 2013 12:22 PM