I want to convert an excel file to an image (every format is ok) programmatically (c#). Currently I\'m using Microsoft Interop Libraries & Office 2007, but it does not s
Because asp.net thread does not have the right ApartmentState to access Clipboard Class, so you must write code to access Clipboard in new thread. For example:
private void AccessClipboardThread()
{
// access clipboard here normaly
}
in main thread:
....
Excel.Range range = sheet.get_Range(startRange, endRange); //Save range image to clipboard
Thread thread = new Thread(new ThreadStart(AccessClipboardThread));
thread.ApartmentState = ApartmentState.STA;
thread.Start();
thread.Join(); //main thread will wait until AccessClipboardThread finish.
....