Linebreak after a page break when inserting table

Hi,

We are using aspose.words 8.1.

When i insert a pagebreak (Report.InsertBreak(BreakType.PageBreak)) a line break also seems to be inserted on the new page. When i then try to put a table at the top of the page, it is inserted on the next line down.

When trying to have the table in the same place, without the page break, then is positioned correctly.

The code I’m using is below.

Is there anything i can do to get the table to be inserted on the top line?

Thanks

Public Sub All()

    Report.InsertBreak(BreakType.PageBreak)

    Dim currentSection As Section = Report.CurrentSection
    Dim pageSetup As PageSetup = currentSection.PageSetup

    ' Calculate table width as total page width with left and right marins subtracted.
    Dim tableWidth As Double = pageSetup.PageWidth - (pageSetup.RightMargin + pageSetup.LeftMargin)

    Report.StartTable()
    Report.RowFormat.CellSpacing = 0
    Report.RowFormat.ClearCellPadding()
    Report.InsertCell()
    Report.CellFormat.Width = tableWidth
    Report.CellFormat.FitText = False
    Report.CellFormat.RightPadding = 0
    Report.CurrentParagraph.ParagraphFormat.Shading.BackgroundPatternColor = System.Drawing.ColorTranslator.FromHtml("#8DB3E2")
    Report.CurrentParagraph.ParagraphFormat.Borders.LineWidth = 0
    'Report.CurrentParagraph.ParagraphFormat.Borders.Color = System.Drawing.Color.White
    Report.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Center
    Report.ParagraphFormat.Style = Report.GetStyle("PageHeading")
    Report.StartBookmark("Guide")
    Report.AddText("Guide to Using This Report")
    Report.EndBookmark("Guide")
    Report.EndRow()
    Report.EndTable()

End Sub

Hi

Thanks for your request. Line break at the beginning of the next page is end of paragraphs, which contains PageBreak. It is very easy to resolve this issue. Just use BreakType.SectionBreakNewPage instead of BreakType.PageBreak.
Best regards.