Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning 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
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Embed excel content to JTextPane with alignement

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I have been working in a Swing application.In one of the forms I need to select a excel file in JFileChooser and copy it to JTextPane
with proper alignment. I could select it and append it to JTextPane, but with no proper alignment.

Also If I align the text copied from a excel file in JTextPane, I could not get what I have aligned manually in jasper report/ireport.

Why can't I get the JTextPane content aligned properly?


Regards,

Ramesh Kangamuthu
 
Sheriff
Posts: 21922
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because of the font. Most fonts are not mono-spaces, meaning some characters (like i or l) take up less space than others (like W or M). Change your font to something like Courier (New) and try again. Or, and this is what I would do, use a JTable.

Moving to our GUI forum.
 
Marshal
Posts: 69015
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Prime wrote: . . . Moving to our GUI forum.

And I always thought it was me who forgot to move threads
 
Rob Spoor
Sheriff
Posts: 21922
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, I forget it quite a lot too
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic