Giter Site home page Giter Site logo

Comments (5)

jacwright avatar jacwright commented on May 9, 2024 1

@dolanmiu you are correct that <w:br w:type="page"/> is the right way to create a paragraph break. However, docx currently puts that inside <w:pPr> which breaks it.

What it looks like now:

<w:p>
  <w:pPr>
    <w:r>
      <w:rPr />
      <w:br w:type="page" />
   </w:r>
  </w:pPr>
</w:p>

What it should look like:

<w:p>
    <w:r>
      <w:br w:type="page" />
   </w:r>
</w:p>

Update: at least, this is the difference between my docx generated file where the page break is unrecognized, and Word-created docx file where the page break is recognized. I can't seem to find anything else, and when I removed the <w:pPr> from my docx generated file by hand, the page break shows up in Word Online and Pages where I have been testing. This isn't the most scientific approach, apologies, but hopefully it helps.

from docx.

dolanmiu avatar dolanmiu commented on May 9, 2024

https://web.archive.org/web/20160820235211/http://officeopenxml.com/WPtextSpecialContent-break.php

I followed this documentation when implementing it

you can see that it has <w:br> with various options for type, including page

I'm using waybackmachine cos the original website is down (hence im porting it) 😂

from docx.

dolanmiu avatar dolanmiu commented on May 9, 2024

I have ported the page over:

https://github.com/dolanmiu/Office-Open-XML-Reference/wiki/Paragraph-Line-Break

from docx.

dolanmiu avatar dolanmiu commented on May 9, 2024

I think you was thinking of the below. Paragraph and Run both have breaks! but they do different things.

https://github.com/dolanmiu/docx/wiki/Text#break

from docx.

jacwright avatar jacwright commented on May 9, 2024

This has been fixed in #41. We should be able to close this issue.

from docx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.