Write data to Excel - C# -
i need write data excel sheet , need open after writing it. code using..
object misvalue = system.reflection.missing.value; excel.application xlappenv = new excel.applicationclass(); excel.workbook xlforenv = xlappenv.workbooks.add(misvalue); excel.worksheet xlforenv_view = (excel.worksheet)xlforenv.worksheets.get_item(1); xlforenv_view.name = "pf keys"; xlforenv_view.cells[row, column] = "data";
i write data using above code , when done, save file predefined location using below code..
envsaveloc = envsaveloc + "\\pf keys.xlsx"; xlforenv.saveas(envsaveloc, excel.xlfileformat.xlopenxmlworkbook, misvalue, misvalue, misvalue, misvalue, excel.xlsaveasaccessmode.xlexclusive, misvalue, misvalue, misvalue, misvalue, misvalue); xlappenv.displayalerts = true; xlforenv.close(true, misvalue, misvalue); xlappenv.quit();
the above code working fine requirement program shouldn't save once data written excel sheet, open file in excel , present user. user can review , save himself using file->save option. how can achieve it? data can stored in temporary location presenting user.
what showing excel application window using
xlappenv.visible = true;
this should display excel window data you've written , let user decide how proceed.
Comments
Post a Comment