c# 删除word文档中某一页

object objPage = 14;
                        int pages = oDoc.ComputeStatistics(Microsoft.Office.Interop.Word.WdStatistic.wdStatisticPages, ref oMissing);  
                        object objWhat = Microsoft.Office.Interop.Word.WdGoToItem.wdGoToPage;
                        object objWhich = Microsoft.Office.Interop.Word.WdGoToDirection.wdGoToAbsolute; 
                        Microsoft.Office.Interop.Word.Range range1 = oDoc.GoTo(ref objWhat, ref objWhich, ref objPage, ref oMissing);
                        Microsoft.Office.Interop.Word.Range range2 = range1.GoToNext(Microsoft.Office.Interop.Word.WdGoToItem.wdGoToPage);  
                        object bjStart = range1.Start;
                        object objEnd = range2.Start;
                        object Unit = (int)Microsoft.Office.Interop.Word.WdUnits.wdCharacter;
                        object Count = 1;
                        oDoc.Range(ref bjStart, ref  objEnd).Delete(ref  Unit, ref  Count); 

 

posted @ 2018-06-26 15:46  风影我爱罗  阅读(1764)  评论(1编辑  收藏  举报