You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Pardha Paruchuri <pa...@yahoo.com> on 2007/04/02 19:56:25 UTC
word page break
Hi All,
I am using FOP 0.20.5 to convert a WordML document into PDF. As there are 2 types of pagebreaks in word, one the hard/soft page break(from menu insert->page break) and two the pagebreakbefore property on a paragraph(highlight a paragraph and right click to see properties), I see that it is able to convert a pagebreakbefore but not the hard page break. I am just using a stylesheet that microsoft recommends to convert WordML into XML-FO and I could not figure out where we can make a change in the stylesheet to fix this issue. As I am new to XSL and understand that this may not be a FOP problem but could someone give me a clue as to why it is not able to convert a hard page break.
Thanks,
Pardha
---------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
Re: word page break
Posted by Pardha Paruchuri <pa...@yahoo.com>.
Hi Jay,
Thanks for your help. I have tried to add my code to the existing template as shown below but that was giving NPE error during transformation.
<xsl:template match="w:br">
<!-- defines a page, column, or text-wrapping break -->
<xsl:choose>
<xsl:when test="@w:type='page'"/>
<!--xsl:attribute name="break-before">page</xsl:attribute-- my code>
<!--fo:block break-before="page"/-- my code>
<xsl:when test="@w:type='column'"/>
<!-- if @w:type="text-wrapping" or omitted - it's a new-line break -->
<xsl:otherwise>
<fo:block/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
So I added a new template just before the existing one and that worked. Here is the new one
<xsl:template match="w:br[@w:type='page']">
<!-- defines a page, column, or text-wrapping break -->
<fo:block break-before="page"/>
</xsl:template>
Thank you,
Pardha
Jay Bryant <ja...@bryantcs.com> wrote:
Hi, Pardha,
I've done lots of work with WordML, so I can get you started on this one.
Insert -> Page Break produces the following element in Word's XML output (in the paragraph's text run):
<w:br w:type="page"/>
When you do it from the paragraph properties, you get the following element (in the pPr element for the paragraph):
<w:pageBreakBefore/>
So, to catch them both, you need corresponding templates, thus:
<xsl:template match="w:pageBreakBefore">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
<xsl:template match="w:br[@w:type='page']">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
If you do the same thing with the two kinds of breaks, you can process them in the same template, thus:
<xsl:template match="w:pageBreakBefore|w:br[@w:type='page']">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
HTH
Jay Bryant
Bryant Communication Services
----- Original Message -----
From: Pardha Paruchuri
To: fop-users@xmlgraphics.apache.org
Sent: Monday, April 02, 2007 12:56 PM
Subject: word page break
Hi All,
I am using FOP 0.20.5 to convert a WordML document into PDF. As there are 2 types of pagebreaks in word, one the hard/soft page break(from menu insert->page break) and two the pagebreakbefore property on a paragraph(highlight a paragraph and right click to see properties), I see that it is able to convert a pagebreakbefore but not the hard page break. I am just using a stylesheet that microsoft recommends to convert WordML into XML-FO and I could not figure out where we can make a change in the stylesheet to fix this issue. As I am new to XSL and understand that this may not be a FOP problem but could someone give me a clue as to why it is not able to convert a hard page break.
Thanks,
Pardha
---------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
Re: word page break
Posted by Jay Bryant <ja...@bryantcs.com>.
Hi, Pardha,
I've done lots of work with WordML, so I can get you started on this one.
Insert -> Page Break produces the following element in Word's XML output (in the paragraph's text run):
<w:br w:type="page"/>
When you do it from the paragraph properties, you get the following element (in the pPr element for the paragraph):
<w:pageBreakBefore/>
So, to catch them both, you need corresponding templates, thus:
<xsl:template match="w:pageBreakBefore">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
<xsl:template match="w:br[@w:type='page']">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
If you do the same thing with the two kinds of breaks, you can process them in the same template, thus:
<xsl:template match="w:pageBreakBefore|w:br[@w:type='page']">
<!-- Do whatever you do with page breaks here -->
</xsl:template>
HTH
Jay Bryant
Bryant Communication Services
----- Original Message -----
From: Pardha Paruchuri
To: fop-users@xmlgraphics.apache.org
Sent: Monday, April 02, 2007 12:56 PM
Subject: word page break
Hi All,
I am using FOP 0.20.5 to convert a WordML document into PDF. As there are 2 types of pagebreaks in word, one the hard/soft page break(from menu insert->page break) and two the pagebreakbefore property on a paragraph(highlight a paragraph and right click to see properties), I see that it is able to convert a pagebreakbefore but not the hard page break. I am just using a stylesheet that microsoft recommends to convert WordML into XML-FO and I could not figure out where we can make a change in the stylesheet to fix this issue. As I am new to XSL and understand that this may not be a FOP problem but could someone give me a clue as to why it is not able to convert a hard page break.
Thanks,
Pardha
------------------------------------------------------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.