Specify Custom Number Decimal and Group Separators for Workbook

Specifying Custom Separators using Microsoft Excel

The following screenshot shows the Advanced Excel Options and highlights the section to specify the Custom Separators.

todo:image_alt_text

Specifying Custom Separators using Aspose.Cells

The following sample code illustrates how to specify the Custom Separators using Aspose.Cells API. It specifies the Custom Number Decimal and Group Separators as dot and space respectively.

C# code to specify custom Number Decimal and Group Separators

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Workbook workbook = new Workbook();
// Specify custom separators
workbook.Settings.NumberDecimalSeparator = '.';
workbook.Settings.NumberGroupSeparator = ' ';
Worksheet worksheet = workbook.Worksheets[0];
// Set cell value
Cell cell = worksheet.Cells["A1"];
cell.PutValue(123456.789);
// Set custom cell style
Style style = cell.GetStyle();
style.Custom = "#,##0.000;[Red]#,##0.000";
cell.SetStyle(style);
worksheet.AutoFitColumns();
// Save workbook as pdf
workbook.Save(dataDir + "CustomSeparator_out.pdf");