Hi,
I am looking to convert a system currently using MS Excel to using Aspose.Excel instead.
I’m pretty sure this will result in a major performance gain however it’ll take more than my word to convince others! With that in mind I’ve been trying to develop some side-by-side examples of C# classes carrying out the same functions on excel spreadsheets using Aspose.Excel and MS Excel’s object model.
One example of a method I am using is this one, to populate 200 columns:
//Populates a fixed number of cells with integers,
//used for performance measurement
public void populateList(Excel theExcel)
{ Cell currentCell;
for(int i = 1;i<200;i++)
{ currentCell = theExcel.Worksheets[0].Cells[“B”+i];
currentCell.PutValue(i);
}
}
This is called in a main method like so:
//Declare an instance of this class.
BasicAsposeOps ops = new BasicAsposeOps();
//Create a new aspose excel object
Excel excel1 = new Excel();
ops.populateList(excel1);
bool hasSaved = false;
try
{ //Save the excel file as AsposeExample.xls
excel1.Save(@“C:\Visual Studio Projects\AsposeExample.xls”, FileFormatType.Default);
hasSaved = true;
}
catch(Exception e)
{ Console.WriteLine(“Error” + e);
}
if(hasSaved)
{ //This opens the new file in MS Excel
try
{ ProcessStartInfo psi = new ProcessStartInfo(@“C:\Visual Studio
Projects\AsposeExample.xls”);
Process.Start(psi);
}
catch (Exception e)
{ Console.WriteLine(“Error” + e);
}
}
What I was hoping you could help me with is to implement some kind of performance metric, I am a Java programmer and was thinking that timers used in Java could be useful but being a C# newbie I don’t know how it is done in that language, or if there are better alternatives.
I know this is more of a programming question than an aspose question, but any insights you could give me would be greatly appreciated, thanks.
(By the way, and I’m really pushing my luck here, but does anyone know how I could write the populateList method using MS Excel object model? Its so much harder to use than aspose I can’t get my head round it)