Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HWPF Doc File - Handling string line break?

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm trying to implement an export functionality to a webapp I've developed. The whole workflow is there's an Elasticsearch query, the results are stored in Arraylist of Article classes, which just contains strings.

Now, within this article class, there's a 'Text' field that has a large text body with line breaks in the middle of it.

When I do a System.out.println(Article.getText()); , I get the properly spaced output in console. However, when I do the export to the .doc file, the linefeeds are replaced with unknown characters ("?"). See attached image.



Here's my code to write the export at this point:



Is there a way to determine what that character is that is giving me the ?'s in Word and replace it with System.getProperty("line.separator") ? I just don't know how to go about finding what that character would be in Java.

Thanks in advance!
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic