Export to excel formatting

  • Hello,

    i have to export some % values like 0.26% or 99.45% to excel which is now sent as text to excel.

    how to format it automatically while exporting? else the user has to change it to % value before he uses the data.

    Thanks in advance.

    Regards
    Durai Nagarajan

  • Hello,

    I'm not exactly sure how to format it in Visual Studio, but an easy way to do it is convert the 'text' to 'number' in your syntax. The code will be different depending on what type of database you're using (Orcale, SQL Server, etc). Here's an Oracle example that I've used in the past...

    to_number(REGEXP_REPLACE(REGEXP_REPLACE(b.value,'[a-zA-z]',''),',',''))) as "Population"

    In this code, a.value is stored as text, and this code converts it to a number.

    This will definitely work, but I bet there's a way to do it in VS.

    Hope this is helpful.

  • hello,

    thsi is what i am using

    "=IIF(IsNumeric(Fields!units.Value), Formatpercent(Fields!units.Value / Fields!Total.Value,2 ), Formatpercent(0,2 ))"

    hope formatpercent cannot be converted to decimal.

    kindly help

    Regards
    Durai Nagarajan

  • Is that the code you're using in your dataset query pane?? Or the code your using in our layout pane?? Either way, I'm curious to know if it works, please let me know!

    Thanks

    Mike

  • Hello,

    this is in report layout not in dataset.

    Regards
    Durai Nagarajan

  • Hello,

    can i get help on this?

    Regards
    Durai Nagarajan

  • I would make a small macro in Excel which will format the cell.

    Selection.NumberFormat = "0.00%"

    /Gosta

  • how can i embed the macro embedded excel while exporting.

    Regards
    Durai Nagarajan

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply