Export CSV Excel XP error

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Export CSV Excel XP error

  1. #1
    Join Date
    Dec 1969
    Posts
    5

    Default Export CSV Excel XP error

    I am now developing ASP program that can export a table to an Excel file (CSV) by using the following code.<BR><BR>Response.ContentType = "application/csv"<BR>Response.AddHeader "Content-Disposition", "filename=stock_balance.csv;"<BR><BR>Some user using Excel 2000 work fine but if using Excel XP, the report become the HTML code, not the report itself.<BR><BR>Do I miss something in the code, or, I need to set something in the Excel XP or the Browser?<BR><BR>Please help!

  2. #2
    Join Date
    Dec 1969
    Posts
    19,082

    Default RE: Export CSV Excel XP error

    &#062; Some user using Excel 2000 work fine but if using Excel XP, the report become the HTML code, not the report itself. <BR><BR>can you clarify that? are you saying you&#039;re outputting HTML? why not output CSV?<BR><BR>I use Excel XP with no problems whatsoever<BR><BR><BR>j<BR>http://rtfm.atrax.co.uk/

  3. #3
    Join Date
    Dec 1969
    Posts
    5

    Default RE: Export CSV Excel XP error

    Thanks for your reply!<BR>Yes, outputting HTML code at Excel XP.<BR><BR>For example, user using Excel 2000:<BR><BR>John $1000 ClassA<BR>Mary $2999 ClassC<BR>Sam $2000 ClassB<BR><BR>However, when user using Excel XP:<BR><BR>&#060;html&#062;<BR>&#060;head&#062;<BR >&#060;title&#062;Untitled Document&#060;/title&#062;<BR>&#060;meta http-equiv="Content-Type" content="text/html; charset=big5"&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body&#062;<BR>&#060;table width="500" border="0" cellspacing="0" cellpadding="0"&#062;<BR> &#060;tr&#062;<BR> &#060;td&#062;John&#060;/td&#062;<BR> &#060;td&#062;$1000&#060;/td&#062;<BR> &#060;td&#062;ClassA&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td&#062;Mary&#060;/td&#062;<BR> &#060;td&#062;$2999&#060;/td&#062;<BR> &#060;td&#062;ClassC&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td&#062;Sam&#060;/td&#062;<BR> &#060;td&#062;$2000&#060;/td&#062;<BR> &#060;td&#062;ClassB&#060;/td&#062;<BR> &#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;

  4. #4
    Join Date
    Dec 1969
    Posts
    19,082

    Default RE: Export CSV Excel XP error

    &#062; Yes, outputting HTML code at Excel XP.<BR><BR>then don&#039;t. output CSV not HTML<BR><BR>the fact that XL 2k can handle it doesn&#039;t mean other spreadsheets can (or should). If you&#039;re telling a spreadsheet it&#039;s a CSV document, chances are it expects a CSV document.<BR><BR><BR>j<BR>http://www.readthe****ingmanual.co.uk/


  5. #5
    Join Date
    Dec 1969
    Posts
    5

    Default RE: Export CSV Excel XP error

    Sorry, I dont understand.<BR><BR>Can you give me some example.<BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    19,082

    Default RE: Export CSV Excel XP error

    HTML looks like this<BR><BR>&#060;table&#062;<BR>&#060;tr&#062;&#0 60;td&#062;value&#060;/td&#062;&#060;td&#062;anotherValue&#060;/td&#062;&#060;td&#062;morevalue&#060;/td&#062;&#060;/tr&#062;<BR>&#060;tr&#062;&#060;td&#062;1&#060;/td&#062;&#060;td&#062;2&#060;/td&#062;&#060;td&#062;5&#060;/td&#062;&#060;/tr&#062;<BR>&#060;tr&#062;&#060;td&#062;3&#060;/td&#062;&#060;td&#062;4&#060;/td&#062;&#060;td&#062;5&#060;/td&#062;&#060;/tr&#062;<BR>&#060;/table&#062;<BR><BR>CSV looks like this<BR><BR>value, anothervalue, morevalue<BR>1,2,5<BR>3,4,5<BR><BR><BR>see the difference? HTML is not the same as HTML<BR><BR><BR>j<BR>http://www.readthe****ingmanual.co.uk/<BR>

  7. #7
    Join Date
    Dec 1969
    Posts
    19,082

    Default I'll rephrase that last bit :

    &#062; see the difference? HTML is not the same as HTML<BR><BR>should read<BR><BR>see the difference? HTML is not the same as CSV

  8. #8
    Join Date
    Dec 1969
    Posts
    5

    Default RE: I'll rephrase that last bit :

    Yes, I understand now. I need to change "ALL" of the following<BR><BR>&#060;table width="600" border="0" cellspacing="0" cellpadding="0" &#062;<BR> &#060;tr&#062; <BR> &#060;td width="100"&#062;&#060;%= rs01("name") %&#062;&#060;/td&#062;<BR> &#060;td width="100"&#062;&#060;%= rs01("price") %&#062;&#060;/td&#062;<BR> &#060;td width="100"&#062;&#060;%= rs01("class") %&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR><BR>To <BR><BR>&#060;% response.write(rs01("name") & "," & rs01("price") & "," & rs01("class")) %&#062;<BR><BR>because of the Excel XP cannot ignore the HTML code. ha...

  9. #9
    Join Date
    Dec 1969
    Posts
    19,082

    Default don't forget the end-of-line

    &#060;%= (rs01("name") & "," & rs01("price") & "," & rs01("class") & vbcrlf) %&#062;

  10. #10
    Join Date
    Dec 1969
    Posts
    5

    Default RE: don't forget the end-of-line

    Do somebody know any other method instead of changing all the code to non-html format (CSV format) and also work fine in both Excel 2000 and XP?<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •