开发者

.NET: Import Excel files, which are a embedded in a resource file, into a dataset

I have a resource file with some embedded Excel files. How can I import these files into datasets? I found sev开发者_开发问答eral libraries / code snippets which works for files, which are on the harddisk, but nothing if the files are part of a resource file.


You can get the file as a stream with ResourceManager.GetStream() and pass it to the "open" function in your favorite library to process Excel files. They usually support open(Stream) methods, if not, you should write the stream in a temporary file...

To dump the excel lines as records in a dataset: loop into the excel rows and insert a new record by line with the desired correspondency between excel columns and datatable columns.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜