Free Support Forum -

Custom Formats

Hi Laurence

I’m dynamically creating custom formats and assiging them them to each cell. For example: excelSheet.Cells[1, 1].Style.Custom = “#,##0.0000”;

The problem occurs when I view the opened excel sheet in the browser. The cells are not immediately reflecting the custom format that I’ve assigned them. If I right-click on each cell and view “Formats Cells…”, I can see that the Custom format has been correctly written and assigned to that cell. Also, if I click on the Formula Bar and then click back into the cell, then the cell immediately reflects the custom format that’s been assigned to it. It’s when the Excel sheet first opens that nothing is happening - it seems to default to a general number pattern. I have to click into the Formula bar and back again into the cell for it to change. Clearly this is not workable for a large spreadsheet.

Any ideas how I can remedy this? Is there some property I have to set to tell Excel to use the custom formats when opening? (The same thing happens if I save the file to disk. I’m using Excel 2000.)

Many thanks


Hi Seamus,

I think you put string to this cell, not a numeric value.

For example:




Number format only takes effect to numeric value.

Thanks Laurence - that did the trick.