Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
hi, how can SaveAs an excel file in c# without used of dll or namespace?
		
Posted 22-Jan-13 20:42pm
Comments
hemantrautela at 23-Jan-13 3:15am
   
Your Question is not clear, what do you want Download/Upload or convert database report to excel..???

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello, f_gharavi
 
If the Excel file is just missing the extension "xls" or "xlsx" you can change the extension using C#:
 
Path.ChangeExtension(path, ".xls");
 
* If is not excel, then you need to create an excel file, fill it with your data, according to the specific parser of your data etc.
 
-----------------
If you just want to copy the file to another location and change it's name, use CopyTo:
 
 
    
    string DestinationPath = @"D:\NewFile.xls";
    FileInfo fi = new FileInfo(@"C:\SoureFile.xls");
    
    fi.CopyTo(path2);
    
 

 
Cheers,
Edo
  Permalink  
v2
Comments
f_gharavi at 26-Jan-13 5:27am
   
Thank you for your solution, But I have an excel file and I want read that file by C# code and SaveAs that file in another directory with diferent Name, like I have an excel file in c:\ derive and I want read that with c# and SaveAs that in D:\ drive
Edo Tzumer at 27-Jan-13 0:45am
   
Hi, Gharavi, Added your request to the solution above, Cheers, Edo

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 400
1 Sergey Alexandrovich Kryukov 301
2 Shai Vashdi 240
3 OriginalGriff 155
4 Tadit Dash 135
0 Sergey Alexandrovich Kryukov 9,225
1 OriginalGriff 5,395
2 Peter Leow 4,100
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid