This repository has been archived by the owner. It is now read-only.

Process page breaks #246

wants to merge 2 commits into
base: vNext


None yet
3 participants
Copy link

NicoJuicy commented Sep 6, 2018

Page breaks are shown like

<p:r><docx properties like font, .../><w:br type="page"/></p:r>

When converting this to HTML, this is replaced by in the function:

 // Transform w:br to h:br.
 if (element.Name == || element.Name ==
       return ProcessBreak(element);

Which causes the page break to not appear.

I have changed this so it returns a div style="page-break-before:always;" in the following function.

private static object ProcessPageBreak(XElement element)
        XElement div = new XElement(Xhtml.div);
        div.SetAttributeValue(, "page-break-before:always;");
        XElement span = null;

        return new object[]
            new XEntity("#x200e"),

Which causes a correct page break.

PS. The page break (docx) is detected in a child element. So i have to set the page break ( html) in it's parent. I detect it with the following function:

 private static bool HasAPageBreak(XElement element)
        return element.Descendants().Any(dl => dl.Name == && dl.Attribute(W.type).Value == "page");
Nico Sap Nico Sap

This comment has been minimized.

Copy link

msftclas commented Sep 6, 2018

CLA assistant check
All CLA requirements met.

Fix after testing
Some tests seem to fail ( null reference) - fixed now

This comment has been minimized.

Copy link

NicoJuicy commented Sep 7, 2018

I added an issue here: #248


This comment has been minimized.

Copy link

tomjebo commented Feb 2, 2019

Closing all PRs as this repo is being archived and will no longer be maintained by Microsoft. The project is licensed for continued use and development by forking to your own repo.

@tomjebo tomjebo closed this Feb 2, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.