Open Memory Stream

Oct 12, 2015 at 7:53 AM
Is it possible to open memory stream using Excel-DNA?
Coordinator
Oct 12, 2015 at 8:03 AM
What do you mean?
You have full access to the .NET libraries.

But Excel-DNA is just glue between .NET and Excel. So I'm not sure what you mean with the question.

-Govert



Oct 12, 2015 at 8:06 AM
I am creating an OpenXML Spreadsheet document using:
using (SpreadsheetDocument document = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
Now I want to open the memoryStream.
Coordinator
Oct 12, 2015 at 8:22 AM
Excel-DNA is for making Excel add-ins with .NET.
Are you creating Excel files from some other context, using the OpenXML format? If so Excel-DNA is not obviously useful in you setting.

-Govert



Oct 12, 2015 at 8:27 AM
Edited Oct 12, 2015 at 8:47 AM
I need something similar to:
this.Document = SpreadsheetDocument.Open(memoryStream, false);
Coordinator
Oct 12, 2015 at 10:56 AM
Are you making an Excel add-in?

-Govert
Oct 12, 2015 at 11:57 AM
Yes, I make an Excel add-in. I want to create an Excel document using OpenXML, but I don't want to save it. Instead I want just to open it so the user can save it. For this reason I need to open memorystream in Excel.
Coordinator
Oct 12, 2015 at 12:05 PM
I don't think there's a way to get Excel to open a workbook from an in-memory representation.

You either have to save as a temp file somehow, or built the information in the book using the COM object model.

-Govert
Marked as answer by irusul on 10/12/2015 at 5:27 AM