ASP generated CSV file ... need to bold text...

im creating a CSV file on the fly using ASP and SQL, file is created fine and everything looks good. but i would like to bold the "headers" in the created file. anyone have any thoughts on how to go about that? tried to use simple HTML <b></b> tags, but no dice. any help appreciated!
fivezerotwoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fritz_the_blankCommented:
How would bold even  be displayed in a .txt file? Perhaps I don't undersand the question?

FtB
0
fivezerotwoAuthor Commented:
im building a string of comma seperated fields, that get written out to a file that is using the .csv extension... which should be picked up by Excel on most (clients) computers.

im basically just trying to bold the headers, using some "code" that Excel would recognize. im not even sure if this is a possibility, or if its possible with the method im using to create the file. just something that would make the file look a little cleaner. =)
0
hujiCommented:
Yes, we have bold things in Excel but they do not appear in Coma Seperateve files. You need XLS files for that. I myself don't have a good idea on how to export XLS files from ASP now.
Wish I can help
huji
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

fritz_the_blankCommented:
Okay, that is a different problem that at least in theory could have a solution, but I don't believe that such a code existsl

FtB
0
victhetechCommented:
Can you post the part of ASP the code where you tell your server to write the contents to the ASP page? I'm assuming you are using ASP code to extract data from SQL to be posted on an ASP page right? if so please post you code where this action happens on the ASP page. Please explain if I'm missing something
0
fivezerotwoAuthor Commented:
'''' grab and build the comma sep fields ''''
Set rsProof = cnProof.Execute(strSQL2)

'start to build comma seperated string....
'FILE HEADERS
strCommaList = ""
strCommaList = strCommaList & "Client Name, Store Number, Quantity, Display Phone, Display Address, "
strCommaList = strCommaList & "Display City, Store Hours 1, Store Hours 2, Four Color Creative, Gaurenteed Offer Set, "
strCommaList = strCommaList & "C1 Offer Code, C1 Price Point, "
strCommaList = strCommaList & "C2 Offer Code, C2 Price Point, "
strCommaList = strCommaList & "C3 Offer Code, C3 Price Point, "
strCommaList = strCommaList & "C4 Offer Code, C4 Price Point, "
strCommaList = strCommaList & "C5 Offer Code, C5 Price Point, "
strCommaList = strCommaList & "C6 Offer Code, C6 Price Point, "
strCommaList = strCommaList & "C7 Offer Code, C7 Price Point, "
strCommaList = strCommaList & "C8 Offer Code, C8 Price Point, "
strCommaList = strCommaList & "Shiping Company, Shipping Contact, Shipping Address, Shipping City, Shipping State, Shipping Zip, Shipping Phone, "
strCommaList = strCommaList & "Indicia, Indicia 1, Indicia 2, Indicia 3, Indicia 4, Indicia 5, "
strCommaList = strCommaList & "Delivery Date, CSR, Special Instructions " & VbCrLf

count = 1
With rsProof
      Do While Not .EOF
            'FILE DATA
                  strCommaList = strCommaList & .Fields("ClientName") & ", " & .Fields("StoreNum") & ", " & .Fields("Qty") & ", "
                  strCommaList = strCommaList & .Fields("DisplayPhone") & ", " & .Fields("DisplayAddress") & ", " & .Fields("DisplayCity") & ", "
                  strCommaList = strCommaList & .Fields("StoreHours1") & ", " & .Fields("StoreHours2") & ", " & .Fields("FourColorCreative") & ", "
                  strCommaList = strCommaList & .Fields("GaurenteedOfferSet") & ", " & .Fields("C1OfferCode") & ", " & .Fields("C1PricePoint") & ", "
                  strCommaList = strCommaList & .Fields("C2OfferCode") & ", " & .Fields("C2PricePoint") & ", " & .Fields("C3OfferCode") & ", "
                  strCommaList = strCommaList & .Fields("C3PricePoint") & ", " & .Fields("C4OfferCode") & ", " & .Fields("C4PricePoint") & ", "
                  strCommaList = strCommaList & .Fields("C5OfferCode") & ", " & .Fields("C5PricePoint") & ", " & .Fields("C6OfferCode") & ", "
                  strCommaList = strCommaList & .Fields("C6PricePoint") & ", " & .Fields("C7OfferCode") & ", " & .Fields("C7PricePoint") & ", "
                  strCommaList = strCommaList & .Fields("C8OfferCode") & ", " & .Fields("C8PricePoint") & ", " & .Fields("ShipingCompany") & ", "
                  strCommaList = strCommaList & .Fields("ShippingContact") & ", " & .Fields("ShippingAddress") & ", " & .Fields("ShippingCity") & ", "
                  strCommaList = strCommaList & .Fields("ShippingState") & ", " & .Fields("ShippingZip") & ", " & .Fields("ShippingPhone") & ", "
                  strCommaList = strCommaList & .Fields("Indicia") & ", " & .Fields("Indicia1") & ", " & .Fields("Indicia2") & ", "
                  strCommaList = strCommaList & .Fields("Indicia3") & ", " & .Fields("Indicia4") & ", " & .Fields("Indicia5") & ", "
                  strCommaList = strCommaList & .Fields("DeliveryDate") & ", " & .Fields("CSR") & ", " & .Fields("SpecialInstructions") & "" & VbCrLf
            count = count + 1
            rsProof.MoveNext
      Loop
End With



'''' build the file ''''
sDay = Day(Now)
sMonth = Month(Now)
sYear = Year(Now)
sHour = Hour(Now)
sMinute = Minute(Now)
strDateName = sDay & sMonth & sYear & "-" & sHour & sMinute

strLink = strDirectory & strUserID & "_" & strDateName & "_Report.csv"
strLinkToFile = strUserID & "_" & strDateName & "_Report.csv"
strDownloadLink = "<a href=""reports/" & strLinkToFile & """>Download Report Results</a>"

'set fso = CreateObject("Scripting.FileSystemObject")
'set fs = fso.CreateTextFile(strDirectory & strUserID & "_" & strDateName & "_Report.csv", true)
'      fs.writeline(strCommaList)
'      fs.close
'set fs = nothing
'set fso = nothing
0
ALaRivaCommented:
One option, since you are planning on having the people use the file in Excel, is to just stream out an excel file to the user instead.  It'll be much quicker, and you can have you own formatting.

Remember, Excel understands HTML Tables, and inline style formatting, so you could easily do this.

Just an option

-Anthony
0
kolluCommented:
You can build a  HTML with bold tag to headers and export to excel from asp page.You develop separate asp page with
Response.Clear
Response.ContentType = "application/vnd.ms-excel"  
and you database code with Html bold tags.This should work fine
0
fritz_the_blankCommented:
Anthony has a good point there. It is as easy as this (if you bold the table headers it should come over to Excel):

<%
dim strDataPath, strConnectString  
dim objConnection, objRS

'set connection strings for entire application
strDataPath = server.MapPath("Family.mdb")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;"_
                  + " Data Source= " & strDataPath & ";"_
                  + " Mode=Share Deny None;User Id=admin;PASSWORD=;"

if not IsObject("ojbConnection") then
      set objConnection=Server.CreateObject("ADODB.Connection")
      objConnection.ConnectionTimeout = 15
      objConnection.CommandTimeout =  10
      objConnection.Mode = 3 'adModeReadWrite
      if objConnection.state = 0 then
            objConnection.Open strConnectString
      end if
end if


set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Select * from Person", objConnection,3,3

%>
<html>
<body>
<%Response.Clear%>
<%response.ContentType="application/vnd.ms-excel"%>

<%
Response.Write("<Table Border=1 cellpadding=2 cellspacing=2>")
Response.Write("<TR>")
for intCounter = 0  to objRS.Fields.count-1
      Response.Write("<TD>" & objRS(intCounter).Name & "</TD>")
next
Response.Write("</TR>")
for i=1 to objRS.RecordCount
      Response.Write("<TR>")
      for j=0 to objRS.Fields.count-1
            Response.Write("<TD>" & objRS(j).Value & "</TD>")
      next
      Response.Write("</TR>")
      objRS.MoveNext
next
%>
</Table>
</body>
</html>
<%
if objRS.State <> 0 then objRS.Close
set objRS = Nothing
if objConnection.state <> 0 then objConnection.Close
set objConnection = Nothing
Response.End
%>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sciber_dudeCommented:
@ Ftb -

Dont you have to have the following lines right on top of the page?

<%Response.Clear%>
<%response.ContentType="application/vnd.ms-excel"%>

coz it would throw an error.

:) SD
0
AgentSmith007Commented:
fivezerotwo,

Unfortunately, the .csv (comma-seperated values) format does not support text formatting readable by MS Excel. It's simply a means of storing comma seperated values. The above solutions would enable to acheive your goal of applying formatting, however would not meet the criteria of being .csv files.
0
fritz_the_blankCommented:
SD--

I have run the above without problem. When I get a minute, I'll run it again to make certain.

FtB
0
fivezerotwoAuthor Commented:
i think the client is just going to have to deal with out a bold. what i have has been implemented in too many places to try and go back to clean up. wouldve been nice to get the bold in there, but hey, they only pay for so much time. hehehe. thanks to all who responded, im going to split the measly points up. thanks again all!
0
fritz_the_blankCommented:
Glad to have helped, and good luck.

FtB
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.