aspose file tools
The moose likes Beginning Java and the fly likes String preservation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "String preservation" Watch "String preservation" New topic
Author

String preservation

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
ok say I scan a line of text, and the font is say size 14 and bold and
underlined..

how do I go about preserving those attributes and keeping them so that when
I copy it to another file, its exactly the same?


say the String is


"KenWood Building" and is Bold and font size = 14

when i do scan.nextLine(), does it do that automatically?


Justin


You down with OOP? Yeah you know me!
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1295
To be precise, the String itself is not bold or underlined or anything, thats just how it is currently displayed in whatever editor you're using. A String at it heart is an array of chars, it has no concept of being bold or underlined, its just text. If you want bold or underlined text, you'll have to markup your String using whatever markup language the word processor or editor you're going to be using the text in recognizes.


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
markup language? like html? its going to be a .doc file so a word file.

how would i go about doing this?

for example:

classes I should look at.
what markup word recognizes.


Thanks,


Justin
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Justin Fox:
markup language? like html? its going to be a .doc file so a word file...

It's the same idea: Expect formatting tags (special sequences) within the file. You can find details for common file formats at wotsit.org.

(Word is a monster.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
cool thanks, my prof said something about capturing the string in binary format so it not only gets the text, but also the attributes.

is there a class that does this in java?

or do i just need to stick to the tags in word..

Thanks,


Justin
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: String preservation
 
Similar Threads
help me out!
font in JOptionPane.showInputDialog
Bold Style is not applicable for font of float size
font in JOptionPane.showInputDialog
customise string?