none
What is this Symbol called as in Screenshot (like anchor tag) and how to hande in Shapes in Word C# RRS feed

  • Question

  • What is this Symbol called as in Screenshot (like anchor tag) and how to hande in Shapes in Word C#

    As marked in Screenshot and how to handle in Microsoft.Office.Core.MsoShapeType

    


    R L Kiran


    • Edited by Kiran Reddi Thursday, February 14, 2019 4:07 PM
    Thursday, February 14, 2019 4:06 PM

All replies

  • It's simply the anchor symbol (and is called .Anchor in the Word object model) that shows what a shape object is anchored to. How you 'handle' it (if at all) depends on what you're trying to achieve - you can generally work with shape objects without concerning yourself with the anchor (unless, for example, you want to change what the shape is anchored to).

    Cheers
    Paul Edstein
    [MS MVP - Word]


    • Edited by macropodMVP Thursday, February 14, 2019 9:07 PM
    Thursday, February 14, 2019 9:06 PM
  •  Thanks Paul Edstein for quick reply, 

     Need to avoid /skip /delete that anchor object in the document . How to delete/skip the anchor tag in Word C#

            


    R L Kiran

    Friday, February 15, 2019 9:48 AM
  • Deleting the anchor deletes the shape object it anchors. To what end are you trying to avoid/skip it?

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, February 15, 2019 11:20 AM
  • Thanks Paul Edstein for fasten reply,

     Not an issue  if we  deleting shape object anchor in word document. It was crashing word document,when goes to this statement as below .

    int shapeCount = ActiveDoc.Shapes.Count;

    for (int i = 1; i <= shapeCount; i++)

    {

      if (ActiveDoc.Shapes[i].Type == Microsoft.Office.Core.MsoShapeType.msoEmbeddedOLEObject) => error at this level beacuse of .Anchortag in word document  and ActiveDoc.Shapes[i].Type runtime error

     {}

    }

    Error : [Quit] | Microsoft.Office.Interop.Word.frmCompare.Quit:  | The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)  |  System.Runtime.InteropServices.COMException (0x800706BA)

    Need to skip .Anchor word object in the document to process properly.

    Not as issue for deleting/skip of .Anchor object


    R L Kiran

    Friday, February 15, 2019 11:50 AM
  • The error has nothing to do with the Shape having an anchor - all shape objects have one, regardless of what type they might be. And, since your code doesn't interact with the anchor, I can't see why anyone would think the error is "beacuse of .Anchortag in word document". For example, the following works just fine with VBA:

    Sub Test()
    Dim ActiveDoc As Document
    Dim i As Long, shapeCount As Long
    Set ActiveDoc = ActiveDocument
    shapeCount = ActiveDoc.Shapes.Count
    For i = 1 To shapeCount
      If ActiveDoc.Shapes(i).Type = msoEmbeddedOLEObject Then MsgBox i
    Next
    End Sub

    I don't do C#, so you'll have to figure out what the real issue is.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, February 15, 2019 9:28 PM