c# - How to continue page numbering from the highest page number in the previous section? -


in word document adding new section:

var defaultsection = mainpart.document.descendants<sectionproperties>().first(); var paragraph2 = new paragraph(); var paragraphproperties2 = new paragraphproperties();  var sectionproperties2 = defaultsection.clone() sectionproperties;  var sectiontypecur = sectionproperties2.descendants<sectiontype>().firstordefault(); sectionproperties2.removechild(sectiontypecur); var sectiontype2 = new sectiontype() { val = sectionmarkvalues.nextpage };   var pagenumbertype2 = new pagenumbertype()      {        chapterseparator = defaultpagenumbering.chapterseparator,        chapterstyle = defaultpagenumbering.chapterstyle,        format = defaultpagenumbering.format,        start = null       };    var pagenumbertypecur = sectionproperties2.descendants<pagenumbertype>().firstordefault();   sectionproperties2.removechild(pagenumbertypecur);   sectionproperties2.append(pagenumbertype2);    var titlepagecur2 = sectionproperties2.descendants<titlepage>().firstordefault();   sectionproperties2.removechild(titlepagecur2);    paragraphproperties2.append(sectionproperties2);   paragraph2.append(paragraphproperties2);   lastelementinfirstsection.insertafterself(paragraph2); 

and see in new section page numbering starts default value. want page numbering continious highest page number in previous section.
how can it?

you need use sectionmarkvalues.continuous instead of val = sectionmarkvalues.nextpage. continuous doesn't go next page, need put in plain next page break too, probably.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -