Forums Register Login

Opening a File at client

+Pie Number of slices to send: Send
Hello All,

I have this requirement. I have a MS word doucment at Server say. Requiremnet is download this file at client side, open word for edit this file. Then upload it back to server.
Some of the operational constraints are once word is closed uploading should happen automatically. Now do we have any API's to components at client side and keep track of its activites?
Matter is urgent. Advance thanks for any help.
Have a nice day.
with warm regards,
Raghavendra Holla.
+Pie Number of slices to send: Send
Hi!
I just read your posting and was wondering if you have solved that problem? Any hints, help or progress?

Originally posted by Raghavendra Holla:
Hello All,

I have this requirement. I have a MS word doucment at Server say. Requiremnet is download this file at client side, open word for edit this file. Then upload it back to server.
Some of the operational constraints are once word is closed uploading should happen automatically. Now do we have any API's to components at client side and keep track of its activites?
Matter is urgent. Advance thanks for any help.
Have a nice day.
with warm regards,
Raghavendra Holla.


+Pie Number of slices to send: Send
hi andreas,
Download and Upload will be taken by signed applet, which open either socket or via URL to servlet to access the page. Opening the downloaded file is
Process p=Runtime.getRuntime().exec(FileName);
and you can wait for Process to return, check return code and then upload if it is success.
But this approch has many loop holes. What if User just closes file in word, not word application, note that process return only when word application is closed. And what if user has not saved his changes, or saved in some other location.. etc.. which we have not yet got solution.
any help from your side?
+Pie Number of slices to send: Send
Raghavendra, thanks for your reply. I thought of using a Java-COM bridge to open Word (on the client side inside the applet) and pass the word document to it. Every word document could contain a macro that disables the "save as" functionality or you could use the bridge to grey out this button. The user can only use the "save" command. I would like to register the applet as an save-event listener for Word events using the bridge and initiate then the upload within the applet.
Have a look at www.linar.com for such a Java-COM bridge (There are more libs - even free ones, but this one looks well documented)... I am not sure if this bridge is capable of doing all these nasty things - but it would be quite nice...
Does this make sense at all?
Can you please point me to some code that demonstrates your socket or URL to servlet solution?
Thanks in advance and best wishes
Andreas

Originally posted by Raghavendra Holla:
hi andreas,
Download and Upload will be taken by signed applet, which open either socket or via URL to servlet to access the page. Opening the downloaded file is
Process p=Runtime.getRuntime().exec(FileName);
and you can wait for Process to return, check return code and then upload if it is success.
But this approch has many loop holes. What if User just closes file in word, not word application, note that process return only when word application is closed. And what if user has not saved his changes, or saved in some other location.. etc.. which we have not yet got solution.
any help from your side?


+Pie Number of slices to send: Send
Hi andreas,
This below code, downloads the file from, Server and saves it in client m/c, opens word, shows document.
-------------------------------------------------------------
import java.io.*;
import java.net.*;
import java.applet.Applet;

public class WriteClientApplet extends Applet {

public void init()
{
String SourceUrl;
String DestinationPath;
String DestinationUrl;
SourceUrl=getParameter("Downloadfile");
DestinationPath=getParameter("Tempstorage");
DestinationUrl=getParameter("Uploadfile");
System.out.println(SourceUrl+","+DestinationPath);
if(SourceUrl!=null && DestinationPath != null)
{
try{
URL url=new URL(SourceUrl);
URLConnection con=url.openConnection();
FileOutputStream ot=new FileOutputStream(DestinationPath);
BufferedInputStream in=new BufferedInputStream(con.getInputStream());
int n;
while((n=in.read())!=-1)
{
ot.write(n);
}
in.close();
ot.close();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
System.out.println("Executing the application");
Process p=Runtime.getRuntime().exec("winword "+DestinationPath);
int processExit=0;
try
{
processExit=p.waitFor();
if(processExit==0)
{ System.out.println("Success");
}
else
{
System.out.println("Failed!!!");
}

}
catch(InterruptedException e)
{
e.printStackTrace();
}

}
catch(Exception e)
{
e.printStackTrace();
}

}

}

}
-------------------------------------------------------------
+Pie Number of slices to send: Send
Hi Raghavendra,
thanks for the file download functionality. What is wrong with my upload code - or do I have to use sockets?:
[code]
URLConnection con=url.openConnection();
con.setDoOutput(true);
BufferedOutputStream out = new BufferedOutputStream(con.getOutputStream());
FileInputStream it=new FileInputStream(DestinationPath);
int n;
while((n=it.read())!=-1){
out.write(n);
}
[code]
Can you help and what do think about the Java-COM bridge???

Originally posted by Raghavendra Holla:
Hi andreas,
This below code, downloads the file from, Server and saves it in client m/c, opens word, shows document.


+Pie Number of slices to send: Send
Hi...
Can you pls lemme know how you finished your task of opening a Word doc fromt he server and saving it back on the server. I have a requirement to do this task on JSP.
Pls reply to prad_eep0@lycos.com

.Thanks in advance.

Originally posted by Raghavendra Holla:
Hello All,

I have this requirement. I have a MS word doucment at Server say. Requiremnet is download this file at client side, open word for edit this file. Then upload it back to server.
Some of the operational constraints are once word is closed uploading should happen automatically. Now do we have any API's to components at client side and keep track of its activites?
Matter is urgent. Advance thanks for any help.
Have a nice day.
with warm regards,
Raghavendra Holla.

 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2961 times.
Similar Threads
Openning a file at client
Edit Server side word file using java --- vikas
How to write the content from document file to jsp page
Printing a PDF on client side
FileWriter and Stream error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:23:14.