Embedding a word file as a resource

左心房为你撑大大i 提交于 2020-01-02 23:04:16

问题


I am trying to access a word file from my c# code. I want to embed it as part of a project so that when i call a word doc object to be read from an aspx page, the object should have access to that word doc no matter where it is being used from. So how can i include a word doc as a resource in my project? Also in order to open my word doc, i need a path for that doc. After i have included the file as a resource, how do i somehow get its "path" so the word doc object can be created? Is there someway to copy it over to a temp location on whatever machine is calling that object?

Thanks


回答1:


Note: Do not use MSWord in server environment.

How to embed file as resource

After getting the stream use Stream.CopyTo to save it to FileStream created on temporary file Path.GetTempFileName or in temp folder .



来源:https://stackoverflow.com/questions/9726968/embedding-a-word-file-as-a-resource

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!