IWorkbook workbook = application.ActiveWorkbook; |
workbook.Activate(); |
using (ExcelEngine excelEngine = new ExcelEngine())
{
application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
_wb = application.ActiveWorkbook;
} |
string value = _wb.Worksheets[0].Range["A1"].Value; |
private void InitializeActiveWorkbook()
{
try
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
_wb = application.ActiveWorkbook;
_wb.Worksheets[0].Range["A1"].Value = "Testing"; // this does not set value to active workbook/worksheet cell.
string str = _wb.Worksheets[0].Range["A1"].Value = "Testing";
_wb.Worksheets.Create("TestWorksheetCreated");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}