Create xls file using com

  • Thread starter Thread starter Eran.Yasso
  • Start date Start date
E

Eran.Yasso

Hi,

Can anyone please tell me how can i create xls file?
i then need to write to it.
I am creating the file using File.Create(file.xls);
but ican't acces the file. i gt error that the file is read only.


TIA,
 
That is because File.Create returns an open stream for creating the
file contents. If you want to write to the file, use this stream. If
you want to write the file separately, simply close and dispose this
stream. Another approach for creating the empty file (2.0 only IIRC)
would be to call File.WriteAllBytes passing in an empty byte-array;
this should create the file (as empty) and close the handle.

Marc
 

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

Back
Top