Losing leading Zeroes during Excel Download

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
aspsteve
User
Posts: 52

Losing leading Zeroes during Excel Download

Post by aspsteve »

I have some reports which contain some account numbers with leading zeros.

I lose those leading zeros when I download the output to Excel.

Is there anything that can be done about this?


MichaelG
User
Posts: 1110

Post by MichaelG »

Microsoft Excel may format numbers automatically by removing the leading zeroes. You can format the number first in the Row_Rendered server event by adding a leading single quote. For example:

if (IsExport("excel")) {
    Field.ViewValue = "'" + Field.ViewValue; // Prevent formatting by excel
}

Post Reply