Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Copying range become very slow than copying with Microsoft Interop Service

$
0
0
Hi,
We have a requirement in our project where we are needed to generate reports in EXCEl with huge records.
We mainly concentrate on visualization and speed of report generation.
1.Styling cells(color,bold etc),copying formats( formulas and formats,esp number and date formats)

2.Copying ranges many times.
  1. Inserting page breaks.
I was searching for Open source on web and found closed xml can do almost all above my requirments well.
But I was trying to copy the range in selecting range where my range should be copied.
It was taking more and more time and slower than the Microsoft interp.
Below is the process how I'm doing
 var WorkBook = LoadWorkBook();
            var worksheetTest = WorkBook.Worksheet(5);
            var worksheet1 = WorkBook.Worksheet(1);            
            var worksheet2 = WorkBook.Worksheet(2);
            var worksheet3 = WorkBook.Worksheet(3);
            var worksheet4 = WorkBook.Worksheet(4);           
            var worksheet6 = WorkBook.Worksheet(6);
            var worksheet7 = WorkBook.Worksheet(7);          
            worksheet1.Delete();
            worksheet2.Delete();
            worksheet3.Delete();
            worksheet4.Delete();
            worksheet6.Delete();
            worksheet7.Delete();
            var rangeTocpy=worksheetTest.Range("a" + Convert.ToString(1), "r" + Convert.ToString(12));
            var rangeDestination= worksheetTest.Range("a" + Convert.ToString(1), "r" + Convert.ToString(count + 12));
          
            for (int i = 0; i < 500; i++)
            { 
                    rangeTocpy.CopyTo(rangeDestination);
                    worksheetTest.Cell(count +3, 1).Value ="Row Number"+(i+1);   
                    count += 13;
                rangeDestination= worksheetTest.Range("a" + Convert.ToString(count), "r" + Convert.ToString(count + 12));
            }

            WorkBook.SaveAs(ReportSaveLocaiton);          
Please correct me If the way I'm trying is not so effective.
Currently im using latest version :0.69.1.0 downloaded from this site.
Please update me ASAP.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>