locked
Update DocProperties with OpenXML SDK 2.0 RRS feed

  • Question

  • Hi,

    I'm developing a program to update MS Word Docproperties using the OpenXML SDK 2.0 library (MS Word 2007).
    The problem is that I have detected that MS Word change the internal xml estructure of the docProperties when users do some manual actions in Word like update the template or activate the field protection option.

    I'm going to provide several examples in order to you know what I mean:

    CASE 1: Original docProperty structure

    <w:tc>
       <w:tcPr>
          ...
       </w:tcPr>
       <w:p w:rsidR="006624CA" w:rsidRPr="00F45A26" w:rsidRDefault="009075BE" w:rsidP="006624CA">
          <w:pPr>
             ...
          </w:pPr>
          <w:fldSimple w:instr="DOCPROPERTY ref_date_f \* MERGEFORMAT">
             <w:r w:rsidR="004C0439" w:rsidRPr="004C0439">
                <w:rPr>
                   <w:lang w:val="en-GB" /> 
                </w:rPr>
                <w:t>ref_date_f</w:t> 
             </w:r>
         </w:fldSimple>
       </w:p>
    </w:tc>

    CASE 2:

    <w:tc>
       <w:tcPr>
          ...
       </w:tcPr>
       <w:p w:rsidR="006624CA" w:rsidRPr="00F45A26" w:rsidRDefault="007111C5" w:rsidP="006624CA">
          <w:pPr>
             ...
          </w:pPr>
          <w:r>
             <w:fldChar w:fldCharType="begin" /> 
          </w:r>
          <w:r>
             <w:instrText xml:space="preserve">DOCPROPERTY ref_date_f \* MERGEFORMAT</w:instrText> 
          </w:r>
          <w:r>
             <w:fldChar w:fldCharType="separate" /> 
          </w:r>
          <w:proofErr w:type="spellStart" /> 
          <w:r w:rsidR="004C0439" w:rsidRPr="004C0439">
             <w:rPr>
                <w:lang w:val="en-GB" /> 
             </w:rPr>
             <w:t>ref_date_f</w:t> 
          </w:r>
          <w:proofErr w:type="spellEnd" /> 
          <w:r>
             <w:fldChar w:fldCharType="end" /> 
          </w:r>
       </w:p>
    </w:tc>

    CASE 3:

    <w:instrText xml:space="preserve">DOCPROPERTY ref_date_f \* MERGEFORMAT</w:instrText>

    CASE 4: etc...

    How do you control all these MS Word changes to update the docProperties values using OpenXML? There is any MS Word option to avoid these dinamic changes?

    I will be very grateful if you can help me.

    Best regards and thank you in advance!


    • Edited by Lain1010 Wednesday, June 13, 2012 9:29 AM
    Wednesday, June 13, 2012 9:25 AM

All replies

  • Hi,

    Would you please share a sample document that illurstrating the problem?  Skydrive is ideal place to share.

    thanks.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Friday, June 15, 2012 7:51 AM
  • Hi,

    Do you still need assistance on this question? Or I'll close this thread.

    thanks.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Monday, July 9, 2012 3:09 AM