Gunti Dilip

Gunti Dilip

  • NA
  • 54
  • 103.7k

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

Jul 29 2013 10:40 AM
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..

     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

Answers (1)