
word
iTotalPages = oDoc.ComputeStatistics(word.WdStatistic.wdStatisticPages, ref nothing);
//Retrieve the headers and footers on each page

Total
//'If this is a different section than the one in the previous //'iteration and it has a first page header/.footer, then //'retrieve the first page header/footer for this section. //'Otherwise, retrieve the primary header/footer for this section if( (iSection oSec.Index) && (oSec.PageSetup.DifferentFirstPageHeaderFooter==1) ) { //sHeader = oSec.Headers(wdHeaderFooterFirstPage).Range.Text; oSec.Headers.Item( word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.Text = string.Empty;//可以设置为您的新内容哦 oSec.Footers.Item(word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.Text = string.Empty;//可以设置为您的新内容哦 //sFooter = oSec.Footers(wdHeaderFooterFirstPage).Range.Text; } else { //sHeader = oSec.Headers(wdHeaderFooterPrimary).Range.Text; //sFooter = oSec.Footers(wdHeaderFooterPrimary).Range.Text; oSec.Headers.Item(word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text = string.Empty;//可以设置为您的新内容哦 oSec.Footers.Item(word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text = string.Empty;//可以设置为您的新内容哦 }
iSection = oSec.Index; } }
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号