We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

IWorkbook and IWorksheet multithreading

Thread ID:

Created:

Updated:

Platform:

Replies:

117315 Sep 26,2014 12:29 AM Sep 30,2014 09:18 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Fuhai Li
Asked On September 26, 2014 12:29 AM

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.


Sudha Ramachandran [Syncfusion]
Replied On September 30, 2014 09:18 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;