Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,52 @@ workbook.DetectDateTimeInValue = False
{% endhighlight %}
{% endtabs %}

N> To display the **$** symbol, apply a currency or accounting number format. Using a number format without any currency symbol does not show any currency symbol in the value.

{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
//Plain number format
sheet.Range["A1"].Number = 100;
sheet.Range["A1"].NumberFormat = "0.00"; //shows 100.00

//Currency format
sheet.Range["A2"].Number = 1234.56;
sheet.Range["A2"].NumberFormat = "$#,##0.00"; //shows $1,234.56

//Accounting format
sheet.Range["A3"].Number = 234;
sheet.Range["A3"].NumberFormat = "_($* #,##0.00_)"; //shows $ 234.00
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Plain number format
sheet.Range["A1"].Number = 100;
sheet.Range["A1"].NumberFormat = "0.00"; //shows 100.00

//Currency format
sheet.Range["A2"].Number = 1234.56;
sheet.Range["A2"].NumberFormat = "$#,##0.00"; //shows $1,234.56

//Accounting format
sheet.Range["A3"].Number = 234;
sheet.Range["A3"].NumberFormat = "_($* #,##0.00_)"; //shows $ 234.00
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Plain Number format
sheet.Range("A1").Number = 100
sheet.Range("A1").NumberFormat = "0.00" 'shows 100.00

'Currency format
sheet.Range("A2").Number = 1234.56
sheet.Range("A2").NumberFormat = "$#,##0.00" 'shows $1,234.56

'Accounting format
sheet.Range("A3").Number = 234
sheet.Range("A3").NumberFormat = "_($* #,##0.00_)" 'shows $ 234.00
{% endhighlight %}
{% endtabs %}

## Number Format Detection Behavior Based on System Culture

In Microsoft Excel, when a value is inserted, the system's culture settings determine whether the value is interpreted as a [Text](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IRange.html#Syncfusion_XlsIO_IRange_Text) or [Number](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IRange.html#Syncfusion_XlsIO_IRange_Number). If it is a valid number according to the current culture, Excel automatically detects and applies a corresponding number format.
Expand Down Expand Up @@ -2126,4 +2172,4 @@ A complete working example to apply rich text formatting in C# is present on [th

The output of the previous code is shown as follows:

![Excel document with rich-text formatting](Working-with-Cell-or-Range-Formatting_images/Working-with-Cell-or-Range-Formatting_img6.jpeg)
![Excel document with rich-text formatting](Working-with-Cell-or-Range-Formatting_images/Working-with-Cell-or-Range-Formatting_img6.jpeg)