Ange anpassade decimal och grupptalsavskiljare för arbetsboken

Ange anpassade avskiljare i Microsoft Excel

Följande skärmbild visar Avancerade Excel-alternativ och markerar avsnittet för att ange Anpassade avskiljare.

todo:image_alt_text

Ange anpassade avskiljare med Aspose.Cells

Följande exempelkod illustrerar hur man anger anpassade avskiljare med Aspose.Cells API. Det specificerar anpassade decimal- och grupptalsavskiljare som punkt och mellanslag respektive.

C#-kod för att ange anpassade decimal- och grupptalsavskiljare

// 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");