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. General Programming
  3. C#
  4. decimal value being truncated when exporting data to excel from asp.net c#

decimal value being truncated when exporting data to excel from asp.net c#

Scheduled Pinned Locked Moved C#
csharpasp-net
6 Posts 4 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.
  • V Offline
    V Offline
    vijju04
    wrote on last edited by
    #1

    Hi, I am dynamically exporting data from asp.net page to excel format which works fine, but when I am exporting a float value 7.0 is being exported as 7 to the excel spread sheet. It is truncating the trailing zero and the decimal point. Thanks,

    vijju

    C P P 3 Replies Last reply
    0
    • V vijju04

      Hi, I am dynamically exporting data from asp.net page to excel format which works fine, but when I am exporting a float value 7.0 is being exported as 7 to the excel spread sheet. It is truncating the trailing zero and the decimal point. Thanks,

      vijju

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I assume there is something wrong with your code. Hard to say what, without seeing it.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • V vijju04

        Hi, I am dynamically exporting data from asp.net page to excel format which works fine, but when I am exporting a float value 7.0 is being exported as 7 to the excel spread sheet. It is truncating the trailing zero and the decimal point. Thanks,

        vijju

        P Offline
        P Offline
        paas
        wrote on last edited by
        #3

        Does a value such as 7.01 also get truncated to 7? If not, and 7.01 shows up as 7.01 in Excel, then this is probably just a case of the default number format in Excel being 'General' which will cause values like 7.0, or 7.00, etc., to show up as 7 in Excel.

        V 1 Reply Last reply
        0
        • V vijju04

          Hi, I am dynamically exporting data from asp.net page to excel format which works fine, but when I am exporting a float value 7.0 is being exported as 7 to the excel spread sheet. It is truncating the trailing zero and the decimal point. Thanks,

          vijju

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          That's likely only a formatting issue in Excel. What happens with non-integer values?

          V 1 Reply Last reply
          0
          • P paas

            Does a value such as 7.01 also get truncated to 7? If not, and 7.01 shows up as 7.01 in Excel, then this is probably just a case of the default number format in Excel being 'General' which will cause values like 7.0, or 7.00, etc., to show up as 7 in Excel.

            V Offline
            V Offline
            vijju04
            wrote on last edited by
            #5

            Only values like 7.0 is being exported into excel as 7. if it is a default number formating, then how do you get around it, and just show the value as it is 7.0 in excel. thanks,

            vijju

            1 Reply Last reply
            0
            • P PIEBALDconsult

              That's likely only a formatting issue in Excel. What happens with non-integer values?

              V Offline
              V Offline
              vijju04
              wrote on last edited by
              #6

              All the values are exported as string. if it is 7.01, it works fine. but if it 7.0, then excel shows it as 7. Thanks,

              vijju

              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