3

how to save ms-word docx file using edraw in zk

asked 2013-02-21 11:05:55 +0800

psingh gravatar image psingh flag of India
963 8

As I am using Edraw to save MS word document File.Previously i was using jsp pages to save file in this case I can easily Post my url and save modified file.I am showing below in my code how we were saving my file using jsp.

    function f_saveDocument() {
        if(document.DocumentFrame.IsOpened)         
        {   
            var fileFormat = saveAsFileName.substring(saveAsFileName.lastIndexOf("."));
            if(fileFormat == '.docx') {
                var toUnLockFile = 'MergeTest'+fileFormat;
                var tempFileLocation = document.DocumentFrame.GetTempFilePath(saveAsFileName);
                var tempToUnLockFileLocation = document.DocumentFrame.GetTempFilePath(toUnLockFile);
                document.DocumentFrame.SaveAs(tempFileLocation,12);
                document.DocumentFrame.SaveAs(tempToUnLockFileLocation,12);
                document.DocumentFrame.HttpInit();
                document.DocumentFrame.HttpAddPostFile(tempFileLocation);
                document.DocumentFrame.HttpPost(uploadFileURL);
                document.DocumentFrame.ClearTempFiles();
            }else {
                document.DocumentFrame.HttpInit();
                document.DocumentFrame.HttpAddPostOpenedFile(saveAsFileName);
                document.DocumentFrame.HttpPost("http://localhost:8080/TestApp/PutFile.jsp");
            }

        }
}

In jsp page:

<object classid="clsid:569EB2D6-161D-4AE0-9804-640E724A297A"
        id="DocumentFrame" width="80%" height="100%"
        codebase="http://www.edrawsoft.com/download/edword.cab#version=8,0,0,376">

            <param name="Toolbars" value="-1" >


        <param name="LicenseName" value="30daytrial" >
        <param name="LicenseCode" value="EDWD-3333-2222-1111" >
        <param name="BorderColor" value="15647136" >
        <param name="BorderStyle" value="2" >
   </object>

But in case of zul file, how we have to do this task?

delete flag offensive retag edit

Comments

Hi psingh, is the jsp page only used to handle download, right? it is not necessary place it in a zul file, and you can invoke the javascript function in a zul page.

jimmyshiau ( 2013-03-12 10:13:21 +0800 )edit

@jimmyshiau:It is not Downloading the file.Actually I am opening my file using edraw component in browser and I have to update this file .It is saving the file to server using request after modification done by user .See my below code

psingh ( 2013-03-13 02:06:30 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-03-13 02:09:16 +0800

psingh gravatar image psingh flag of India
963 8

I have used zul instead of jsp file.

  function f_saveDocument() {
        if(document.DocumentFrame.IsOpened)         
        {   
            var fileFormat = saveAsFileName.substring(saveAsFileName.lastIndexOf("."));
            if(fileFormat == '.docx') {
                var toUnLockFile = 'Test'+fileFormat;
                var tempFileLocation = document.DocumentFrame.GetTempFilePath(saveAsFileName);
                var tempToUnLockFileLocation = document.DocumentFrame.GetTempFilePath(toUnLockFile);
                document.DocumentFrame.SaveAs(tempFileLocation,12);
                document.DocumentFrame.SaveAs(tempToUnLockFileLocation,12);
                document.DocumentFrame.HttpInit();
                document.DocumentFrame.HttpAddPostFile(tempFileLocation);
                document.DocumentFrame.HttpPost(uploadFileURL);
                document.DocumentFrame.ClearTempFiles();
            }else {
                document.DocumentFrame.HttpInit();
                document.DocumentFrame.HttpAddPostOpenedFile(saveAsFileName);
                document.DocumentFrame.HttpPost("http://localhost:8080/TestApp/putFile.zul");
            }

        }
}

this file is basically used when I have opened my document in browser and after modifying that document want to save file using HttpServletRequest which is having my modified file.

link publish delete flag offensive edit
-3

answered 2013-03-13 07:49:46 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

You can refer to the following link to render html in the zul page

http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/UI%20Patterns/HTML%20Tags

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-02-21 11:05:55 +0800

Seen: 34 times

Last updated: Mar 13 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More