How to create html files using Swing

I am developing a billing system in java. I want to generate cash memo and other related documents in HTML format. I have explored html package in swing but without result. Please help me.
Arshad

Hi,
I agree with the previous poster. An additional way of generating HTML would be to directly write it. Class SHTMLWriter in package com.lightdev.app.shtm of application SimplyHTML at http://www.lightdev.com/template.php4?id=3 gives this opportunity.
With this, you can do something such as   /**
   * example of synthesizing HTML code to a Writer using
   * class SHTMLWriter
   * @param fileName the name of the file to write HTML to
  public void writeHTML(String fileName) {
    try {
      FileWriter fw = new FileWriter(fileName);
      SHTMLWriter w = new SHTMLWriter(fw);
      w.startTag(HTML.Tag.HTML.toString(), null);
      w.startTag(HTML.Tag.BODY.toString(), null);
      SimpleAttributeSet set = new SimpleAttributeSet();
      set.addAttribute(CSS.Attribute.FONT_FAMILY, "SansSerif");
      set.addAttribute(CSS.Attribute.FONT_SIZE, "12");
      w.startTag(HTML.Tag.P.toString(), set);
      fw.write("some text");
      w.endTag(HTML.Tag.P.toString());
      w.endTag(HTML.Tag.BODY.toString());
      w.endTag(HTML.Tag.HTML.toString());
    catch(Exception e) {
      e.printStackTrace();
  }The HTML output is hard coded in this example. Certainly any HTML code can be created dynamically/programmatically instead. Class SHTMLWriter is partly meant as a convenience class for writing HTML. One can just through start and end tags as in above example. In the start tag any valid AttributeSet can be given.
HTH
Ulrich

Similar Messages

  • How to read HTML files using UTL_FILE

    Hello Friends,
    How to read HTML files using UTL_FILE package ? According
    to Oracle documentation UTL_FILE can read or write OS Text Files.
    Thanx in advance..
    Adi

    HI Hareesh,
    i have gone through that blog.
    i tried it...but i am getting mapping error  no receiver determination fond because there are so  many excel files.
    my data is available on sharedString.xml but also it is in not same order.
    i have no clue how to handle this part form the blog.
    "This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Kindly help me how to view html file in swing using jbutton

    hello..im a begginer at j2se language and im working on my school project..kindly help me how to view html files by clicking button at javax.swing..thanks

    Here you go:public class HTMLViewer implements Runnable, ActionListener
         public void run() {
              JFrame frame = new JFrame("View HTML");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JButton button = new JButton("Click me!");
              button.addActionListener(this);
              Container cp = frame.getContentPane();
              cp.add(button, BorderLayout.CENTER);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
         public void actionPerformed(ActionEvent e) {
              if (Desktop.isDesktopSupported()) {
                   Desktop d = Desktop.getDesktop();
                   try {
                        d.browse(new URI("www.google.com"));
                   } catch (IOException ex) {
                        ex.printStackTrace();
                   } catch (URISyntaxException ex) {
                        ex.printStackTrace();
         public static void main(String[] args) {
              EventQueue.invokeLater(new HTMLViewer());
    }If that's not what you're looking for you need to ask more specific questions.

  • How to display HTML files using ABAP Webdynpro?

    Hi,
    I have a html index file and a bunch of other files accessed by the index file  in a specific directory on the SAP server. I'd like to display the index file via ABAP webdynpro and allow the users to click on what they need to see. How can I achieve this using utilizing the ABAP webdynpro technology ?
    Thanks!

    Hi Thomas,
    Thanks for taking the time to answer my question.
    I have the main html file and all other files needed by the main file in one directory on the application layer of SAP. I'd like to provide the user with a link, by clicking on which they should be able to get to the main html file using the browser. This is just a standalone application.
    I can try the approach using BSPs, however, I'm new to that area. Could you point me in the right direction to get started?

  • Best IDE and how-to create HTML for a swing Applet

    Can you help me out? I've been using, and teaching with the old Symantec VisualCafe product from long, long, ago. It still works fine & I can even use it to build JFC/Swing Applets etc. But a few things have occurred. For one, a way back, Symantec sold VisualCafe to WEBGAIN - who now has gone out of business and sold it to a company called TOGETHERSOFT - who doesn't support it any longer.
    This isn't really a big deal to me, because I can still build and deploy applets that are pre-swing easily enough. (as can my students)
    HOWEVER... I'd like to be running with the LATEST Java (I think it's 1.4.01) and I'd LIKE to use whatever is the best development environment I can use - especially one I can recommend to my students. Do you know what that should be?
    What's more, I'd still like to take some JFC/Swing created applets (even if compiled with the older VisualCafe IDE) and generate the HTML to allow 1.4 enabled browsers to run them (this is the case for the schools versions of Explorer and Netscape). Now, the HTML I have INSTALLED for the students used the HTML converter - back in 1.2 to produce the HTML at the bottom of this. This code no longer works now with current browsers. Do you know HOW one makes a jfc/swing compiled applet run on the latest browsers?
    Any help or direction you can give would be appreciated.
    thanks,
    Bobby Berns
    [email protected]
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 756 HEIGHT = 396 codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
    <PARAM NAME = CODE VALUE = "lottery.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.2" java_CODE = "lottery.class" WIDTH = 756 HEIGHT = 396 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "lottery.class" WIDTH = 756 HEIGHT = 396 >
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->

    Bobby,
    It's been a while since I've used the HTML Converter, but if I had to guess I'd say you need a newer version than what you have. Also, doesn't the converter allow you to choose which JDK you want to use (in which case you could select 1.4)? Again it's been a while so bear with me. Another option would be to put all the Swing classes into a .jar file (typically called swingall.jar) on your server and include that file as an attribute in your applet tag like this:
    <APPLET CODE="yourApplet.class" ARCHIVE="swingall.jar">
    This way you don't have to use the Java Plug-in, however the initial download time of the .jar file can be significant.
    As for an IDE, I've always been happy using a text editor like UltraEdit. However, I've heard good things about Forte, and hey, it's free!
    Regarding Christina's post, that solution will only work if the Applet does not use Swing components (and Bobby specifically said it does). By using the <OBJECT> and <EMBED> tags, rather than the <APPLET> tag, you force the browser to use the Java Plug-in (rather than the browser's default JVM).
    Hope that helps,
    - Sheepy

  • How to embed html-file into swing

    hello,
    can anybody help me how to embed a html-file into a swing application??
    I try to write a swing-application, that connects to a Internetpage via Sockets.
    The problem is, that I can only see the sourcecode of the InternetPage in my JTextArea, but I want to see the whole Page just like in a browser.
    I hope anybody can help me to solve this problem, thanx mina

    u will need to use the JEditorPane component instead of Jtextarea.here is a url to help u get started
    http://java.sun.com/docs/books/tutorial/uiswing/components/simpletext.html#editorpane

  • How to upload html files using Weblogic Bulkloader

    I hav uploaded image files using bulkloader.
    however with html files am facing a prob.
    only the file structure gets created but there is no html file present inside.
    in
    Filename.html.md.properties i agv the followin
    nodeType=html
    lifecyclestatus=2
    File=C:\ContentRepository\a.html
    encoding=UTF-8
    charset=us-ascii
    mimeType = text/html
    shud i add some more properties...

    You have to do this your self by either (as vinod said) using a different component (not present in adf) or implementing this:
    1) allow the user to select multiple filenames (somehow)
    2) zip them together
    3) upload the zip
    4) unpack the zip on the server
    5) work with the files
    Timo

  • How to read html file using

    Gretting All,
    I have a html file....and also have a frame in which i m adding textarea with scroll pane...then setting the component using setcontentpane ....
    It's working fine....
    But i wanna display my html file in that textarea..
    how do i proceesed?
    regards,
    Tarique
    Marry X-mas

    BufferedFileReader in = new BufferedFileReader( new FileReader(....) );
    textArea.read(in, null);

  • How to create html files while the request to a jsp file of same

    Hi..
    i need to create html thumbnails during the runtime for a jsp page. so that i can display it in a table (number of pages.). For that, i need to create html pages for each and every request to that jsp file with different data. please help me in this..
    Thanks
    Suresh S

    I believe you will need to more clearly describe what you are trying to do and what the problem is that you are having before you get a reply to your question.

  • How to create zip files using Terminal?

    I don't know much about Terminal, but I need to compress a folder from one external hard drive directly to my Time Capsule and split archives to 4GB each. What is the command to do that?

    zip
    http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ man1/zip.1.html
    zip -s 4g -r archivename directoryname

  • How to creating pdf documents using c# and Adobe SDK

    I downloaded Adobe SDK and go through the samples given in sdk. But i couldn't find any sample code how to create PDF file using C# code.
    Please, help me with this.
    Thanks.

    For desktop-based solutions, look at the Adobe Acrobat SDK which enables development around Acrobat itself. Or if you wish a stand-alone solution (for either desktop or server), we offer the Adobe PDFLibrary, which is the same technology used by all of Adobe's applications.
    For the server, we have our LiveCycle products including LC Generator.
    Leonard

  • Can I use Photoshop Elements 13 to create HTML file?

    Can I use Photoshop Elements 13 to create HTML file?

    See Barbara's answer in your duplicated post: How can I save a Photoshop Elements 12 file as HTML?
    No difference with PSE13.

  • I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I alocate th

    I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I allocate the extension .docx to Word? There used to be a way of doing it, I think under "Preferences" but I can't seem to find it.

    Still in the same location:
    File > Get Info > Open with (select) > Change All (button)

  • I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    I have Dreamweaver CS3 on a PC with Windows Vista SP2. The program recently began to hang when opening previously created HTML files. How do I fix this?

    Hi rmarchione,
    Can you try restoring preferences and let us know if it helps?
    Restore preferences | Dreamweaver CS4, CS5, CS5.5, CS6
    Thanks,
    Preran

Maybe you are looking for

  • Recovery key

    I've was a iTools user and a .mac and mobileme (yuk) user. I've had the same email for almost 15 years. Now I'm reading about a "recovery key" if you get locked out of your Apple account. I never had one. How do I get it? I'm worried. http://thenextw

  • Active Vendor of an Material !!!

    Hi Guys, How we can see the number of active vendors for an Material in SAP MM,? For example I have total created vendor in system is 70 for Matrial A and I want to know that active vendors for Matrial A, how we will find out the list for the same.

  • Sales order block for delivery

    How to put delivery block to existing open sales order for particular sold to party(customer). Is there  any table or TCode where we can put multiple sales order to put this block. Dont tell VD05 bcos that will apply only to new sales order not to ex

  • Updating Adobe Application Manager

    Attempting to download Acrobat XI, an update of AAM began, asked for password with message AAM wants to make changes, installation was terminated with message "Encountered issues with installation, Error Code A12E1. What does this mean?

  • Printing from a samsung phone

    Try to print an hp officejet 4500 wireless printer from samsung galaxy s lll phone can anyone please tell me how I can print pictures emails and files . Thanks