Write word file in proper format...

Respected teachers and mydear friends
I am stuck-up with the following problem ..Can any one please help me ?
I want to write a doc file with proper format ex Resume. using Java
I am using java.io package for writing the doc file. I am not using AWT , Swing or any other GUI components.
I am able to write doc file .The contents are properly written but all the contents are in one font and one size. I want to vary that. How can I do this ?
Any idea.
Thanks and Regards

When you say 'doc' do you mean Microsoft's Word document format? If so, the formatting is part of a complete specfication based on MS's OLE 2 compound documents.
You can't really use I/O directly unless you know the file format specification which I think is MS proprietary.
You could have a look here (http://jakarta.apache.org/poi/) since they have done work on an API reading and writing this format.
If it's not MS Word based, ignore the above. You're still gonna need a file format though for fonts, etc (try RTF).

Similar Messages

  • I have a Word file in square format. Converting it to PDF wipes the format and produces a document in portrait format.

    I have a Word file in square format. Converting it to PDF wipes the format and produces a document in portrait format.

    Create a Custom Page Size with the same dimensions as your document within a new Joboptions file and then use that new Joboptions file when you convert your square document to PDF.

  • How to recover word files with readable format after formatting external hard drive?

    I had tried different software. All software are able to recover word files but all word files having encoded content  is there any way to convert it in readable format?
    please provide any solution for this problem
    Thank You.

    Are you saying that these documents are password-protected? In that case, if you don't have the passwords, it's going to be next to impossible to open them.
    Stefan Blom, Microsoft Word MVP

  • Word files in FCP -Formatting problems

    Does Anyone know if there is a better way to import MS- Word files in FCP. Everytime I copy and Paste it needs to set lines and formating. I only get 1 line with all the doc's information. It takes forever to format in FCP. Any Sugestions would be apprieated....

    Well hopefully somebody has a better answer than I do, but I find that it's sometimes smartest to format the text in word to match what I'm looking to accomplish in fcp. Also, I find that sometimes that word formatting can cause fcp to crash. I sometimes find it necessary to copy the text into text edit and then bring it in to fcp. By the way, I'm usually using title3D.

  • HT2518 which program can I use to open a Word file that is formatted for use ONLY on a PC?

    I hve a word doc that is formatted only for use on a PC. I cannot change the file at the request of the sender. Is there a way to open and fill out the word document on a mac. I used to have Parrelles which allowed me to do so but no longer have this program. Specifically the word document has pre-programmed drop downs in the form. They do not function, nor allow me to type a word into the field.

    There is no such thing as a Word file formatted only for a PC.
    You need a copy of Word to open it (Word for Mac), it may also work with Open Office and Libre Office, these are free to download.

  • Converting MS word files to ebook format

    I am converting my MS word files which have transparency layered graphics to pdf.
    Once in pdf my ebook vendors are unable to get it up into ebook format because of issues with the transparency layers originating from the source file.
    We have used a total of eight international document conversion companies to try and solve the issue and not one of them so far has been able to convert our MS word source files containing the transparencies to ebook format correctly.
    What I am seeking from you is some strategies to solve the problem.
    The two software programs I am using are 2007 MS word and Acrobat X Pro
    Thanks.

    Thanks Brian and MVP really appreciate the feedback. Flattening the
    transparency in print production did help and I appreciate you both taking
    the time to help me. Thanks once again.
    Take care
    Shawn Martin
    http://aper.com.au/

  • Importing text from Word file while keeping formatting

    I have text set up to convert to Goudy Oldstyle. When I try to import formatted text from a Word file, the italics don't translate to Goudy Oldstyle italic. It becomes Goudy Italic and then reads as a conflict. How would I be able to reformat just the italics?

    Find Font is also in CS2 (Type > Find Font). Very easy, very simple.
    In CS2, Find Font doesn't have the same Redefine Style functionality
    that it does in CS3, but you can still find a missing font or font
    variant and replace it with something that's not missing. You would have
    to redefine styles manually, but you can use Find Font to figure out
    which styles need redefining. (That is, if you've used styles; we don't
    know yet because you haven't said.)
    Kenneth Benson
    Pegasus Type, Inc.
    www.pegtype.com

  • How to Write a file from hex format to another format

    hi I am trying to create a file (IBM AFP-printer format) from the hex file which i have created after reading that IBM afp file. Now i have to do some changes in that hex file data and store it back to the same format.
    I have tryed storing it using:
    Writer out = new OutputStreamWriter(outputStream,"Cp1252");
    but it is taking hex format only.
    I have checked encoding of afp file by this code
    File inputFile = new File( "C:\\ACode\\new2.afp" ) ;
              FileInputStream inputStream = new FileInputStream(inputFile );
         InputStreamReader in = new InputStreamReader(inputStream);
    System.out.println(in.getEncoding());
    it is showing Cp1252 only.
    But i am unable to store it back to same format
    Thanks

    I don't really know what the IBM APF stream format is, but I suspect that your approach is not right. If you really want to read and write raw hex bytes, then do not use readers and writers; instead use pure streams. The reason is that readers and writers are designed to deal with character-oriented data, and will automatically perform translations on input and output.
    On the other hand, if you could find the correct encoding/decoding software for the IBM format in question, well then readers/writers would be fine, and you could do all of your "internal" work in unicode.

  • Possible to read/ write word files using Java?

    I'm planning to write a Java application that can read an MS word document, extract something (including mathematics equations created with the equation editor) from the document and write it to another word document.
    Is it possible to do this?
    Can anyone give me some idea?
    Any idea is much appreciated :)

    I think I may have misunderstood your question, but in case I didn't and you find this helpful, following is the code to read a word doc, replace certain strings, then write it out as a new doc.
    import java.io.*;
    public class Copy {
         public static String endResult;
         public static void main(String[] args) {
              String oldAuthor = "Samuel Foote";
              String newAuthor = "New Author";
              String oldDate = "1720-1777";
              String newDate = "1975 -- ";
          try {
              File inputFile = new File("C:\\document.doc");
              BufferedReader input = null;
              input = new BufferedReader(new FileReader(inputFile));
              StringBuffer contents = new StringBuffer();
              String line = null;
              while ((line = input.readLine()) != null){
                   contents.append(line);
                   contents.append(System.getProperty("line.separator"));          
              String text = contents.toString();
    //     Replace the author and the dates
              Copy y = new Copy();
              y.replace(text, oldAuthor, newAuthor);
              text = endResult;
              y.replace(text, oldDate, newDate);
    //     Copy the new, improved text to another file     //
              Copy z = new Copy();
              z.finalReplace(text);
              input.close();
         catch (FileNotFoundException ex) {
              ex.printStackTrace();
         catch (IOException ex){
              ex.printStackTrace();
         String replace(String text, String oldSubstring, String newSubstring) {
    //          Search the text for a string, then replace it //
              int fromIndex = 0;
              int e = 0;
              StringBuffer sb = new StringBuffer();
              while ((e = text.indexOf(oldSubstring, fromIndex)) >= 0) {
                   sb.append(text.substring(fromIndex, e));
                   sb.append(newSubstring);
                   fromIndex = e + oldSubstring.length();
              sb.append(text.substring(fromIndex));
              endResult = sb.toString();
              System.out.println("final string = " + sb);
              return sb.toString();
         String finalReplace (String args) throws IOException {
    //          Move the altered text to a new file  //
              File outputFile = new File("C:\\copied document.doc");
              FileWriter out = new FileWriter(outputFile);
              Writer output = null;
              try {
                   output = new BufferedWriter(new FileWriter(outputFile));
                   output.write(endResult);
              finally {
                   if (output != null) output.close();
                 return endResult;

  • Output file in not a proper format

    Hello, My JAVA program generate an output file using FileWriter. The name of output file is output.dat (ie a NOTEPAD file). But when I open up the file it is not in proper format. All the text get clustered. But when I open the same file in MircoSoft Word its open with no problem. Is there any solution to this problem.
    bye

    Most text editors will accept '\n' alone as the line terminator. Notepad is an exception.
    Workarounds are:
    1. Write an '\r' immediately before each '\n'.
    2. Get a decent text editor.

  • While generating reports in Oracle BI Publisher in pdf format, the generated pdf reports have hindi  इ matra displaced by one character. For example, रिपोर्ट is printed as रपेिोरट.  Word file generated of the same report have correct hindi इ  matra positi

    While generating reports in Oracle BI Publisher in pdf format, the generated pdf reports have hindi  इ matra displaced by one character. For example, रिपोर्ट is printed as रपेिोरट.  Word file generated of the same report have correct hindi इ  matra position and also pdf generated from this word file also contains the same.

  • Read PDF Formatted Spool and write PDF File to Application Server

    Hi Experts,
    After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
    We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
    PARAMETERS : p_spono LIKE tsp01-rqident.
    DATA: pdf_data type FPCONTENT.
    types: lt_pdf_table(1000) type x.
    data:  l_pdf_data type standard table of lt_pdf_table,
           l_pdf_line type lt_pdf_table,
           l_offset type i,
           l_len type i,
           p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
    *Read the spool content
    CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
        EXPORTING
             i_spoolid = p_spono
             i_partnum = '1'
        IMPORTING
               e_pdf = pdf_data
    *         e_pdf_file = file
        EXCEPTIONS
             ads_error = 1
             usage_error = 2
             system_error = 3
             internal_error = 4
        OTHERS = 5.
    * Modify the spool  contents to prepare internal table
      l_len = xstrlen( pdf_data ).
      while l_len >= 1000.
        l_pdf_line = pdf_data+l_offset(1000).
        append l_pdf_line to l_pdf_data.
        add 1000 to l_offset.
        subtract 1000 from l_len.
      endwhile.
      if l_len > 0.
        l_pdf_line = pdf_data+l_offset(l_len).
        append l_pdf_line to l_pdf_data.
      endif.
    * GUI DOWNLOAD Works Fine
    * Now pdf contents is ready , lets store in local PC
    *CALL FUNCTION 'GUI_DOWNLOAD'
    *  EXPORTING
    *   filename                        = 'C:\Documents and Settings\Desktop\shital.pdf'
    *   filetype                        = 'BIN'
    *  TABLES
    *    data_tab                        = l_pdf_data.
    OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error opening file:'(Z03) p_file.
    ENDIF.
    LOOP AT l_pdf_data INTO l_pdf_line.
      TRANSFER l_pdf_line TO p_file.
    ENDLOOP.
    CLOSE DATASET p_file.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error closing file:'(Z04) p_file.
    ENDIF.
    Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
    But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
    As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
    Let me know if you require further details about the issue.
    Regards
    Shital
    Edited by: shital phadake on Apr 8, 2009 9:39 PM

    Thanks Selçuk for your reply and taking time for understanding the Issue,
    I went thru Functionality of the program you suggested but dont think it matches my requirement.
    Regards
    Shital

  • How can I embed files of word, excel, and pdf format in a pdf document

    I have a word document of the product, which I am updating for next product release. However, there are some excel, word, and pdf files embedded within a word document. When I double click these embedded files in word, these files open in a new window. However, we deliver documentation to the customer in the pdf format. Therefore, when I am converting the word document in the pdf format, only an icon of the embedded file is displayed and the files do not open in a new window. Can someone let me know how can I embed these files (in word, excel, and pdf format) in a pdf document?

    You must attach them to the PDF file after it is created. You cannot embed file attachments onto a page as you can with Word.

  • Why Acrobat x professional is changing the text formatting specifically the font family  and the font size of the text in my pdf on exporting it to Microsoft word file format ?How should i stop Acrobat x professional from doing that so that i get an exact

    Why Acrobat x professional is changing the text formatting specifically the font family  and the font size of the text in my pdf on exporting it to Microsoft word file format ?How should i stop Acrobat x professional from doing that so that i get an exactly same word file on exporting it from its pdf counterpart?

    I was testing the preciseness & efficiency of Adobe acrobat x professional's doc conversion capabilities. As i have to take a document editing project in future which is going to need lot of pdf to word and vice versa conversions . What I did was I created a test word document converted into a pdf using a pdf maker in my word 2007 , Acrobat did convert the document from word to pdf keeping everything in the source file intact , However when i tried the other way round and attempted to convert the same pdf to word 2007 file format I lost my formatting ?So the font that I used to create the pdf are the ones taken from word 2007 which i believe is using the fonts that are installed in my computer. Any suggestions on how to preserve the formatting of the document after converting it from pdf to word file format?
    Regards
    Mike

  • A pdf file is converted to word. Then the word file does not take normal word formatting. Why?

    Having trouble making the converted pdf to word file work properly under word commands and formatting that have worked for me
    well in the past.
    Please help.

    Hi filesneedtowork,
    If you're seeing some jumpy text, or having trouble clicking in where you want, it could be a font issue that's cauing problems. 
    Try choosing Edit > Select All, then Edit > Copy.  Paste the entire contents into either a new Notepad file.  Then repeat the same steps from within Notepad and paste the text into a new Word document. 
    Let us know how it goes.
    Thanks,
    David

Maybe you are looking for