File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StyledDocuments Image Alignment

 
Charles Kent
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody, I've got two questions. I've been working on a program which uses a jtextpane+styled document. The document has both text (multiple styles), and one .gif picture.

1)The document looks much like a page of text with the image at the top left. The problem? I want the image at the top right while keeping the text left-aligned. I've tried setCharacterAttributes(), setParagaphAttributes(), and insertString() with right-aligned styleconstants, alas it has not worked. The character attribute call did something funky and put in the image, but at the bottom of the document and right aligned. I input the text via a String[] so I can add the appropriate styles to differnt portions of the document.

2) Is there a way to save a styleddocument file to rtf format with which it includes the picture? I've only been able save the text from the document. Would breaking the document up in 2 and trying to use and ImageIO for one and FileWriter for the text work, trying of course to put it all into the selected name from JFileChooser.

Thanks in advance, any and all help would be appreciated
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic