我的 Access 数据库包含一个 OLE 对象“Microsoft Word 97 - 2003”。这是我尝试将 OLE 对象写入 .doc 文件,并将其显示在 WebBrowser 控件中:
Private Sub LoadBlob(objDataTable As DataTable)
Dim WordBlob() As Byte = Nothing
Dim TrimWordBlob() As Byte = Nothing
Dim FileName As String
Dim objStream As Stream
Try
If objDataTable(0).Item("DescriptionWord") IsNot DBNull.Value Then
WordBlob = CType(objDataTable(0).Item("DescriptionWord"), Byte())
End If
FileName = libGlobal.App_Path & "\temp.doc"
TrimWordBlob = New Byte(WordBlob.Length - 86) {}
Buffer.BlockCopy(WordBlob, 85, TrimWordBlob, 0, TrimWordBlob.Length)
System.IO.File.WriteAllBytes(FileName, TrimWordBlob)
objStream = New MemoryStream(TrimWordBlob)
objStream.Position = 0
Me.wbrDocument.DocumentStream = objStream
Catch ex As Exception
libError.ShowErrorMessage(ex)
End Try
End Sub
Temp.doc 不是有效的 Word 文档,并且 WebBrowser 控件不显示任何内容。你能告诉我我的方式的错误吗?