如何在用户设备中保存word文件 [英] How to save word file in user device

查看:91
本文介绍了如何在用户设备中保存word文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..

i有一个想法,我想让用户从他的设备中选择word文件,然后在他的设备中再次保存。



i这样做但它在当地工作,我想要



我尝试过:



hello ..
i have an idea and i want to let user to select word file from his device, then SaveAs again in his device.

i do it but it is working local, which i want to

What I have tried:

Dim objWordApp As Word.Application
           objWordApp = New Word.Application
           Dim objDoc As Word.Document

           objWordApp.Documents.Open(file)
           objDoc = objWordApp.ActiveDocument



           Dim SaveDestination As String = "D:\NewWordFile.docx"
           objWordApp.Documents.Item(1).SaveAs(SaveDestination )

           objWordApp.Documents.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
           objWordApp.Quit()
           objWordApp = Nothing

推荐答案

你不能这样做。



VB代码在服务器上运行,而不是客户端,它出现在开发中工作,因为它们都是同一台机器。在生产中,它们可能相距数千公里,并且您的服务器代码无法在客户端计算机上运行任何内容(除了JavaScript),也无法直接访问客户端文件系统以进行读取或写入访问。



将文件传输到客户端的唯一方法是下载它,然后客户端浏览器将决定显示,忽略,丢弃极端偏见,或保存文件;在哪里得救;如果用户必须允许保存它。
You can't do it.

VB Code runs on the Server, not the Client, and it appears to work in development because they are both the same machine. In production, they may be thousands of kilometers apart, and your Server code cannot run anything (other than JavaScript) on the client computer, nor does it have any direct access to the Client filesystem for read or write access.

The only way to transfer a file to the Client is to download it, and then the Client Browser will decide to show, ignore, discard-with-extreme-prejudice, or save the file; where it is to be saved; and if the user must give permission to save it.


这篇关于如何在用户设备中保存word文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆