Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to export into Excel in asp.net 1.1 with proper formatting

How to export into Excel in asp.net 1.1 with proper formatting

Scheduled Pinned Locked Moved ASP.NET
helpcsharpswiftasp-netdesign
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jmavn
    wrote on last edited by
    #1

    Hi, I have used the Response method for exporting to excel sheet. The Date field values are displayed not properly . Snapshot of the code which I used: Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel" Response.AddHeader("Content-Disposition", "attachment; filename=""" & strFileName & """") Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Me.EnableViewState = False Dim oStringWriter As New System.IO.StringWriter Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter) Dim a As New System.Web.UI.HtmlTextWriterStyle Excelgrid.RenderControl(oHtmlTextWriter) Dim sExcel As String sExcel &= oStringWriter.ToString() Response.Write(sExcel) Response.End() My requirement is Date to be displayed in dd/MM/yyyy format. But in exported excel sheet, some values are treated as Date and others (it assumes the first 'Date' part as month and if it is greater than 12, it treats as String instead of Date) What way I can solve this problem. Any possibility to formatting the columns in excel thru coding and what else can I do to get the values properly. Expecting ur swift reponse. I need solution for this as soon as possible coz I was dragging with the issue for past 3 days and not find any solution. :(

    Thankfully, jm

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups