Enum SignificantDigitsType

SignificantDigitsType enumeration

Represents the type of significant digits for outputting numeric values.

public enum SignificantDigitsType

Values

NameValueDescription
Digits15015-digits
G17117-digits by formatting the value with “G17”.
Rounding17217-digits by rounding the value.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class CellsClassSignificantDigitsTypeDemo
    {
        public static void Run()
        {
            try
            {
                // Create a new workbook for demonstration
                Workbook workbook = new Workbook();
                Worksheet worksheet = workbook.Worksheets[0];

                // Demonstrate using each SignificantDigitsType enum value
                SignificantDigitsType[] types = {
                    SignificantDigitsType.Digits15,
                    SignificantDigitsType.G17,
                    SignificantDigitsType.Rounding17
                };

                foreach (SignificantDigitsType type in types)
                {
                    // Set the significant digits type for the workbook
                    workbook.Settings.SignificantDigitsType = type;

                    // Display the current setting
                    Console.WriteLine($"Current SignificantDigitsType: {type} (Value: {(int)type})");

                    // Add a sample value to demonstrate the setting
                    worksheet.Cells["A1"].PutValue(123.4567890123456789);

                    // Save the workbook with the current setting
                    string fileName = $"SignificantDigitsType_{type}.xlsx";
                    workbook.Save(fileName);
                    Console.WriteLine($"Workbook saved with {type} setting as {fileName}");
                }

                Console.WriteLine("All SignificantDigitsType demonstrations completed successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error demonstrating SignificantDigitsType: {ex.Message}");
            }
        }
    }
}

See Also