You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Hofmann, Lysann" <Ly...@geosn.sachsen.de> on 2011/08/17 13:46:35 UTC

HWPF Replace doesn´t works

Hello
I have a problem.
 I want Words   in a . doc .replace with following Code:

  HWPFDocument doc;
				try {
					doc = new HWPFDocument(new
FileInputStream("C:\\Desktop\\Blubber.doc"));
					  Range range = doc.getRange();
					

	            range.replaceText("$blubber", "muh");
	            OutputStream out = new
FileOutputStream("C:\\Desktop\\Blubber2.doc");
	        
	            doc.write(out);
	            
	            out.flush();
	            out.close();
	 
	            
	      
	    System.out.println("ready");
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
	 


However, if I want to open the resulting file, Word gives me the following
error message "The document is too large for Word"

It would be nice if they could help me, because I need this program 
Thanks you