如何使用c#将Word文档中形状的边框设置为无?

如何使用c#将Word文档中形状的边框设置为无?,c#,ms-word,office-interop,C#,Ms Word,Office Interop,我在Word文档中创建了一个标签,如下所示 public void CreateLabel(string LabelName, int left, int top, int width, int height, string text) { var oRange = currentDoc.Bookmarks.get_Item("\\endofdoc").Range; var oshape = oRange.Document.Shapes.AddLa

我在Word文档中创建了一个标签,如下所示

    public void CreateLabel(string LabelName, int left, int top, int width, int height, string text)
    {
        var oRange = currentDoc.Bookmarks.get_Item("\\endofdoc").Range;
        var oshape = oRange.Document.Shapes.AddLabel(MsoTextOrientation.msoTextOrientationHorizontal, left, top, width, height);

        oshape.Name = LabelName;
        oshape.TextFrame.ContainingRange.Borders.OutsideLineStyle=WdLineStyle.wdLineStyleNone;
        oshape.TextFrame.ContainingRange.Text = text;
        oshape.TextFrame.ContainingRange.Font.Size = 14;
    }
但它从不将边框设置为“无”。有什么问题吗?

设置形状线条的格式有很多好处。你可以在那里找到一些关于线条格式的内容,这就是我问题的解决方案。希望对其他人有用

  oshape.Line.Visible = MsoTriState.msoFalse;