Appending Data to the MSWord Using java

Hi,
     I need  to append data to the MSWord doc Using a java Program.The data contains both text and image.While appending data the size of the doc is increasing but the data is not Visible.
   I'm using Streams to read and write into the MSWord
doc.
   Can anyone solve this problem and also tell me is there any alternative ie any external jar files are required?
I'm working on Netweaver 2004s ide.
                                              Thanks in Advance,
                                               Venkat

Hi Venkat ,
Try This Code .....!!!!!!!!!!!!!!!!1
import com.linar.jintegra.AuthInfo;
import msword.*;
public class WordExample {
  public static void main(java.lang.String[] args) {
    String oldfilestr = "c:
temp
test.doc";
    try {
      // DCOM authentication: Make sure Nt Domain, Nt User, Nt Password are valid credentials.
      // Uncomment this line if WordExample.java remotely accesses Word:
      // com.linar.jintegra.AuthInfo.setDefault("NT DOMAIN", "NT USER", "NT PASSWORD");
      // Specify host name or IP address of Word machine as parameter if
      // WordExample.java remotely accesses Word.
      // Application doc = new Application("123.456.789.0");
      Application app = new Application();
      java.lang.System.out.println("The version is: " + app.getVersion());
      java.lang.System.out.println("The path is: " + app.getPath());
      app.setVisible(true);   // Nice to see what is happening
      Documents docs = app.getDocuments();
      // For Word 2003, use:
      _Document document = docs.open(
        oldfilestr,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null
      // For Word XP, use:
      // _Document document = docs.open(
      //   oldfilestr,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null,
      //   null
      // For Word 2000, use:
      // _Document document = docs.open(
      //   oldfilestr, // FileName,
      //   null,       // ConfirmConversions
      //   null,       // ReadOnly
      //   null,       // AddToRecentFiles
      //   null,       // passwordDocument
      //   null,       // password template
      //   null,       // revert
      //   null,       // write password document
      //   null,       // write password template
      //   null        // format
      Range rg = document.getContent();
      Find fd = rg.getFind();
      Thread.sleep(2000);
      // Replace (default replaces 1 phrase at a time)
      // For Word XP or 2003, use:
      fd.execute(
        "ow",
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        "igh",
        null,
        null,
        null,
        null,
        null
      // For Word 2000, use:
      // ff.execute(
      //   "ow", // FindText
      //   null,  // MatchCase
      //   null,  // MatchWholeWord
      //   null,  // MatchWildcards
      //   null,  // MatchSoundsLike
      //   null,  // MatchAllWordForms
      //   null,  // Forward
      //   null,  // Wrap
      //   null,  // Format
      //   "igh", // ReplaceWith
      //   null
      Thread.sleep(2000);
      app.quit(new Integer(WdSaveOptions.wdSaveChanges), null, null);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      // Release all the COM objects:
      com.linar.jintegra.Cleaner.releaseAll();
Thanks & Regards,
Venkat

Similar Messages

  • Can I append date to the file name using Bursting

    Hi All,
    I know that we can append date to the file using %y, %m and %d for
    Email
    FTP
    WEBDAV
    But is there any way of appending the date to the file name if I am bursting my file to a shared location.
    I tried that %y, %m and %d but that doesn't work for bursting.
    Please reply
    Thanks,
    Ronny

    If this requirment is for EBS, please refer the following blog
    http://blogs.oracle.com/BIDeveloper/2010/08/xdoburstrpt_passing_parameters.html
    For standalone see the following delivery sql query as example.
    select
    d.department_name KEY,
    'Standard' TEMPLATE,
    'RTF' TEMPLATE_FORMAT,
    'en-US' LOCALE,
    'PDF' OUTPUT_FORMAT,
    'FILE' DEL_CHANNEL,
    'C:\Temp' PARAMETER1,
    d.department_name||'_'||to_char(sysdate,'mmddyyyy')|| '.pdf' PARAMETER2
    from
    departments d
    Thanks
    Ashish

  • How to append child to XML document using Java

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
         <bean name="PinnacleReportsData"
              class="com.hsbc.webapp.report.view.GenericPinnacleReportsViewData"
              singleton="false">
              <property name="headers">
                   <value>Account|Cusip|Description|SecType|Sector|Holding|Price|MarketValue|SettleDate|Yield|SprdUST|AL|CFDur|OAS|ZVolOas|OADur|PrepayDur|VolDur|DV01|DVOAS01|KRDur10Y|PrepayModelCalled|CalcError|CalculationTime</value>
              </property>     
              <property name="noOfRows">
                   <value>20</value>
              </property>     
              <property name="rowdata">
                   <list>
                        <value>AA09b|CMO|8000|8000|62052MAD0|MFPLC_4A 2A 144A||8097|99-27+|5.18|0.25|200|0.00||15||||</value>
                        <value>AA09b|CMO|10000|10000|320277AD8|HASCO 2005 F II-A-2||9958|99-13|5.69|0.13|131|0.02||154|0.000|25|0.001|9864</value>
                        <value>AA09b|CMO|8000|2363|46071LAA8|IMT_03-3G A2||2378|100-01|5.18|0.14|33|0.00||2||||</value>
                        <value>AA09b|CMO|1270|312|40430HDW5|HASCO 2006-O II-A-1||309|99-00|8.98|0.16|5|0.01||3|0.000|1|0.001|296</value>
                        <value>AA09b|CMO|5000|5000|40430HFQ6|HASCO 2006-O M-3||4583|91-15+|8.99|1.16|534|-0.58|-2|-2644|0.016|712|0.080|367625</value>
                        <value>AA74b|ABS|8000|8000|62052MAD0|MFPLC_4A 2A 144A||8097|99-27+|5.18|0.25|200|0.00||15||||</value>
                        <value>AA74b|ABS|10000|10000|320277AD8|HASCO 2005 F II-A-2||9958|99-13|5.69|0.13|131|0.02||154|0.000|25|0.001|9864</value>
                        <value>AA74b|ABS|8000|2363|46071LAA8|IMT_03-3G A2||2378|100-01|5.18|0.14|33|0.00||2||||</value>
                        <value>AA74b|ABS|1270|312|40430HDW5|HASCO 2006-O II-A-1||309|99-00|8.98|0.16|5|0.01||3|0.000|1|0.001|296</value>
                        <value>AA74b|ABS|5000|5000|40430HFQ6|HASCO 2006-O M-3||4583|91-15+|8.99|1.16|534|-0.58|-2|-2644|0.016|712|0.080|367625</value>
                   </list>
              </property>
         </bean>
    </beans>               hi there i have a XML Document above,and i need to append values to the <list> using java.
    i have string values like
         <value>AA74b|ABS|5000|5000|40430HFQ6|HASCO 2006-O M-3||4583|91-15+|8.99|1.16|534|-0.58|-2|-2644|0.016|712|0.080|367625</value>to add, but failing to navigate to the <list>
    any help?

    1. Read the XML file into a DMO object, walk the DOM to find the list, insert your new entry as a child, write the DOM back to a file.
    2. If the XML is not in a file, but in a string, then you can do the same with string input and output.

  • How can we make the ms-word data as read-only using java code?

    How can we make the ms-word data as read-only using java code?

    MVSK wrote:
    By using java code i opened a file in ms-word. But the data i want to display as read-only. that means should not change it.I don't think you can do that. Display pdf documents instead.

  • How to create a table in the file using java code.?

    HI,
    I should export the data from the view objects to a word document. I have done that but I should
    display the data in the form of a table.
    Kindly come up with the necessary information on how to create a table in the file using java.
    Thanks,
    Phani

    Hi, Thank you for responding to my query.
    The below are the details of my code.
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding StudentDetailsContent =
    (DCIteratorBinding)dcBindings.get("StudentView1Iterator");
    OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
    Row currentRow =
    StudentDetailsContent.getRowSetIterator().first();
    Object a[]= currentRow.getAttributeValues();
    int i;
    for(i=0 ;i<=a.length;i++){
    w.write(a.toString());
    w.write(" ");
    w.flush();
    I am usning this coding to achieve the task of exporting data to file.
    I need to display this information in the table that is where I need help from you people.
    Thanks,

  • Append data into the file in application server

    Hi Friends,
    I have an issue where i have a job which has three different stepst for same program. If i run the job the program will create a file in the application server and append the other two steps in the same file without overwriting the file or creating a new file.
    My problem is like its creating three different files in application server for that particular job since it has three steps . Its not appending into one particular file .
    I am using the FM 'Z_INTERFACE_FILE_WRITE' where i have used the pi_append in the exportng parameter . ITs working when i specify the file in local system. It is appending correctly when i run the report normally to apppend into local system.
    But when i schedule a job to append the file in application server its creating three different files.
    Kindly help me if anyone is aware of this issue
    Thanks in advance
    Kishore

    Hi,
    Please use open dataset to write and append files.Please check the logic of Z FM which you are using .
    To open and write into a file  use
    OPEN DATASET FNAME FOR OUTPUT.
    To append data into existing file use
    OPEN DATASET FNAME FOR APPENDING.
    To write into file:
    v_file = file path on application server
      OPEN DATASET v_file FOR output.
      IF sy-subrc NE 0.
    write:/ 'error opening file'.
      ELSE.
       TRANSFER data TO v_file.
      ENDIF.
    CLOSE DATASET v_file.
    For appending :
    OPEN DATASET v_file fOR APPENDING.(file is opened for appending data  position is set to the end of the file).
    Thanks and Regards,
    P.Bharadwaj

  • Who can introduce the development contents of  the project using java  ?

    Hi ,  Web Dynpro experts:
        Could u introduce the working  contents of  the project using java  ?
        1. Do you develop function that would run in a sap standard system(such as CRM ,internet sales)?  OR  develop a  completely independent web application base on client's demand(EJB,JSP,HTML)?
      2.Do all the user interfaces run in web browser ?
        In a word ,I  just want to know  what picture is it as you are using java to work on SAP ,Because I must study AP&JAVA duo to the coming project.  Could you explain  it for me about SAP&JAVA in any perspective according to your project experience .
       BTW: I have 2 years experience on J2EE and 1 year on ABAP. So how i should get started ?

    Hi Guixin,
    The most common structure for building a WebDynPro application is to expose functionality from underlying systems and present it using the WebDynPro UI.  Often the underlying system is a SAP ERP/CRM type system, but can also be any WebService compliant system, or a combination of both. 
    Using the Netweaver System Landscape Directory (SLD), WebDynPro can send and receive data independantly of the source.  SAP ERP/CRM systems will expose their functionality using RFC-enabled BAPIs.  These functions can be standard SAP delivered modules or custom developed using ABAP. 
    The choice of where to develop your business logic really depends on the history/strengths of your organisation.  If you have a strong history of ABAP development in SAP, then it would be recommended to use ABAP for your business logic and WebDynPro for UI.  If J2EE is the strong suit, use that instead. 
    The WebDynPro interface runs in a browser (either IE or Firefox) however there is a beta version of a WebDynPro GUI for Windows which may offer some performance improvements. 
    HTH,
    Jonathan

  • How to read a data from USB port using JAVA

    hi all,
    i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
    Advance Thanks!!

    You can do this. Please use this link
    [http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
    What research did you do of your own? Have you done some testing application and tried yourself??

  • How to Write data in Excel File using java

    Hi
    can anybody help me to write data in excel file
    using java code
    Thankx In Advance

    How much are you willing to pay for that?
    If you want it for free, http://jexcelapi.sourceforge.net/

  • Structure data in the spreadsheet using BEx Query filtered by year

    Hi,
    I´m making a Balanced Scoredcard using Xcelsius and extracting data from SAP BI.   The customer asked to see a few KPI´S (Return on assets and profit margin) filtering data from the dashboard by year,  month and region.
    The problem I´m facing is how to structure the data in the spreadsheet using a query filtered by year variable. 
    Regards,
    Diego

    Hi,
    I´m making a Balanced Scoredcard using Xcelsius and extracting data from SAP BI.   The customer asked to see a few KPI´S (Return on assets and profit margin) filtering data from the dashboard by year,  month and region.
    The problem I´m facing is how to structure the data in the spreadsheet using a query filtered by year variable. 
    Regards,
    Diego

  • Error  when trying to enter data in the textarea using settext in 9.3

    not allowing to enter data in the textfield using settext and throwing below error
    Cause: oracle.forms.handler.TextAreaItem cannot be cast to oracle.forms.handler.TextFieldItem

    I had the same problem.I think this is a bug with 9.3.The workaround I used was to record: click the Text Area,go to Functions menu->edit->Edit,enter the text.Stop recording.Then you can playback.

  • Code for reading the and placing the file using java webservice

    Hi All,
    Can anybody can guide me on how to read a file and place the file using java.
    Let  me know if any code is available which has been completed using java.
    Regards,
    Rahul

    Hi,
    The "square" symbol that you are referring to is probably a CRLF (Carriage Return - Life Feed) Control Character.
    This is more commonly known as a "Enter" at the end of a line / sentence.
    To clean this character from strings in Java, please use:
    String patternStr = "(?m)$^|[\\r\\n]+\\z";
    String replaceStr = " ";
    Pattern pattern = Pattern.compile(patternStr);
    Matcher matcher = pattern.matcher(inputStr);
    return matcher.replaceAll(replaceStr);
    Hope that helps.
    Thanks.
    p256960.

  • How To Update The Registry using Java

    I want to open up the registry and place my Java Application in the Startup using Java.Opening the Registry is done with the use of Exec() now how to add my program in the startup.
    Tx in Advance.
    gomes

    Search the forum - I've already answered similar questions about 10 times.

  • How to open MSWORD using JAVA/JNI and write the database entries into WORD

    Hi..
    I am searching for java codes that uses JAVA NATIVE INTERFACE (JNI) for opening MSWORD 2003.
    To be brief.
    I created HTML form called Employee_data.
    if i click on Submit button a word document should be opened.This should be using JNI.
    I have also created a servlet in jsp to process the form data and store it into database(mysql).;
    Please help me to find the codes to open MSWORD on submit click and to write the database entries into word file.Can i get the full code for that.This is so urgent.
    Thanks in advance.

    Hi Suresh,
    The easest solution I can think of is to copy the math equation from the PowerPoint then paste in the Word document directly, there's actually no way to convert it to plain text, some equation is very complext, String variable is not suitable in this case.
    For example, this code works fine:
    var powerPoint = new Application { WindowState = PpWindowState.ppWindowMinimized };
    var oPresSet = powerPoint.Presentations;
    Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(@"C:\test.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
    var strObj = oPres.Slides[1].NotesPage.Shapes[2].TextFrame2.TextRange.MathZones.get_MathZones();
    strObj.Copy();
    Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
    wordApp.Visible = true;
    Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Add();
    doc.Range(0, 0).Paste();
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to store the data read from excel using java code in Ms access database

    Hi. I wrote a code to read the data from excel. May i know how can i save it to Ms access database using java. Also i have many excels. So i should not connect the database using DSN. So is there any other way to achieve this?

    kramish wrote:
    Im pretty sure that Access does support JDBCNo it does not. It supports ODBC.
    just doing a quick Google came up with some pages:
    http://blog.taragana.com/index.php/archive/access-microsoft-access-database-from-java-using-jdbc-odbc-bridge-sample-code/
    http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html
    Both articles explains how to use the jdbc-odbc bridge. I think I've seen a pure jdbc driver for access but it wasn't from Microsoft and it wasn't free.
    Kaj

Maybe you are looking for

  • Build error after upgrading from 8.2.1 to 8.5 "Error 1055 occurred at Invoke Node..."

    After upgrading to 8.5, I'm getting the following error when trying to build an EXE: Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference: Error 1055 occurred at Invoke

  • MRS (Multi Resource Scheduling) Assignment reporting (POWL)

    We are implementing SAP Multiresource Scheduling (9.0 SP1) for one of our clients.We are working with the MRS RM webrequest application to create the MRS requests and we assign candidates and create assignments in the MRS planning board. We create bo

  • Mapping URI with physical location

    Hi All in my web service, i have one method called getBase() which returns a URI eg: http:://myserver:7001/myapp/data Using this URI my clients are going to upload some file, my intention is that when they upload that file, the file has to be stored

  • Set size of GridLayout item

    Is there any way to set the size of a particular GridLayout item? These are my items... buttonPanel.setLayout(new GridLayout(4,0)); buttonPanel.add(placeBid); buttonPanel.add(checkStatus); buttonPanel.add(quit); buttonPanel.add(imageShow); I would pr

  • New Yahoo mail won't work on New Lion MacBook Pro (?)

    I get a message from Yahoo telling me that by browser isn't compataible with new Yahoo mail - both in Firefox and Safari browers. It was working fine yesterday, but not today. I am therefore being forced to use the old Yahoo mail.