Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Illegal thread acccess exception when exporting to excel in background thread
posted

Hello,

I get an exception when I use the Infragistics.Excel in background thread.

Version : 2010.2

Code (in bakcground thread)

      worksheet.Rows[0].Cells[0].CellFormat.FillPatternForegroundColor = Colors.Cyan;

Exception:

System.UnauthorizedAccessException was unhandled by user code
  Message=Accès inter-threads non valide.
  StackTrace:
       à MS.Internal.XcpImports.CheckThread()
       à MS.Internal.XcpImports.SystemSetting_GetSystemColor(Int32 colorIndex)
       à System.Windows.SystemColors.GetSystemColor(ColorIndex colorIndex)
       à System.Windows.SystemColors.get_WindowTextColor()
       à Infragistics.Documents.Excel.WorkbookColorCollection.Add(Color color, ColorableItem item)
       à Infragistics.Documents.Excel.WorksheetCellFormatData.set_FillPatternForegroundColor(Color value)
       à Infragistics.Documents.Excel.WorksheetCellFormatProxy.set_FillPatternForegroundColor(Color value)
       à ExcelBgThread.MainPage.bg_DoWork(Object sender, DoWorkEventArgs e)
       à System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
       à System.ComponentModel.BackgroundWorker.OnRun(Object argument)
  InnerException:

You will find a project reproducing the problem in attachment,

Regards,

ExcelBgThread.zip
Parents
No Data
Reply Children
No Data