Skip to content

How to delete a particular page in word doc using c# ?

Gunti Dilip

Asked Jul 29, 2013, 6:40 AM EDT1 answer
Share
LinkedInX
Hi,

Could you please help me out to delete a particular page in word document using C#?
I tried it but it is deleting only even number's.
Suggest me if it is right way or not..

Code
     int[] a = {14,16};
     for (int i = 0; i <= a.Length; i++)
     {
        	object pageno= a[i];
                objWordDoc.Application.Selection.GoTo(Word.WdGoToItem.wdGoToPage, Word.WdGoToDirection.wdGoToAbsolute, null, pageno);
                objWordDoc.Application.Selection.Bookmarks[@"\Page"].Select();
                objWordDoc.Application.Selection.Delete();
     }

Thanks,
Dilip

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 1 short reply
    • 0
      Are you getting any error ?
      0