1 2 17 18 package org.apache.poi.hwpf; 19 20 import java.io.*; 21 22 import org.apache.poi.hwpf.usermodel.*; 23 24 public class QuickTest 25 { 26 public QuickTest() 27 { 28 } 29 30 public static void main(String [] args) 31 { 32 try 33 { 34 HWPFDocument doc = new HWPFDocument (new FileInputStream (args[0])); 35 Range r = doc.getRange(); 36 37 System.out.println("Example you supplied:"); 38 System.out.println("---------------------"); 39 for (int x = 0; x < r.numSections(); x++) 40 { 41 Section s = r.getSection(x); 42 for (int y = 0; y < s.numParagraphs(); y++) 43 { 44 Paragraph p = s.getParagraph(y); 45 for (int z = 0; z < p.numCharacterRuns(); z++) 46 { 47 CharacterRun run = p.getCharacterRun(z); 49 String text = run.text(); 51 System.out.print(text); 53 } 54 System.out.println(); 56 } 57 } 58 59 60 82 } 83 catch (Throwable t) 84 { 85 t.printStackTrace(); 86 } 87 } 88 89 } 90 | Popular Tags |