Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Embed excel content to JTextPane with alignement

 
Ramesh kangamuthu
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
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java 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.
 
Campbell Ritchie
Marshal
Posts: 52631
119
  • 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: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, I forget it quite a lot too
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!