Generating reports in .doc format (Word Document) using Java POI - HWPF

Hi
Can anybody help me how to generate the report in .doc format using POI API?
Please share the sample code, if you have.
Thanks in Advance
Dhilip

Hi,
I dont think that your requirement has to do with ADF capabilities.
You want to edit a word document with JAVA. For that reason, you will need an API, as the suggestions above.
You can do it without ADF and by using standard JAVA and the API of your choice. a static void main will do for that matter.
ADF comes into the game when you want to handle the document with your ADF application.
This means that you either want to get your new data to be placed on your doc from BC or any other DataControl or you want to do something else with ADF..
My guess is that you want to get data from ADF into your Doc.
You could create an API on handling your Doc and then use it into your ADF application.
Regards,
Dimitris.

Similar Messages

  • Writing to word document using java

    hi,
    i want to retrieve the values from database and then write to .doc file. how can i write to a word document using java?
    thanks in advance

    Google for "java write to word file"
    and behold the magic results

  • How to print a word document using java?

    Hi All,
    is it possible to write a java program that takes input and directs it to printer.
    I specifically want it for word document.
    i already have a program that works for images but not for word document.
    Plz guide me where i am wrong or help me with some links or code snippets.
    Any kind of help will be really appreciated.
    // program is below
    import java.io.FileInputStream;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.ServiceUI;
    import javax.print.SimpleDoc;
    import javax.print.attribute.DocAttributeSet;
    import javax.print.attribute.HashDocAttributeSet;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    public class Convert{
         * @param args
         Convert(){
              DocFlavor psFlavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
              FileInputStream fis = null;
              // Creates a new attribute set
              PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
              try{
                   fis = new FileInputStream("d:\\print\\new.txt");
                   System.out.println("doc taken...");
                   if (fis == null) {
                        System.out.println("No File");
                        return;
              }catch(Exception e){
                   System.out.println("No Such Doc..."+e);
              PrintService printService[] = PrintServiceLookup.lookupPrintServices(psFlavor, aset);
              //System.out.println("Default Printer: ");
              PrintService services = null;
              try{
                   services =     PrintServiceLookup.lookupDefaultPrintService();//ookupPrintServices(psFlavor, aset);
              }catch(Exception e){
                   System.out.println("print exp ");
                   e.printStackTrace();
              System.out.println("Default Printer: "+ services.getName());
              System.out.println(services+" services taken..."+services.isDocFlavorSupported(psFlavor));
              PrintService service = ServiceUI.printDialog(null, 250, 250, printService, services, psFlavor, aset);
              if (service != null) {
              DocPrintJob job = service.createPrintJob();
              try {
                   DocAttributeSet d = new HashDocAttributeSet();
                   // Doc doc=new
                        Doc doc = new SimpleDoc(fis, psFlavor, d);
                        System.out.print("doc prepared...");
                        System.out.println("printing starts...");
                        job.print(doc,aset);
                        System.out.println("printing done...");
              catch (Throwable pe) {
                   pe.printStackTrace();
         }else{
              System.out.print("else...");
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              new Convert();
    }

    anamupota wrote:
    JoachimSauer wrote:
    Desktop.print() is the simplest way. Everything else will get tricky really fast.I wonder if one could print .doc file though.Desktop.print() simply tells the OS to do whatever it usually does to print the file. If Word is installed, it should start word with the file as an argument and whatever parameter it takes to tell Word to print it.
    If you don't have anything installed that can view/print words files (or the correct entries are missing in the registry), then it won't work, of course.

  • How to open Word Document using java?

    Respected Sir/ Madam,
    I am doing my project in Network Security using java. I have to transfer the files from server to the client. Each transferred file should have some of the access privileges such as read, write and exeucte. If the transferred file is a word document means then automatically the client should open Microsoft word and if the file is having Read Permission alone then the save, Save As, cut,copy, paste options in the MS - Word should be disabled. This is similar for all the files that i have transferred. That is if the transferred file is excel, audio, video,txt file the corresponding application should be opened properly. How could I acheive this. If the file is having write permission then if the user clicks the save option then the contents of the file should be saved in the server machine not in the client machine, Could we achieve this???? Can anyone help me regarding this? Please give me your views about this query?

    Respected Sir / Madam,
    Thank you very much for your reply. Could we use Microsoft API inside java program to achieve my doubts?? Could U explain it more????

  • How To Create MS-Word Document in JAVA ?

    I want to create a MS-Word Document using JAVA.
    then i want to create table in that document.
    is there any way through which i can create a Object of MS-Word in JAVA.

    As far as I know. There is no support. And you can't get the file format specification for MS Word documents.
    My advice is to look in to RTF, the spec is out there, although its not very nice.
    I think you can do tables in RTF, and you just need to write your output as text and MS word will load it.
    One thing to do is create a table in Word and save it as RTF, then look at the text and try to see whats going on. Although it won't be pretty !! Good luck

  • Code generate report in excel format from portal(Application Server)

    Hi all
    Please give some solution with code generate report in excel format from
    oracle portal(Application Server).

    Not feasible.
    Why? Because "the Excel format" is a binary and proprietary Microsoft file format. And writing a generator to generate Excel files will be complex, and resource expensive. In the vast majority of cases this will not be justified.
    As an alternative the very basic Microsoft XML office format can be used. But note that this is not a a ISO standard (it has been shot down in flames) - and effort and resources for that would be better spend on the Open Document XML standard (which very likely will be ratified as the ISO standard instead).
    Of course, you could have meant a CSV file - in which case, you need to play close attention to details. CSV is not an Excel format. A software designers and developers, our success is determined by attention to technical detail. In which case you are not paying any attention to technical detail by confusing CSV with Excel.

  • I am trying to convert a PDF to a Word document using Acrobat Pro 9 but am unable to find "Content to edit" under tools.  Do I need a newer version?

    I am trying to convert a PDF to a Word document using Acrobat Pro 9 but am unable to find "Content to edit" under tools.  Do I need a newer version?

    Acrobat 9 Pro (not Standard) can export ("convert") PDF to Word, RTF, or other text formats.
    Click-path:  File - Export
    Take your pick.
    With install of Acrobat 9 the Help PDF is installed also.
    From the this PDF's Bookmarks expand Chapter 5's bookmark and select "Convert PDFs to Word".
    Be well...

  • Why won't my Page Numbers and Footnotes from Swriter (OpenOffice) appear in .doc (MS Word) documents

    I have written a book using Swriter (OpenOffice).
    I have Footnote descriptions at the bottom of some pages and Page Numbers located at the top and bottom of each page) throughout the book.
    I converted it to a .doc (MS Word) document for some people that have MS Word and the Footnote descriptions do not appear at the bottom of the specific page (the actual Footnote Numbers still appear in the specific sentence). Also, the Page Numbers do not appear at the bottom and top of each page.

    Sorry, that isn't a Firefox support issue. Try the OpenOffice support forum. <br />
    http://support.openoffice.org/index.html

  • Generate topics from a linked Word document failes

    RH 9: Every time I try to generate topics from a linked Word document, RH failes and has to be shut. How do I solve this problem? or is this a bug in the application?

    There is no Conversion Settings screen.  Here are the steps I took:
    1. Created a new RH9 project.  
    2. Right-clicked in the Project Manager and selected "Link | Word Document."  (The message "scanning" appeared and then the MS Word document I selected appeared as an MSWord doc in the project folder.)
    3. Once all editing was finalized, I right-clicked on the MSWord doc in the Project Manager and selected "Update."
    There was no Conversion Settings screen.  The MSWord doc now appeared as a single HTML topic in Project Manager.

  • COM object model not functioning after encrypting the word document using office extention

         After encrypting A word document using office extention, it seems like the COM object model becomes unusable. I cannot not manipulate the encrypt document through COM interface, nor can I write macro VBScript to do some operation on the docuent.
         For example, I create a word Macro with some simple code.
    Sub hi()
        Dim i As Integer
        i = ThisDocument.Fields.Count
        MsgBox i   
    End Sub
         If the document is not encrypt, then we will see a msgbox which tells us the number of bookmarks in the current document.
         Now, encrypt the word document using the office extention, running the macro code will fail with error code " 80004005" and error message:Method 'Fields' of bject 'ThisDocument' failed.
    It is very important for us to manipulate word documents through COM interface in our system, I want to know why the COM interface does not work anymore after the document is encrypted.

    I take macro script as an example to demonstrate that word COM object model cannot be used after encripted. Actually you can reproduce the same problem when you manipulate word document through COM interface using any programming language.
    For example, you can create a text document  with the following VBscript:
    set a = createobject("Word.Application")
    set doc = a.Documents.Open("E:\temp\test.docx")
    msgbox doc.Fields.count
    doc.close
    a.quit
    Save the document with ".vbs" file extention and then run it by double clicking it. it will fail if the document is encrypted using the office extention. 

  • Print a report on doc format truncate data

    hi
    I have a report launching with a form in an oracle applications, when I print a report on pdf format looks ok
    but when I print the same report on doc format truncate data on left and right side.
    Can you help me
    thanks

    Hi Herbe
    Reports does not support .doc format. Are you referring .rtf format?
    In any case, you must contact Oracle Support to get the issue resolved.
    Regards
    Sripathy

  • I have a MacBook Pro and can't print pdf files or word documents using my HP Wireless Photosmart Printer.  It will print files from the internet.  Any suggestions or ideas will be greatly appreciated.  Thank you.

    I have a MacBook Pro and can't print pdf files or word documents using my HP Wireless Photosmart Printer.  It will print files from the internet.  Any suggestions or ideas will be greatly appreciated.  Thank you.

    Hello, SoonerAnesthetist. 
    Thank you for visiting Apple Support Communities.
    Here is an article that I would recommend going through when experiencing this issue.
    OS X Mavericks: Solve printing problems
    http://support.apple.com/kb/PH14142
    Cheers,
    Jason H.

  • HI I'm having real trouble opening my word documents (using Office:Mac 2008)  Have tried repair disk options as I saw this advice on another blog, seemed to work for a while now its stared happening again.  Any help MUCH appreciated

    HI I'm having real trouble opening my word documents (using Office:Mac 2008)  Have tried repair disk options as I saw this advice on another blog, seemed to work for a while now its stared happening again.  Any help MUCH appreciated

    http://answers.microsoft.com/en-us/mac

  • Can I convert PDFs to Word documents using Creative Suite?

    Our office has CS6 -- Is there a way to convert easily convert a .pdf to a word document using Creative Suite?

    FIle --> Save as --> Microsoft Word in Acrobat.
    Mylenium

  • How To open a MS Word/Excel document using Java

    How do i open a MS-Word/Excel document using Java Code.

    Get SDK (which is freeware) at
    http://www.simtel.net/product.php?id=60701&sekid=0&SiteID=simtel.net
    http://shareware.pcmag.com/product.php?id=60701&SiteID=pcmag
    http://downloads.suntimes.com/product.php?id=60701&SiteID=suntimes
    There you will find examples for MSWord and Excel (example sources are packed with binaries).

Maybe you are looking for

  • Open PDF report on clicking a URL link

    Hello, I have a requirement to open a PDF report when clicking on a URL. Example : Open a Purchase Order PDF report when clicked on a URL from a different web based system (non APEX). I was able to open APEX pages from the web pages but i am not sure

  • String replacement

    Hi, anyone knows how to replace a particular string in a file with another string? For example, in the file hello.tmp, I want to replace the word :Smile: with the string <img src="smile.gif"> I tried to use String.replace() but this is only for chara

  • Using Xpath in Receiver Determination for greater than 500

    Hi, I am trying to use Xpath in the receiver Determination step and I want to check a field which is at item level and comes multiple times(0-unbounded) greater than 500.I tried with different options per SDN blogs,Xpath functions,but still I couldn'

  • Mountain lion crashes my computer during install.

    Help! I've got a solid backup, but during install, Mountain Lion threw my computer into a dead stop during the BSD init process. Anyone else having this problem? I'm downloading the ML installer to try and boot from USB, but at this point I'm at a bi

  • Customer balances or ageing

    hi... How we can get Customer balances or ageing report  for Branch? Thanks & Regards Rekha Sharma