ASF Bugzilla – Attachment 21423 Details for
Bug 44292
[PATCH] TableCell skip its last Paragraphs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test program to demonstrate the bug
TableRowTest.java (text/plain), 2.11 KB, created by
Jean-Philippe Gagnon
on 2008-01-24 09:27:24 UTC
(
hide
)
Description:
Test program to demonstrate the bug
Filename:
MIME Type:
Creator:
Jean-Philippe Gagnon
Created:
2008-01-24 09:27:24 UTC
Size:
2.11 KB
patch
obsolete
>package test; > >import java.io.FileInputStream; >import java.io.FileNotFoundException; >import java.io.IOException; > >import org.apache.poi.hwpf.HWPFDocument; >import org.apache.poi.hwpf.usermodel.Paragraph; >import org.apache.poi.hwpf.usermodel.Range; >import org.apache.poi.hwpf.usermodel.Table; >import org.apache.poi.hwpf.usermodel.TableCell; >import org.apache.poi.hwpf.usermodel.TableRow; > > >public class TableRowTest { > > > > public static void main(String[] args) throws FileNotFoundException, IOException { > > HWPFDocument doc = new HWPFDocument (new FileInputStream ("D:/tmp/tableTest.doc")); > Range r = doc.getRange(); > > //get the table > Paragraph p = r.getParagraph(0); > Table t = r.getTable(p); > > //get the only row > TableRow row = t.getRow(0); > > //get the first cell > TableCell cell = row.getCell(0); > if( cell.numParagraphs() == 1 ){ > System.out.println("First cell has one paragraph, its ok"); > }else{ > System.out.println( "First cell has " +cell.numParagraphs() +" paragraph but should have 1" ); > > //the paragraph is however accessible > System.out.println( "The paragraph is however accessible: " + cell.getParagraph(0).text() ); > } > > System.out.println(); > > //get the second > cell = row.getCell(1); > if( cell.numParagraphs() == 1 ){ > System.out.println("Second cell has one paragraph but should have 2"); > //the paragraph is however accessible > System.out.println( "First paragraph is accessible: " + cell.getParagraph(0).text() ); > System.out.println( "Second paragraph is however accessible: " + cell.getParagraph(1).text() ); > }else{ > System.out.println("Second cell has 2 para, its ok"); > } > > System.out.println(); > > //get the last cell > cell = row.getCell(2); > if( cell.numParagraphs() == 1 ){ > System.out.println("Last cell has one paragraph, its ok"); > }else{ > System.out.println( "Last cell has " +cell.numParagraphs() +" paragraph but should have 1" ); > > //the paragraph is however accessible > System.out.println( "The paragraph is however accessible: " + cell.getParagraph(0).text() ); > } > > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 44292
:
21422
| 21423 |
21424