Free Support Forum -

Inserting a pagebreak at end of section with tables

How can I insert a pagebreak at the end of a section containing a table?

The following code works if there are no tables in the section, but with tables, content is appended on the same page and no pages are added to the document.

curSection = _builder.CurrentParagraph.ParentSection

sectionTemplate = curSection.Clone(True)

lastParaIndex = curSection.Body.Paragraphs.Count - 1

builder.MoveToParagraph(lastParaIndex, -1) '// is this right way to move to EOSection?

'//builder.Write("XXX") '//inserts in 1st cell of table vs. section end- even if more paras after table



Maybe the question I need answered is:

How can I accomplish: DocBuilder.MovetoSection(SectionEnd)?


Charu Tevari

OK, I can see one roundabout way of adding a pagebreak between two copies of the original section content [my table templates], but is there a better way? It would be nice to be able to do something like: builder.MoveToSection(sectionNo, SectionPositionEnum.EndOfSection); builder.InserBreak(..)

currentSection = _builder.CurrentParagraph.ParentSection

sectionTemplate = currentSection.Clone(True)


builder.MoveToSection(doc.Sections.Count - 1)




-Charu Tevari

do builder.MoveToSection(sectionIdx)

followed by builder.MoveToParagraph(-1, -1);

MoveToParagraph works within the currently selected section and -1 indicates first paragraph from the end.