Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

jtable to html or ASCII

Thread view: 
Mark Trompell - 17 Dec 2003 19:00 GMT
Hello,
is there an easy way to save ( and get) the contents of a jtable to
(from) html-tables or ascii?
Thanks
Greetings Mark
Christophe Vanfleteren - 17 Dec 2003 23:29 GMT
> Hello,
> is there an easy way to save ( and get) the contents of a jtable to
> (from) html-tables or ascii?
> Thanks
> Greetings Mark

Yes, something like:

StringBuffer sb = new StringBuffer("<table>");
for(int row = 0;row< table.getTableModel().size();row++) {
       sb.append("<tr>");
       for(int column =0; column<table.getTableModel().getColumnCount();column++){
               sb.append("<td>"+table.getTableModel().getValueAt(row,column)+"</td>");
       }
       sb.append("</tr>");
}
sb.append("</table>");

Signature

Kind regards,
Christophe Vanfleteren

Mark Trompell - 18 Dec 2003 09:35 GMT
Christophe Vanfleteren schrieb:

>>Hello,
>>is there an easy way to save ( and get) the contents of a jtable to
[quoted text clipped - 13 lines]
> }
> sb.append("</table>");

Okay, thank you. I hoped that there is a "wrapper"-class for this funktion.
To get html-> jtable is a little bit more complicatet i think but I'll try.
Greetings Mark


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.