Reputation: 13710
in my VB.NET project I included a word document called PrintOut.doc
as resource (My.Resources.DocumentPrintOut
)
Now the question is how can I convert this resource to a Word.Document
object so that it is possible to open and modify it?
Upvotes: 0
Views: 1564
Reputation: 4889
If you store the Word Doc file into your resources as a binary blob, you should automatically have a function created in your resources.designer.vb file, something like this:
Friend ReadOnly Property MyFile() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("MyFile", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
that will return a byte array containing the complete contents of the file. Just write that Byte array to a file and name it your original DOC filename, and you can then open it via word or do whatever you need to with it.
Upvotes: 1