• Post Reply Bookmark Topic Watch Topic
  • New Topic

String preservation  RSS feed

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!