Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#ASP.NET
string newda = System.DateTime.Now.ToString("yyyy-MM-dd HH-mm");
string ttts = Session["username"] + newda;
Session["Filepath"] = "C:/techsoft/chart/" + ttts + ".xls";
File.AppendAllText("C:/techsoft/csv/" + ttts + ".csv", arrre[g] + "," + arrre1[g] + "\r\n");
Posted 22-Apr-13 1:47am
navin ks1.3K
Edited 23-Apr-13 2:09am
v2
Comments
Sandeep Mewara at 22-Apr-13 7:52am
   
Elaborate more on what are you trying to do. Above code is not creating anything.
navin ks at 22-Apr-13 7:56am
   
Session["Filepath"] = "C:/techsoft/chart/" + ttts + ".xls"; this part of code must create a .xls file in chart folder. unfortunately its not created. i dont know why. code is too large to post here
ThePhantomUpvoter at 23-Apr-13 8:14am
   
That is because, as you have already been told, that is just assigning a string to a session variable. You are not actually creating a file anywhere for .xls.

1 solution

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

Solution 1

Your code is just writing a bunch of text to a .CSv file. It doesn't appear to be doing anything with an XLS file.
 
So, the to your question of "Why?" is because you didn't write any code to do it.
  Permalink  
Comments
navin ks at 22-Apr-13 8:01am
   
i need a xls file in chart folder. i need empty .xls file..
navin ks at 22-Apr-13 8:01am
   
y cant a empty xls file be created?
Dave Kreskowiak at 22-Apr-13 8:11am
   
BECAUSE YOU DIDN'T WRITE ANY CODE TO CREATE THE FILE! Just specifying a filename as a string somewhere does not magically create a file at that path.
navin ks at 22-Apr-13 8:13am
   
File.AppendAllText("C:/techsoft/csv/" + ttts + ".csv", arrre[g] + "," + arrre1[g] + "\r\n"); this part of code creates .csv file. how?
Dave Kreskowiak at 22-Apr-13 8:19am
   
Are you elephanting kidding me?? Do you have ANY idea at all how File.AppendAllText works or even what it's used for?? If not, I suggest you try reading the documentation on it: http://msdn.microsoft.com/en-us/library/ms143356.aspx
navin ks at 22-Apr-13 8:24am
   
thanks to let me know about appending.
navin ks at 22-Apr-13 8:24am
   
is there any simple way to create xls file in a specific folder
Dave Kreskowiak at 22-Apr-13 10:15am
   
"Simple" is a subjective term. What's simple for me may be impossible to understand for you. I therefor refer you to https://www.google.com/#output=search&sclient=psy-ab&q=create+xls+file+in+vb.net&oq=create+xls+file&gs_l=hp.3.0.0i20j0l3.11571.13511.0.14966.15.10.0.5.5.0.178.1271.4j6.10.0...0.0...1c.1.9.psy-ab.ziTDe8sPjVI&pbx=1&bav=on.2,or.r_qf.&bvm=bv.45512109,d.aWM&fp=78381bbe686eaba4&biw=1920&bih=1105

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 Shai Vashdi 576
1 OriginalGriff 183
2 Tadit Dash 170
3 Sergey Alexandrovich Kryukov 156
4 Peter Leow 130
0 Sergey Alexandrovich Kryukov 9,325
1 OriginalGriff 5,473
2 Peter Leow 4,150
3 Maciej Los 3,540
4 Abhinav S 3,333


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