How to change the Section SectionBreakType options of the document

Jun 29, 2015 at 6:23 AM

I use the DocX ver1.0.0.15 on C #.

Accessing the "Sections" of the loaded document,
'System.NullReferenceException' occurs.
"Object reference not set to an instance of an object."
DocX docx = DocX.Load(docPath);
List<Section> sections = docx.Sections;
As follows, it can be get a List<Section> Objects document GetSections().
List<Section> sections = docx.GetSections();
Despite Section is present in the document, it is impossible to access the Sections.
Therefore, it is not possible to change the option values that belong to the Section.
'System.NullReferenceException' occurs when you run the following code.
List<Section> sections = docx.Sections;
sections[0].SectionBreakType = SectionBreakType.evenPage;
As a result, the operation can not be realized, such as counting the number of pages in the middle of the page.

Please tell me how to change the SectionBreakType.