none
I am not able to access/use MathZones property under [powerpoint]Shape.TextFrame2.Textrange, what can be the reason ? RRS feed

  • Question

  • I have Microsoft Office 2010 Standard (14.0.6129.5000) SP1 installed on my system. I am using Microsoft.Office.Interop.PowerPoint.dll also in my Visual Studio application. But I am not able to access MathZones property 

    All I can access is get_MathZones(start, length) method, which I am not able to use or understand.

    Plz. help.

    Thank you.

    Thursday, April 25, 2013 10:37 AM

All replies

  • Hi Rohitvk,

    Thank you for posting in the MSDN forum.

    This is a result of C#'s lack of support for properties that take parameters (like the Item property on Excel's Workbooks collection)— C# must convert the parameterized property to a method which it prefixes with get_ or set_.

    The above sentences was quoted from Eric Carter and Eric Lippert's book Visual Studio Tools for Office 2007.

    The usage of get_MathZones method is basically the same with MathZones property. If you want to omit both parameters, you can just call TextRange2.MathZones(System.Type.Missing, System.Type.Missing) or TextRange2.MathZones() after C# 4.0. If you want omit only one parameter, you can call either MathZones(start, System.Type.Missing) to omit the 2nd or MathZones(System.Type.Missing, length) to omit the 1st.

    The method will then gives you a return value of type TextRange2 .

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 26, 2013 8:45 AM
    Moderator
  • Thanks for the explanation but as i already mentioned, the Visual Studio gives error while trying to access shape.TextFrame2.TextRange.MathZones property. 

    And with get_MathZones(int,int) I cannot pass System.Type.Missing as parameter. Even if  I do so by typecasting to int, i get runtime exception.

    My purpose is to detect if the slide contains mathematical equation that is inserted using Insert > Equation tool of powerpoint. With that I am planning to export only such part of slide(i.e the equation) as image.

    so I'd appreciate if you can help me in that direction.

    Friday, April 26, 2013 10:27 AM
  • Hi Rohitvk,

    Thank you for your last reply.

    Could you please create a sample project which reproduces your scenario? You can then upload it to SkyDrive make it accessible and share to us.

    I look forward to your reply.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 29, 2013 6:43 AM
    Moderator