sasha85
asked on
syntax WriteLine on generating file
i'm need to create xls file:
Dim file_being_created,fso
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
file_being_created= Server.MapPath("text.xls")
Set act = fso.CreateTextFile(file_be ing_create d, true)
act.WriteLine("<html><body >")
act.WriteLine("<table border=""1"">")
act.WriteLine("<tr>")
act.WriteLine("<th nowrap>State</th>")
act.WriteLine("<th nowrap>Abbreviaton</th>")
act.WriteLine("</tr>")
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">California </td>" )
act.WriteLine("<td align=""right"">CA</td>" )
act.WriteLine("</tr>")
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">Ohio</td>" )
act.WriteLine("<td align=""right"">OH</td>" )
act.WriteLine("</tr>")
act.WriteLine("</table></b ody></html >")
' close the object (excel)
act.close
but my real report code is written out of <% %>
means look like html...and when come a plaxe for asp i just open the <%
and closing it again...
is there a way to avoid rewriting all the code into the
act.WriteLine("???")
can't i jus open is some how one time
act.WriteLine("
///
and close it after all my code endes?
Dim file_being_created,fso
Set fso = Server.CreateObject("Scrip
file_being_created= Server.MapPath("text.xls")
Set act = fso.CreateTextFile(file_be
act.WriteLine("<html><body
act.WriteLine("<table border=""1"">")
act.WriteLine("<tr>")
act.WriteLine("<th nowrap>State</th>")
act.WriteLine("<th nowrap>Abbreviaton</th>")
act.WriteLine("</tr>")
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">California
act.WriteLine("<td align=""right"">CA</td>" )
act.WriteLine("</tr>")
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">Ohio</td>"
act.WriteLine("<td align=""right"">OH</td>" )
act.WriteLine("</tr>")
act.WriteLine("</table></b
' close the object (excel)
act.close
but my real report code is written out of <% %>
means look like html...and when come a plaxe for asp i just open the <%
and closing it again...
is there a way to avoid rewriting all the code into the
act.WriteLine("???")
can't i jus open is some how one time
act.WriteLine("
///
and close it after all my code endes?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
wow nice one but still there is repetation of htmlstr and file size also increased 792 bytes to 913 bytes
sory type i mean repetition
ASKER
still...it come's with code on the side...i understand that there is no other way then...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i am going to rewrite 142 rows then...it will be very ugly...my notepad wont like this...:)
can you paste your 142 rows here? May be i cna help you get it quickly and also will show you how to do that very quickly
It's unclear from the question why you are saving this text file. It only really makes sense if it contains dynamic data. What is the source of the data?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i got it all going with office...but i bump into a problem that i havn't thought about..
how can i insert asp codes and functions...if else for while...into act.WriteLine("
?
how can i insert asp codes and functions...if else for while...into act.WriteLine("
?
ASKER
how can i put asp code inside the act.WriteLine?
I would think you should still be able to put asp code inside of your writeline statement, as long as it's all encapsulated by the double quotes and that you watch for double quotes within the strings. the script will treat it like a series of strings, which is what you would want.