PC Review


Reply
Thread Tools Rate Thread

Create xls file using com

 
 
Eran.Yasso@gmail.com
Guest
Posts: n/a
 
      21st Dec 2006
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,

 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      22nd Dec 2006
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


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a .bat file to create a shortcut on the desktop? Jenny Microsoft Excel Programming 0 19th Sep 2008 02:39 PM
Can not create a new file with File.Create -- throws exception:Access Denied thephatp Microsoft C# .NET 4 30th Mar 2008 03:48 PM
Solution to: Can't create file:.xls. Right click folder you want to create the file in and then click properties on the shortcut menu to check your permissions on this folder Ky_fanatic Microsoft Outlook Discussion 1 8th Dec 2006 06:15 PM
Drag and drop to create a link to a file in a cell of an Excel file paulaugust2003@yahoo.com Microsoft Excel Discussion 2 18th Sep 2005 03:44 PM
Which of your products can be used to create / burn a web to a cd or dvd and also create an autostart file / cd? Windows XP New Users 5 18th Jul 2005 06:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:39 AM.