View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul Hasell Paul Hasell is offline
external usenet poster
 
Posts: 8
Default Loading AxSpreadsheet from a .NET resource

Peter,

Rather than use the root of C: (which is locked down under group policy) I'm
trying to use the Isolated Storage directory hive. However, although I can
create the file I can't get a fully resolved path to it!! Any ideas?

""Peter Huang" [MSFT]" wrote:

Hi

We can add the excel file(e.g. xls) into the project, and in the properties
to change the build action into embedded resources, so that the xls file
will be compiled into the assebmly.

And then we can use he code below to retrieve the xls file and write to
disk for use.

string[] names=Assembly.GetExecutingAssembly().GetManifestR esourceNames();
System.IO.Stream sm =
Assembly.GetExecutingAssembly().GetManifestResourc eStream(names[0]);
byte[] bts = new byte[sm.Length];
FileStream fs =new );
sm.Position = 0;
int i = (int)sm.Read(bts,0,(int)sm.Length);
fs.Write(bts,0,i);
fs.Close();
sm.Close();

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.