本文介绍了如何在Web浏览器中打开docx文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好 我已经制作了一个存储word文件的应用程序,以及PDF IN SQL SERVER。 存储Doc和Docx文件成功。问题是它无法打开Docx文件。 Doc文件成功打开。 请帮助 提前致谢 以下是代码:Hi guysI have made an application that stores word files, and PDF IN SQL SERVER.It stores Doc and Docx files successfully. The problem is that it can nοt open Docx files.Doc files open successfully.Please helpThanks in advanceHere is the code :Private Sub Viewdoc(ByVal Idx As Integer) Kill_proses() System.Threading.Thread.Sleep(500) Dim objNewFileStream As FileStream = Nothing If My.Computer.FileSystem.DirectoryExists(temp) = True Then My.Computer.FileSystem.DeleteDirectory(temp, FileIO.DeleteDirectoryOption.DeleteAllContents) End If My.Computer.FileSystem.CreateDirectory(temp) Try Dim isigroup As DataTable objdata = New GlobalClass isigroup = objdata.QueryDatabase("select * from docu where id=" & id_docx) If isigroup.Rows.Count = 1 Then Dim nama_file As String = isigroup.Rows(0).Item(4).ToString isigroup = objdata.QueryDatabase("Select * from docs where docu_id =" & id_docx) Dim bytes() As Byte Dim imgStream As MemoryStream id_img = isigroup.Rows(0).Item(0) bytes = CType(isigroup.Rows(0).Item(2), Byte()) imgStream = New MemoryStream(bytes) imgStream.Position = 0 objNewFileStream = New FileStream(temp & "/" & nama_file, FileMode.OpenOrCreate, FileAccess.Write) Dim objBuffer(256) As Byte Dim intBytesRead As Integer = imgStream.Read(objBuffer, 0, 256) While intBytesRead > 0 objNewFileStream.Write(objBuffer, 0, intBytesRead) intBytesRead = imgStream.Read(objBuffer, 0, 256) End While If Not imgStream Is Nothing Then imgStream.Close() End If If Not objNewFileStream Is Nothing Then objNewFileStream.Close() wb.Focus() wb.Navigate(New Uri(temp & "\" & nama_file)) End If Catch ex As Exception MsgBox(ex.ToString) End Try End Sub推荐答案 这篇关于如何在Web浏览器中打开docx文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 06:20