none
PhoneticGuide read access RRS feed

  • Question

  • (using Word 2010)

    Hi!

    I'm trying to write an add-in that uses PhoneticGuide to assign the phonetic guide to Ranges. I could so far only find writing access, but no read access. Is there any read access pendant to the PhoneticGuide method in VSTO?

    I'd prefer to use another API than VSTO. Is there any for manipulating Word Documents inside of Word? I'd like that esp. since I want to control undo/redo functionality to make my addin document transformation atomic. If so, please give me a hint.

    TIA

    Bernd

     

    Wednesday, September 28, 2011 12:37 PM

Answers

  • Hi Bernd

    The PhoneticGuide method (new one for me - I'd never heard of it before) appears to insert an EQ field code. Press Alt+F9 to toggle on the field codes and you should see it. So if you want to "read" this, you can access the Range.Fields(1).Code and parse the field code to get the information.

    PhoneticGuide is a member of the Word object model (Range.PhoneticGuide) and is not extended in any way by VSTO. So there's no need to use VSTO - you can just as easily use VBA or any language that can automate Word.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Liliane Teng Thursday, October 6, 2011 7:46 AM
    Wednesday, September 28, 2011 1:34 PM
    Moderator
  • Hi Bernd

    I'm not sure I understand your second question. But the only alternative you have to automating Word is to use the Open XML syntax. If you're asking whether it's possible to insert that into a document opened in the UI, the answer is yes: Range.InsertXML

    The XML you insert must be valid WordOpenXML in the flat file format (what you'd get if you use Range.WordOpenXML).


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Liliane Teng Thursday, October 6, 2011 7:46 AM
    Sunday, October 2, 2011 7:00 AM
    Moderator

All replies

  • Hi Bernd

    The PhoneticGuide method (new one for me - I'd never heard of it before) appears to insert an EQ field code. Press Alt+F9 to toggle on the field codes and you should see it. So if you want to "read" this, you can access the Range.Fields(1).Code and parse the field code to get the information.

    PhoneticGuide is a member of the Word object model (Range.PhoneticGuide) and is not extended in any way by VSTO. So there's no need to use VSTO - you can just as easily use VBA or any language that can automate Word.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Liliane Teng Thursday, October 6, 2011 7:46 AM
    Wednesday, September 28, 2011 1:34 PM
    Moderator
  • Hi Cindy,

    got it, thanks for your help. To be honest, I solved this special problem, but I must say I'm very disappointed with the API. I mean, in OpenXML you have a special tag for that, which is w:ruby, but Word just translated that to a field code, which then has it's limitations on what you write as annotation and what formatting you can assign to it. Really weird. Thus the second part of my question is still open: Is there an alternative to the API Microsoft.Office.Interop.Word which just seems to have so many side effects and strange behaviours? Any?

     


    Whereever you go, there you are.
    Saturday, October 1, 2011 9:18 PM
  • Hi Bernd

    I'm not sure I understand your second question. But the only alternative you have to automating Word is to use the Open XML syntax. If you're asking whether it's possible to insert that into a document opened in the UI, the answer is yes: Range.InsertXML

    The XML you insert must be valid WordOpenXML in the flat file format (what you'd get if you use Range.WordOpenXML).


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Liliane Teng Thursday, October 6, 2011 7:46 AM
    Sunday, October 2, 2011 7:00 AM
    Moderator