Advertisement
Guest User

Excel

a guest
Oct 19th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using (BackgroundWorker bw = new BackgroundWorker())
  2. {
  3.     bw.WorkerReportsProgress = true;
  4.     bw.DoWork += ((s, e) =>
  5.     {
  6.         BackgroundWorker worker = s as BackgroundWorker;
  7.         var export = e.Argument as string;
  8.         var wapp = new Microsoft.Office.Interop.Excel.Application();
  9.         var workbook = wapp.Workbooks.Open(@"c:\temp\nothing.xlsx");
  10.         for (int i = 0; i < 20; i++)
  11.         {
  12.             worker.ReportProgress(i);
  13.             Thread.Sleep(100);                        
  14.         }
  15.                    
  16.     });
  17.  
  18.     bw.ProgressChanged += ((s, e) =>
  19.     {
  20.         progressBar.Value = e.ProgressPercentage;
  21.     });              
  22.     bw.RunWorkerAsync("class");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement