Search code examples
jakarta-eestrutsapache-poirtf

right to left with apache poi


I'm using apache poi to modify some existing rtf files and return a copy to the client in a web application. The issue with me is when I try to replace some text and insert another which is in Arabic instead.

    FileInputStream in = new FileInputStream(mypath);
            POIFSFileSystem fs = new POIFSFileSystem(in);
        
            HWPFDocument doc = new HWPFDocument(fs);
           
            
            
            Range r = doc.getRange();
             r.replaceText("<matricule>","  "+agent.getMatriculeAgent());
            r.replaceText("<cin>","  "+agent.getCin());
             OutputStream out = response.getOutputStream();
        response.setContentType("application/rtf");
        
        response.setHeader("Content-Disposition","attachment; filename="+fileName);
        doc.write(out);
        out.flush();
           

How can I set rtf alignment?


Solution

  • i resloved the problem it's so simple , the problem is due that i replace french word with arab ones and since this they are just a words used to locate where i have to modify the text , they can be any charchter and the more appropriate is arabic !