Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saving text file as html file

 
tanmay durgule
Greenhorn
Posts: 1
C++ Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want to save selected text file as html file in target directory
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

There are several things I don't understand there. First of all, what do you mean by "saving" a file? In many cases that means writing data from the application into a selected file; I can't tell if that's what you intended. There's no automatic way in Swing to do that, you have to write the code yourself which outputs the data.

Second, what do you mean by saving it "as HTML file"? A file isn't an HTML file unless it's formatted HTML data, starting with the <html> tag and so on. You can't take any old data and have it magically converted into an HTML file, if it wasn't HTML to start with then you have to do something to make it into HTML.

And third, what's that about a "target directory"? If you want the chooser to start by asking the user to select a file in a particular directory, then you'd use its setCurrentDirectory method to tell it what that directory is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic