none
SdtBlock.SdtProperties.Alias.Val.Value does not compile RRS feed

  • Question

  • I have followed Brian Jone's excellent post on Open XML document merging and Content Control updates - however it seems that the command:

    List<SdtBlock> sdtList = mainPart.Document.Descendants<SdtBlock>().Where( 
                         s => sourceFile.Contains(s.SdtProperties.Alias.Val.Value)).ToList(); 

    ... does not compile because the "SdtProperties" type does not contain the 'Alias' property. Here's the actual error:

    'DocumentFormat.OpenXml.Wordprocessing.SdtProperties' does not contain a definition for 'Alias' and no extension method 'Alias' accepting a first argument of type 'DocumentFormat.OpenXml.Wordprocessing.SdtProperties' could be found (are you missing a using directive or an assembly reference?)


    I am using the Septemeber 2008 CTP Preview of the Open XML SDK v2, which I believe is the latest. Any ideas if there's a later version or why this might not be working?

    Thanks.



    Wednesday, December 31, 2008 1:57 AM

Answers

  • According to the Reflector Tool it´s now SdtAlias.

    Replace and give a go, it worked for me.

    Cheers,

    Leandro

    • Proposed as answer by AminB Monday, June 28, 2010 3:04 PM
    • Marked as answer by Bruce Song Wednesday, December 29, 2010 3:02 AM
    Tuesday, June 1, 2010 5:51 PM
  • I use s.SdtProperties.GetFirstChild<Alias>().Val.Value
    • Marked as answer by Peter_D503 Tuesday, January 6, 2009 10:45 PM
    Tuesday, January 6, 2009 10:42 PM

All replies

  • I use s.SdtProperties.GetFirstChild<Alias>().Val.Value
    • Marked as answer by Peter_D503 Tuesday, January 6, 2009 10:45 PM
    Tuesday, January 6, 2009 10:42 PM
  • Yes thanks vj9999 - Zeyad Rajabi kindly got back to me via Brian Jones - it seems they had an older copy of the DLL cached. 
    Tuesday, January 6, 2009 10:49 PM
  • Hi kuke,

    I also met the same issue when I followed this post. Do you fixed this issue? If you fixed this issue, could you please give me some details  how to fixed this issue?

     

    Thanks,

    Hubert

    Tuesday, June 1, 2010 1:45 AM
  • Hi Hubert, try vj9999 solution above.
    Tuesday, June 1, 2010 1:51 AM
  • Hi Kuke,

    Yes, I tried it. but it also failed, please see the below:

     

     

    List<SdtBlock> sdtList = mainPart.Document.Descendants<SdtBlock>().Where(

    s => sourceFile.Contains(s.SdtProperties.GetFirstChild<Alias>().Val.Value)).ToList();

    but the "Alias" is also not found. Could you give me your MSN message address or eamil? I think that it is easy to communication.

     

    Thanks,

    Hubert

    Tuesday, June 1, 2010 2:31 AM
  • Sorry mate - don't know how to help you further. Might have to create a new forum post.
    Tuesday, June 1, 2010 3:15 AM
  • According to the Reflector Tool it´s now SdtAlias.

    Replace and give a go, it worked for me.

    Cheers,

    Leandro

    • Proposed as answer by AminB Monday, June 28, 2010 3:04 PM
    • Marked as answer by Bruce Song Wednesday, December 29, 2010 3:02 AM
    Tuesday, June 1, 2010 5:51 PM
  • thanks Leandro. it worked for me
    Friday, February 24, 2012 3:40 PM