how to integrate excel file to exe or others ?

B

Boki

Hi All,

My program need to read a excel file, but the problem is that I don't
want to disclose excel file content.

Currently, I pack my exe file and the excel file together for release.

If I want to hide my excel file,

1. Encrypt excel file with a password.
2. Bundle excel file to exe or other format ?

Thank you.

Boki.
 
B

Boki

I don't think thatExcelis built for this use-case.  That is, while you  
could embed theExcelworkbook inside your executable as a binary  
resource, before you can getExcelto use it you would still need to save  
it to disk somewhere.  Note that if your application has access to the  
disk location where you save it, so does the user.

What is theExcelcontent?  Why is it anExcelfile, instead of something  
else?  After all, if you're not going to show the content to the user,  
then presumably you aren't taking advantage ofExcel-specific display  
features.  What ofExcel_are_ you taking advantage of?

There are some file types that .NET can handle directly, such as XML  
(which itself can represent a wide range of data formats).  You may be  
better off embedding the data in your executable as a different format of 
data, than trying to useExcelwhile keeping the data hidden from the user.

Pete

I should say I am using csv file.

I am building my own data, finding a way to protect data but still
free to release application ..

If XML, looks can't encrypt.

Another question, data already in csv format, any easier way to copy &
paste / convert to another format that available to encrypt or bundle
to execution file ?

thank you!

Boki.
 
F

Family Tree Mike

If your data is this sensitive, and you assume the user has Excel, then I
think you might consider using Office objects and building the sheets from
within your app. You can still read your data into your app however you see
fit, and feed the data to Excel. You don't even need to make the Excel app
visible.

This link is rather old, but it was the first search hit, and still
pertains: http://support.microsoft.com/kb/302084
 
B

Boki

That's not an Excel file.



What does that mean?  It's not a valid English sentence and I can't figure  
out what you're trying to say.  If you intend to say that you're unableto  
encrypt an XML file, that's not true.  If you intended to say something 
else, you need to phrase it better.


Any data can be encrypted.  Any data can be embedded as a binary  
resource.  CSV would be no more difficult to "encrypt or bundle" than any  
other data.

Pete

Hi

If XML, looks can't encrypt. ==> If I use XML format, it looks can't
be encrypted. : )

Currently, I am trying to do by a different way:

I added an text file into my workspace, my original method to open an
csv file is as follows:
StreamReader tr = new StreamReader(filename);
Can I read the text file that I added in workspace directly ? ( it
looks can't after I tested it ... )

Thank you.
Boki.
 
B

Boki

You should revisit whatever source you're using to learn/translate to  
English.  You keep using the word "looks" in a way in which it doesn't  
make sense.

Using the rest of the context, I am _guessing_ that you mean adding the  
file to the workspace didn't automatically provide a way for you to read  
the CSV file.  And no, I wouldn't expect it to.  At the very least, you'd  
need to set the file to be copied to your output directory, so it's there 
when you try to open it.  But doing that would require that you always  
copy the file with your executable.  A much better solution would be to 
add the CSV file as a binary resource (see "Properties/Resources" in your 
project), and then read the data from that.

Pete

Hi Pete,

I try this way:

private void button1_Click(object sender, EventArgs e)
{

Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream
("MyClassLib.MyResourceFolder.boki.txt");
StreamReader streamReader = new StreamReader(stream);
String myText = streamReader.ReadToEnd();
textBox1.Text = myText;

}

The "boki.txt" properties is set to Embedded resource already...

Current problem is:

Stream stream = assembly.GetManifestResourceStream
("MyClassLib.MyResourceFolder.boki.txt");

stream will always get null value ...


Thanks.

Boki.
 
B

Boki

Hi Pete,

I try this way:

private void button1_Click(object sender, EventArgs e)
{

Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream
("MyClassLib.MyResourceFolder.boki.txt");
StreamReader streamReader = new StreamReader(stream);
String myText = streamReader.ReadToEnd();
textBox1.Text = myText;

}

The "boki.txt" properties is set to Embedded resource already...

Current problem is:

Stream stream = assembly.GetManifestResourceStream
("MyClassLib.MyResourceFolder.boki.txt");

stream will always get null value ...

Thanks.

Boki.

Hi Pete,

I can access now.... thanks a lot

The MyClassLib.MyResourceFolder should really be my class name... ha..

Thanks.

Boki.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top