Solved

Opening Resource file into Filestream

Posted on 2013-06-17
1
361 Views
Last Modified: 2013-08-08
Hi,

I’ve added a file as a resource to a project.  The file is an Excel document.

I’m trying to use this within the ASPose Cells framework.  Their documentation states it can open a file from a file stream.  However I’m at a complete loss as to how to get from a resource to a file stream?

Does anybody have any snippets they could share?

Here is the code that I have:

//Create a Stream object
FileStream fstream = new FileStream("C:\\book1.xls", FileMode.Open);

//Creating a Workbook object, open the file from a Stream object
//that contains the content of file and it should support seeking
Workbook workbook = new Workbook(fstream);

Open in new window

0
Comment
Question by:andyw27
1 Comment
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39252785
from http://www.aspose.com/docs/display/cellsnet/Opening+an+Excel+File:

//Opening an Excel file as a stream
FileStream fs = File.OpenRead("c:\\book1.xls");

//Loading the Excel file contents into the control from a stream
gridDesktop1.ImportExcelFile(fs);

//Closing stream
fs.Close();
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question