以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- web.Address得到的是一串非汉字内容,要怎么转换为汉字呢? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=177480) |
||||
-- 作者:cnsjroom -- 发布时间:2022/5/24 11:25:00 -- web.Address得到的是一串非汉字内容,要怎么转换为汉字呢? Dim web As WinForm.WebBrowser = e.Form.Controls("WebBrowser1") web.ShowSaveAsDialog MessageBox.Show(web.Address) 得到的内容如下: file:///C:/Users/Administrator/%E6%A1%8C%E9%9D%A2/%E5%B7%A1%E5%AF%9F%E5%8A%9E%E4%B8%9A%E5%8A%A1/%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E7%93%AE%E5%AE%89%E5%8E%BF%E5%AE%89%E5%85%A8%E7%94%9F%E4%BA%A7%E2%80%9C%E6%89%93%E9%9D%9E%E6%B2%BB%E8%BF%9D%E2%80%9D%E4%B8%93%E9%A1%B9%E8%A1%8C%E5%8A%A8%E5%B7%A5%E4%BD%9C%E6%96%B9%E6%A1%88%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5(1).pdf |
||||
-- 作者:有点蓝 -- 发布时间:2022/5/24 11:36:00 -- Dim s As String = "file:///C:/Users/Administrator/%E6%A1%8C%E9%9D%A2/" msgbox(UrlDecode(s))
|
||||
-- 作者:cnsjroom -- 发布时间:2022/5/24 11:56:00 -- 回复:(有点蓝)Dim s As String = "file:///C:/User... 先在web控件中打开了word并修改了文件,然后执行另存文件按钮代码如下: Dim web As WinForm.WebBrowser = e.Form.Controls("WebBrowser1") web.ShowSaveAsDialog vars("webfl")=web.Address 对应保存的文件是修改后的文件内容,然后再执行如下代码进行静默上传新版文件! 【当前上传可以完成,但是上传的文件内容还是另存之前的文件内容(vars("webfl")得到的是另存为之前的文件路劲,怎么对应获取得到的是另存之后的文件路劲呢?】 Dim fl As String = UrlDecode(vars("webfl").Replace("file:///","")) Dim r As Row = Tables("知识库_table2").AddNew() Dim wjm="[" & Format(Date.Now, "yyyyMMddHHmmss") & "]" & FileSys.GetName(fl) Dim Multi As String = wjm Dim Values() As String Values = Multi.split(".") For Index As Integer = 0 To Values.Length - 1 r("文件名") = Values(0) \'写入文件名 r("文件类型") = Values(1) \'写入文件名 Next r("uuid")=Guid.NewGuid.TOstring() r("主表uuid")=Tables("知识库_table1").Current("uuid") r.Save \'必须先保存 r.DataRow.SQLInsertFile("附件",fl) \'插入文件 r.DataRow.SQLSetValue("CRC值", CRCCheckFile(fl)) \'保存crc检验值
|
||||
-- 作者:有点蓝 -- 发布时间:2022/5/24 12:01:00 -- https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.forms.webbrowser.showsaveasdialog?redirectedfrom=MSDN&view=netframework-4.0#System_Windows_Forms_WebBrowser_ShowSaveAsDialog ShowSaveAsDialog保存为其它文件了吧。web.Address是最初加载的文件
|
||||
-- 作者:cnsjroom -- 发布时间:2022/5/24 12:28:00 -- 回复:(有点蓝)https://docs.microsoft.com/zh-cn/d... 是的 有没有办法获取另存后的文件进行上传呢? 或者不用类似的web控件另存为方式 当前修正为如下:【对应的文件没有保存,红色部分代码弹出的值是符合预期的,但是对应的文件没有保存,有什么办法修正呢?使得当前web控件里面的文件保存到对应选择的目录和名称】 Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "word文件|*.docx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 MessageBox.Show("你要保存为:" & dlg.FileName,"提示") \'提示用户选择的文件 \'Dim fl As String = UrlDecode(vars("webfl").Replace("file:///","")) Dim fl As String = dlg.FileName Dim r As Row = Tables("知识库_table2").AddNew() Dim wjm="[" & Format(Date.Now, "yyyyMMddHHmmss") & "]" & FileSys.GetName(fl) Dim Multi As String = wjm Dim Values() As String Values = Multi.split(".") For Index As Integer = 0 To Values.Length - 1 r("文件名") = Values(0) \'写入文件名 r("文件类型") = Values(1) \'写入文件名 Next r("uuid")=Guid.NewGuid.TOstring() r("主表uuid")=Tables("知识库_table1").Current("uuid") r.Save \'必须先保存 r.DataRow.SQLInsertFile("附件",fl) \'插入文件 r.DataRow.SQLSetValue("CRC值", CRCCheckFile(fl)) \'保存crc检验值 End If [此贴子已经被作者于2022/5/24 12:49:00编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2022/5/24 13:40:00 -- 试试这种方法,直接保存,不要另存 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=89515
|
||||
-- 作者:cnsjroom -- 发布时间:2022/5/24 13:59:00 -- 回复:(有点蓝)试试这种方法,直接保存,不要另存ht...
全局代码: Public axWebBrowser As Object Public Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) axWebBrowser = sender.ActiveXInstance End Sub 打开word文件代码:【打开之后并不能编辑和保存,麻烦老师指导下如何编辑与保存呢?】 axWebBrowser = Nothing Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter = "word文件|*.doc" If dlg.ShowDialog = DialogResult.OK Then \'如果用户单击了确定按钮 Dim web As Object = e.Form.Controls("WebBrowser1").basecontrol web.Navigate(dlg.FileName) Do Until axWebBrowser IsNot Nothing Application.DoEvents Loop Dim oDocument As object = axWebBrowser.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser, Nothing) Dim oApplication As object = axWebBrowser.Gettype().InvokeMember("Application", System.Reflection.BindingFlags.GetProperty, Nothing, oDocument, Nothing) oApplication.ActiveWindow.DocumentMap = false oDocument.Protect (Password:="123456", NoReset:=False, Type:= _ MsWord.WdProtectionType.wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False) oDocument.saved = True vars("doc") = oDocument End If [此贴子已经被作者于2022/5/24 13:59:55编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2022/5/24 14:15:00 --
|
||||
-- 作者:cnsjroom -- 发布时间:2022/5/24 14:45:00 -- 回复:(有点蓝)[upload=zip,webbrowser控制word_测试... 有点蓝老师 如果我将文件类型新增excel后 发现可以打开excel文件,但是无法保存,有没有办法可以实现对应的保存呢? Dim oDocument As Object = axWebBrowser.Gettype().InvokeMember("Document", System.Reflection.BindingFlags.GetProperty, Nothing, axWebBrowser, Nothing) oDocument.save() 保存时,有没有办法同步output出保存的文件位置呢? [此贴子已经被作者于2022/5/24 14:58:52编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2022/5/24 15:48:00 -- 就是web.Address |