0

I need to create a Excel workbook by coping a byte array of data from another Excel work book, what I have so far is as follows, that creates an empty Excel work book

 Application excelApp = new Application();
 Workbook workBook = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
 Worksheet workSheet = (Worksheet)workBook.Worksheets[1];
 workBook.SaveAs(@"C:\temp\exceFile.xlsx");  
 workBook.Close(); 

What I need to do is to copy the contents of byte[] binaryDataOfExcelFile into this workbook

DafaDil
  • 2,463
  • 6
  • 23
  • 33
  • I think you'll need to do some pre-processing of the byte array. A byte array could contain anything, so Excel will need some data structure information to know how to import it correctly. For example, how would Excel know what data should go in each cell? – neontapir Dec 04 '14 at 15:12
  • The byte array is an output by reading another Excel file – DafaDil Dec 04 '14 at 15:13
  • Possible duplicate of http://stackoverflow.com/questions/19314759/save-a-byte-array-to-excel-file. As you can see in the discussion of that question, there's no one method that can accomplish this. – neontapir Dec 04 '14 at 15:16
  • "The byte array is an output by reading another Excel file" - Exactly - the whole file. From the disk. Your file contains data and some excel formatting. – T.S. Dec 04 '14 at 21:20

0 Answers0