IWorkbook and IWorksheet multithreading

Hey, I am trying to use parallel library to update cells content for a open IWorkbook, I use one thread for each IWorksheet inside the book, but always got error for index out of range issue which must be relative to the thread safe stuff. So I am wondering if multhreading support from syncfusion or not, if yes, can I get some sample code, my code piece like below:
 //iBook opened from byte array already

ExcelTemplateContainer excelTemplateContainer = ExcelDB.GetExcelTemplateContainerFromDatabase(defaultDBParamList, exTemplateID, isForClientDownload);
 var n = iBook.Worksheets.Count - 1;
 var options = new ParallelOptions() { MaxDegreeOfParallelism = 12 };
 Parallel.For(0, n, options, i =>
{
 IWorksheet xlWorkSheet = iBook.Worksheets[i];
 List xCellList = excelTemplateContainer.SheetCellsDictionary[xlWorkSheet.Name].ToList();
UpldateExcelsheetCellContent(xlWorkSheet, xCellList);
});
...........
//the update method here
public static void UpldateExcelsheetCellContent(IWorksheet xlWorkSheet, List xCellList)
{
 foreach (ExcelCell xlcell in xCellList)
{
 IRange xlWorkBookCell = xlWorkSheet.Range[xlcell.CellNumber];
if ((xlcell.AccountID ?? 0) != 0 || !xlWorkBookCell.HasFormula)
 xlWorkBookCell.Value = xlcell.Text;
}
}

Regards,

hope can get some information soon.


1 Reply

SR Sudha Ramachandran Syncfusion Team September 30, 2014 01:18 PM UTC

Hi Fuhai,

Thank you for using Syncfusion products.

Currently XlsIO does not support Multi-threading. Please refer to the Direct-Trac incident 130159, created regarding this query, for further follow up.

Please let us know if you have any queries. 

Regards,

Sudha R


Loader.
Up arrow icon