我正在使用 apache poi 修改一些现有的 rtf 文件并将副本返回给 Web 应用程序中的客户端。我的问题是当我尝试替换一些文本并插入另一个用阿拉伯语代替的文本时。
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();
如何设置 rtf 对齐方式?