Hi,
We are trying to replace existing excel functionality related modules which are using ms interop assembly in our project with aspose cells.
So will be needing some help from your team, i will be posting related questions in the same thread as and when i progress on the conversion.
Hope it helps for others too, to have all the related queries in one thread.
To begin with, i have two questions.
1. In interop, we used to explicitly dispose the objects as it was required. So, in aspose should we need to dispose explicitly by calling any methods ? or it’s already handled by your library?
I guess its been handled, but just wanted to confirm once.
Below is the interop code for your reference.
protected void ExitExcelApplication()
{
excelWorkbook.Close(true, missingValue, missingValue);
excelApplication.Quit();
excelWorksheet = null;
excelWorkbook = null;
excelApplication = null;
ReleaseObject(excelWorksheet);
ReleaseObject(excelWorkbook);
ReleaseObject(excelApplication);
}
protected void ReleaseObject(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
obj = null;
}
catch
{
obj = null;
}
finally
{
GC.Collect();
}
}
-
We have a “Application” class object in interop, which is used for
a. To start the excel application,
b. Creating a workbook object and adding worksheets to workbook object
c. Finally disposing the excel object.
Hope, these are not required when using apsose, as your “Workbook” object is sufficient to operate with excel workbook. Let us know if you think otherwise.
Also, it has a property “DisplayAlerts”, which is used to control showing of messages when a macro is running in excel. How aspose will handle such a case?
Say for instance: i am writing a value to a cell which has a macro to check whether it’s numeric or text value and showing some message if it’s a text value using a macro implemenation. In this instance, interop suppresses that message by checking DisplayAlerts property, So how aspose will handle the same/similar scenario? Below is the code for your reference.
Application excelApplication = new Application();
excelApplication.DisplayAlerts = false;
// From microsoft documentation,
// Summary:
// True if Microsoft Excel displays certain alerts and messages while a macro
// is running.
[DispId(343)]
bool DisplayAlerts { get; set; }