Page 1 of 1

lastRenderedPageBreak issue

PostPosted: Tue Jun 23, 2009 3:30 pm
by dqkit
hi, how can I detect the "lastRenderedPageBreak" ?
confused...
I used p.getParagraphContent(), but I seems no work. What I can get is R.
help!
Code: Select all
<w:p w:rsidR="00275B74" w:rsidRDefault="00275B74" w:rsidP="00275B74">
      <w:pPr>
        <w:ind w:firstLine="420"/>
      </w:pPr>
      <w:r>
        <w:rPr>
          <w:rFonts w:hint="eastAsia"/>
        </w:rPr>
        <w:lastRenderedPageBreak/>
        <w:t xml:space="preserve"> </w:t>
      </w:r>
      <w:r>
        <w:rPr>
          <w:rFonts w:hint="eastAsia"/>
        </w:rPr>
        <w:t>private static Calculator calculator = new Calculator();</w:t>
      </w:r>
    </w:p>

Re: lastRenderedPageBreak issue

PostPosted: Tue Jun 23, 2009 3:42 pm
by jason
have a look for it inside your R with getRunContent(). If you look closely at the XML you posted, you'll see its inside a w:r.

Re: lastRenderedPageBreak issue

PostPosted: Tue Jun 23, 2009 3:56 pm
by dqkit
How fast you replyed to me! Thought get the answer tommorow, it seemjust several seconds! :lol:
got it from following code in org.docx4j.convert.out.pdf.viaIText.Conversion.getRunContent();
Code: Select all
List<Object> runContent = run.getRunContent();
171 
172                                 for (Object rc : runContent) {
173 
174                                         if (rc instanceof javax.xml.bind.JAXBElement) {
175 
176                                                 log.debug("Encountered "
177                                                                 + ((JAXBElement) rc).getDeclaredType()
178                                                                                 .getName());
179 
180                                                 if (((JAXBElement) rc).getDeclaredType().getName()
181                                                                 .equals("org.docx4j.wml.Text")) {
182 
183                                                         org.docx4j.wml.Text t = (org.docx4j.wml.Text) ((JAXBElement) rc)
184                                                                         .getValue();
185 
186                                                         if (font == null) {
187                                                                 pdfParagraph.add(new Chunk(t.getValue()));
188                                                         } else {
189                                                                 pdfParagraph.add(new Chunk(t.getValue(), font));
190                                                         }
191                                                         log.debug("Added content " + t.getValue());
192                                                 } else if (((JAXBElement) rc).getDeclaredType()
193                                                                 .getName().equals("org.docx4j.wml.Drawing")) {
194 
195                                                         org.docx4j.wml.Drawing drawing = (org.docx4j.wml.Drawing) ((JAXBElement) rc)
196                                                                         .getValue();
197                                                         addDrawing(drawing, pdfDoc, pdfParagraph);
198 
199                                                 } else {
200                                                         log.debug("What? Encountered "
201                                                                         + ((JAXBElement) rc).getDeclaredType()
202                                                                                         .getName());
203                                                         // eg org.docx4j.wml.R$LastRenderedPageBreak
204                                                 }
205 
206                                         } else if (rc instanceof org.docx4j.wml.Br) {
207 
208                                                 pdfDoc.newPage();
209 
210                                         } else {
211 
212                                                 log.debug("found in R: " + rc.getClass().getName());
213                                         }
214                                 }


thanks.

Now it's 22:07 in China. It's time to have a break and go to bed.
Good day, everyone!