1
Answer

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

Gunti Dilip

Gunti Dilip

11y
1.6k
1
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)