c# create instance of Excel workbook from console application -


i have visual studio solution contains 2 projects (1) c# console application; , (2) c# excel workbook.

the console application creates data, pass workbook.

to have created method in excel workbook project, receives data console application. however, cannot create instance of excel book. @ moment trying:

excel.application excelapplication = new excel.application(); excel.workbook excelworkbook = excelapplication.workbooks.add("mybook.xls");

i hard code path xls file, don't want prefer wrap single .exe

any ideas?

so you're asking how wrap 2 files (an exe , excel file), single exe.

there simple (and clumsy) way of doing revolves around using resources in c#, meaning program have similar following:

  1. take excel file source out of resources, , write file when program run (temporary file)
  2. use current directory + excel temp file name feed worksheet.add method
  3. once edited, store temporary file's data resources of exe.

another possibility be, instead of using temporary file, read stream of bytes directly worksheets.add if supported api (feel free tell me if so).

edit: great tutorial on using resources in c#.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -