2

dears kindly i try to read Arabic document to my "jtextarea" but it appears inverted like this "ﺖﻧﺮﺘﻧﻹﺍ ﻡﺍﺪﺨﺘﺳﺍ ﻲﻓ ﺔﻣﺪﻘﻣ" instead of "مقدمة في استخدام الانترنت" so it is reversed so any advice please. My code is:

JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(null);
XWPFDocument doc = new XWPFDocument(new 
FileInputStream(chooser.getSelectedFile()));
XWPFWordExtractor extract = new XWPFWordExtractor(doc);
List<XWPFPictureData> listPic = doc.getAllPictures();
System.out.println(doc);
content.setText(extract.getText());
content.setFont(new Font("Serif", Font.ITALIC, 16));
content.setLineWrap(true);
content.setWrapStyleWord(true);
content.setBackground(Color.white);
Michael M.
  • 51
  • 1
  • 2
  • 1
    This might help [How to print Arabic characters in left-to-right direction](https://stackoverflow.com/a/29672273/3110695) – FortyTwo Jun 02 '17 at 21:22
  • And this [Writing arabic letters in Java](https://stackoverflow.com/questions/20846492/writing-arabic-letters-in-java) – FortyTwo Jun 02 '17 at 21:23
  • It seems to me that your problem is not reading the characters but displaying them. Is that correct? – Stephen C Jun 03 '17 at 00:08
  • **yes** @StephenC – Michael M. Jun 03 '17 at 00:26
  • Then the linked questions answer you question. Basically, use `setLocale` on the `JTextArea` to set it to an arabic locale. Then it should display the characters right-to-left. – Stephen C Jun 03 '17 at 00:36
  • (And for future reference, you will get better help if you state the problem clearly in the question and subject. Compare the subject that you used with the actual problem you are trying to solve. See what I mean?) – Stephen C Jun 03 '17 at 00:39

0 Answers0