Problem in copy 2 WORD files to a new WORD file

Hi
I have a problem in copy 2 WORD files to a new WORD file -
i.e. the text of the new WORD file suppose to be composed from the text of the 2 original WORD files.
Unfotunately I get a new WORD file which i can't open, or a file which contains strange simbols in it.
So far i succeded in copy one WORD file to a new WORD file , using - FileOutputStream and FileInputStream, the code is:
import java.io.*;
public class IOStreamDemo {
public static void main(String[] args)throws IOException {
InputStream in2 = new FileInputStream("fruit.doc");
OutputStream out2 = new FileOutputStream("dst2.doc");
// Transfer bytes from in2 to dst
byte[] buf2 = new byte[1024];
int len2;
while ((len2 = in2.read(buf2)) > 0) {
out2.write(buf2, 0, len2);
in2.close();
out2.close();
Does sombody know how to do it properly?
Thanks

dear friend
I just create two word file one is fruit.doc and other
is dst2.doc
after that i write some lines in fruit.doc
then I just execute your code.
after that I open dst2.doc
then I found it as exact copy of fruit.doc
I doesn't get any junk text.
Your code is working absolutely fine.No it is not. Add som styling, headers, index etc to the docuements, and then try to run the code. It's not possible to just append two word documents. You have to parse the files and read relevant information, and then create a new valid document with that information.
/Kaj

Similar Messages

  • LSMW - Problem with copied and edited Project - missing new field

    I have copied an LSMW project to a new Project to load a Journal Entry to FI - Transaction Code FB01.  I added a new field VALUT (value date) to both the Maintain Source Fields and Maintain Field Mapping Steps.  The data with the new field shows up in Display Read Data, but it does not show up in Display Converted Data.  This new field is the last field in the csv file, i added it to the end of the Source fields.
    I think perhaps i need to create a new Batch Input Session, because when i run the Start Direct Input Program, one of the messages that comes up refers back to the original project name - not my renamed Project. --> "Session Name OLD PROJECT NAME was opened"
    (The steps available on my screen do not include a "Create Batch Input Session" step, as some of the posted answers show)
    Thank you for your help.

    Hi Sandra, Thank you for your reply.  I am not sure what you mean by restart.  if you mean go through all the steps- yes, i went through all the steps again. I also exited out of the LSMW screen completely and went back in to my project and redid the read and convert data again, just to be sure, but i am still missing the new field in display converted data. 
    The only change i made to the Project was to change the name of the Project, subproject, and object and to add a field to the Source Fields and Field Mapping - for field mapping i used the default rule of Transfer(move)and my source and code seems to be correct - in that i followed the example of all the other fields.  i also changed the name of the file where my new csv file was located, but i did not change the names of the read and converted data files. Perhaps i need to change something else? It seems to me that it is still using the instructions from the old project to convert the data.  Thanks again.

  • Converting a pdf file to a new pdf file acrobat 9s only creates a ps file.

    Using win7 with adobe acrobat 9 standard. This is a new problew. With a pdf file open, and wanting to create a new pdf file using the print function with Adobe PDF as the prnter, I can no longer "print" the file to a new pdf file. Adobe "print to file" dialog box only provides the file type as a "ps" file. I have been using acrobat 9s without a problem. This is a new issue that just appeared today. See below - it won't allow me to print to a new pdf file. How can this be corrected?

    Make sure the Print to File option in the Print dialog is ticked off.

  • Compress two .jar file into a new .jar file

    Hi all, i would like to ask it there anyone know how to compress two or more .jar file into one new .jar file?
    because i'm currently need to engage with one big project which have to add 34 .jar file into JCreator, so that the relevant classes can be found when compile the code.
    another question is, what is the maximum archive can be add into JCreator? is it limited or unlimited?
    So, any idea from you all?
    Regards,
    poh_cc

    You should probably ask the authors of JCreator about the limitations of it.
    The classloader can't read jars from jars and I would advice against extracting all jars and jar all classes into one big fat jar.
    Kaj

  • Multilingual word game/database with new words (japanese)

    Hi there!
    I guess the subject may be a bit confusing, but let me tell you what I'm looking for.
    I've started learning japanese language. I found the option to use japanese in my MacBook Pro. I want to create a database of new words that I learn using japanese (Hiragana) and Polish language. But I don't want it to be just normal text file or normal database. I want it first of all to be able to search words and then it could have the option to "play" with new words in a way it would help me remember new words (something like flash cards). Does anyone know anything like it?
    I could write it in Java using Mysql but it would take so much time...
    Anyways, one more thing - is there or how to create a shortcut to shitch languages is Tiger 10.4?
    Thanks a lot
    Adam M

    I want it first of all to be able to search
    words and then it could have the option to "play"
    with new words in a way it would help me remember new
    words (something like flash cards). Does anyone know
    anything like it?
    Try doing a google search for "os x language flash cards" .
    Anyways, one more thing - is there or how to create a
    shortcut to shitch languages is Tiger 10.4?
    Command + Space. You can see the info at the bottom of system prefs/international/input menu (input menu shortcuts).

  • Mixing two mp3 files and generating new mp3 file in java

    HI,
    I have problem, I have 2 mp3 files I have some defined times for both file. On particular time i want to mix both mp3 file sound and generate new mp3 file by mixing audio from both files.
    As i am new to mp3 in java , Please guide me from where should i start or any other good suggestion.
    Thanks & Regards
    Akhnukh

    Thanks a lot for ur reply....
    But my actual task is to mix two mp3 files and generate a new file where in i should be able to list the two mp3 files playing simultaniously......
    So can u please help me in writing the j2me code for mixing of two mp3 files.....
    Thank u very much
    Navya

  • Hey there is there anyone that have problems whit Copy/paste, after downloading the new version off Facebook

    i can copy/paste on facebook after the opgarding ios5 on my phone..
    can anybody help me whit that ?

    Sorry to be so late in replying to you but thanks for answering my question but Where do I go for the I-POD TOUCH FORUM? totally new to this game.

  • Having problems with copying the OS X to new SSD - SSD keeps ejecting itself

    I recently bought an OWC 6G Mercury Electra 240GB SSD and a data doubler for my early 2011 MBP. I replaced the MBP's optical drive with the old HDD and installed the SSD to the main HD bay. After erasing&varifying the SSD I started cloning my old system to the SSD. This is when the problems started. The SSD keeps ejecting itself everytime I try to copy something to it or when I try to varify it. My OS X is 10.9.2. Any suggestions would be appreciated. Thanks!

    There is a recall on the 15"
    Apple Recall
    https://www.apple.com/support/macbookpro-videoissues
    Are you using Carbon Copy Cloner or Super Duper? Did you try cloning from an external USB? or to one holding the SSD?
    If the latter is successful, that would point to the SATA cable being faulty.
    It does seem that SSDs are more sensitive to a defects in SATA cables than HDDs are.

  • Title from previous Numbers file printing on new Numbers file

    I have a Numbers 3.2 file that was originally created by duplicating another Numbers file in a previous version of Numbers. When I print this newer file, the title of the other file prints above each table in the file, though this title does not show above each table while I’m working on it, and I can’t find a way to get access to the title. Adding a “Table Name” does not change this situation.
    Any ideas how I can get access to this title? Thanks!
    And why can’t I upload images to illustrate the problem? I’ve tried both jpg and pdf - the “insert image” button remains grayed out after I select the file to upload.

    Hi prismalight,
    Wayne Contello has written a User Tip on how to post a screen shot.
    https://discussions.apple.com/docs/DOC-6591
    If 'Insert Image' is greyed out, Close the Insert Box (red cross on the top right) click on the camera icon again. Camera icon sometimes needs a wake-up call, but works the second time.
    Remove any personal details before taking the screen shot.
    Regards,
    Ian.

  • Do I have to Replace Every Word doc with a New Pages doc?

    Everytime I open an old Word document (I now use Pages exclusively) in Pages, I have to re-save the document as a Pages document. The old Word file stays on my computer, as I'm creating something new, a Pages document. I now am left with two files: the old Word file, and the new Pages file. Is there some sort of "batch" operation, a way to convert ALL my word files on my HD into Pages files?
    Or (more realistically) is there a way to have Pages automatically REPLACE the Word file with the new Pages file, so that I'm left with 1 new file, not 1 old and 1 new.
    Thanks a lot,
    Lee

    The difference between the two files is that one's extension is .doc and the other's is .pages. So, for the Pages document to replace the Word document, it's name would need to be "Testdoc.doc" instead of "Testdoc.pages" as it would normally save. This may cause problems in the future since .doc isn't a Pages document, so that wouldn't be something you'd want to do for documents you intend to keep.
    It seems that Automator would be a good choice for this, but I don't know enough about Automator to be able to say if it can be done or how to do it.

  • Websphere is not loading new properties file

    I am using Websphere Application Server 5.1 on WindowsXP.
    My application is on Struts. I create a war file and deploy it.
    I am getting all the text displayed from ApplicationResources.properites file.
    I changed some key-values in that file..but the websphere is loading the page with old values..
    I thought the problem could be with browser cache..I changed the JSP content to check if it loads the new jsp..It is loading the new jsp..(so the problem is not with cache)but old properties file..
    I uninstalled my application and reinstalled it..stilll it did not work..
    I checked the path "C:\Program Files\WebSphere\AppServer\installedApps\PC560\WMOS_war.ear\WMOS.war\WEB-INF\classes" where my war is getting extracted...
    (so my latest propeties file is available to websphere)
    it is showing the new properties file..but if i see the 'view source' of the page..it is showing old values..
    Is it some kind of optimization of websphere? If it is so, where to change it?
    Thanks

    If that doesn't work, try repackaging your application into a new WAR file, with the new property files, and redeploy it. WebSphere tries to be "clever" and caches/copies files from your application into another folder when you deploy it, and will not look at these files in your application's folder within the "installedApps" folder. I learned this lesson the hard way, when I wasted days trying to understand why WebSphere wasn't recognizing changes made to my web.xml file.

  • I have placed a photoshop file within a new picture and it will not display

    i have placed a psd file within a new psd file and it will not display.  It flashed on the screen for a moment and then disappeared, and no matter how many times I try, it will not show

    I started a new file, placed the image and the screen went into a bizarre pattern. I ended up closing the program and starting fresh and it worked properly.  Something went wonky during the session I guess.

  • Codepage of .hql file in New-AzureHDInsightHiveJobDefinition -File makes a difference

    Put the following contents into a myquery.hql file:
    dfs -copyToLocal /HiveQL/myparameters.hql ;
    source myparameters.hql;
    select * from dim_date where DATE = "${hivevar:beginDate}";
    If you save that .hql file as ANSI, then then the following succeeds. If you save it as UTF8, then the following fails with an error:
    FAILED: ParseException line 1:3 cannot recognize input near 'dfs' '-' 'copyToLocal'
    Here's the PowerShell to run that .hql file.
    $hiveJobDefinition = New-AzureHDInsightHiveJobDefinition -File "/HiveQL/myquery.hql"
    $hiveJobStarted = Start-AzureHDInsightJob -Cluster $appSettings["ClusterName"] -JobDefinition $hiveJobDefinition
    $hiveJobFinished = Wait-AzureHDInsightJob -Job $hiveJobStarted -WaitTimeoutInSeconds 86400
    $stdOut = Get-AzureHDInsightJobOutput -Cluster $appSettings["ClusterName"] -JobId $hiveJobStarted.JobId -StandardOutput
    $stdErr = Get-AzureHDInsightJobOutput -Cluster $appSettings["ClusterName"] -JobId $hiveJobStarted.JobId -StandardError
    Any idea why something so simple as the codepage of the file breaks this? Is it documented anywhere? Is this a bug? Can it be fixed?
    http://artisconsulting.com/Blogs/GregGalloway

    Maheshwar-
    Using the HDInsight tools for Visual Studio 2013, when I create a new Hive Query file, it creates it as UTF8. I don't know if there's a Visual Studio setting to change that or not. Then when I upload that to blob storage (with any Azure storage management
    tool which will just preserve the codepage of the file you upload) and run it using
    New-AzureHDInsightHiveJobDefinition it fails. Changing that file to ANSI before upload will work when run via
    New-AzureHDInsightHiveJobDefinition.
    Yes, that hive query succeeds if run from the Query Console website. Since I'm pasting in the query, I don't think codepage comes into play. It also succeed if I submit it from the HDInsight tools for Visual Studio because I believe those tools convert
    it to ANSI before upload from what I've been able to trace with Fiddler.
    I confirm it's UTF8 not UTF32 or UTF16. I haven't tried those to see if they fail.
    Thanks,
    Greg
    http://artisconsulting.com/Blogs/GregGalloway

  • Ever-expanding file w/ "Deploy to EAR file"

    If I don't delete any pre-existing EAR file in JDeveloper prior to choosing "Deploy to EAR file" for my application, JDeveloper seems to include the existing EAR file in the new EAR file, such that my EAR file grows with each deployment each time, from 60K to 120K to 240K to ... 10, 20 megabytes, etc. I can only get a clean "deploy to ear file" (chosen from right-clicking on the .deploy file in the Navigator) if I first delete the existing ear file. Is there a way to get JDeveloper to not do this, in case I forget to delete from disk first? Thanks.

    I am exporting using the default settings for QT conversion for Broadband high quality. I didn't mess with any settings other than that. Any ideas?

  • A problem with copying text from english pdf to a word file

    i have a problem with copying text from english pdf to a word file. the english text of pdf turns to be unknown signs when i copy them to word file .
    i illustrated what i mean in the picture i attached . note that i have adobe acrobat reader 9 . so please help cause i need to copy text to translate it .

    Is this an e-book? Does it allow for copying? It is possible that the pdf file is a scan of a book?

Maybe you are looking for