Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes saving text file as html file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "saving text file as html file" Watch "saving text file as html file" New topic
Author

saving text file as html file

tanmay durgule
Greenhorn

Joined: Aug 03, 2012
Posts: 1



I want to save selected text file as html file in target directory
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: saving text file as html file
 
Similar Threads
How to Save from JTextArea using JFileChooser as a TXT file.
Adding a text field to JDialog with JTextField
JFileChooser modification
File Open/Save Operations in Swing Editor
Jfilechooser saving files with file extension