Reputation:
Earlier I was reading excel file located on file system through Microsoft.Jet.OLEDB.4.0, and that was working fine, But now my client has told me that place excel file into a database table as BLOB column and read that file from that column and hide one workbook by manipulating that memory string directly.
Please help me out from this problem?
Upvotes: 2
Views: 1918
Reputation: 101192
Create a temp with the BLOB contents and replace the BLOB when done.
string fileName = Path.GetTempFileName();
using (var stream = File.OpenWrite(fileName))
stream.Write(blobContents);
// open excel with oledb
// and do your processing
using (var stream = File.OpenRead(fileName))
{
var buffer = new byte[stream.Length];
stream.Read(buffer, 0, stream.Length);
//save blob
}
Upvotes: 1