Click here to Skip to main content
12,949,700 members (89,171 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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.6K
Updated 23-Apr-13 2:09am
Sandeep Mewara 22-Apr-13 7:52am
Elaborate more on what are you trying to do.

Above code is not creating anything.
navin ks 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 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
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.
navin ks 22-Apr-13 8:01am
i need a xls file in chart folder. i need empty .xls file..
navin ks 22-Apr-13 8:01am
y cant a empty xls file be created?
Dave Kreskowiak 22-Apr-13 8:11am

Just specifying a filename as a string somewhere does not magically create a file at that path.
navin ks 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 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:
navin ks 22-Apr-13 8:24am
thanks to let me know about appending.
navin ks 22-Apr-13 8:24am
is there any simple way to create xls file in a specific folder
Dave Kreskowiak 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,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
Top Experts
Last 24hrsThis month
OriginalGriff 5,749
CHill60 3,380
Maciej Los 2,953
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web01 | 2.8.170524.1 | Last Updated 23 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100