views:

627

answers:

1

Hi all,

I wanted to perform specific table formatting by removing left, right, inside horizontal and inside vertical borders. I have recorded a macro for this and got the following VBA code. I tried to make the same using C# , but I could not find there properties like wdBorderLeft , wdBorderRight, wdBorderHorizontal or wdBorderVertical. Does anyone know how to perform the same method using C#. I would appreciate any help. Thanks, Sarah

Sub Macro6()
   Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
   Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
   Selection.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
   Selection.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
End Sub`    
+2  A: 

I think the answer may be on this page: http://msdn.microsoft.com/en-us/library/aa942955%28VS.80%29.aspx.

Add: using Word = Microsoft.Office.Interop.Word;

Then use: newTable.Borders(Word.WdBorderType.wdBorderLeft)

etc.

Andy Jacobs
This worked very good, thanks alot.
Sarah