Cell.StringValueWithoutFormat
Cell.StringValueWithoutFormat property
Gets cell’s value as string without any format.
[Obsolete("Use GetStringValue(CellValueFormatStrategy) with CellValueFormatStrategy.None instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public string StringValueWithoutFormat { get; }
Remarks
NOTE: This method is now obsolete. Instead, User should get the value object and format it according to the value type and the specific requirement. This property will be removed 12 months later since December 2020. Aspose apologizes for any inconvenience you may have experienced.
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class CellPropertyStringValueWithoutFormatDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Add different types of data to demonstrate StringValueWithoutFormat
worksheet.Cells["A1"].PutValue("Plain Text");
worksheet.Cells["A2"].PutValue(12345);
worksheet.Cells["A3"].PutValue(3.14159);
worksheet.Cells["A4"].PutValue(DateTime.Now);
// Apply number formatting to some cells
Style style = worksheet.Cells["A2"].GetStyle();
style.Number = 3; // Currency format
worksheet.Cells["A2"].SetStyle(style);
style = worksheet.Cells["A3"].GetStyle();
style.Number = 9; // Percentage format
worksheet.Cells["A3"].SetStyle(style);
try
{
// Display StringValueWithoutFormat for each cell
Console.WriteLine("A1 StringValueWithoutFormat: " + worksheet.Cells["A1"].StringValueWithoutFormat);
Console.WriteLine("A2 StringValueWithoutFormat: " + worksheet.Cells["A2"].StringValueWithoutFormat);
Console.WriteLine("A3 StringValueWithoutFormat: " + worksheet.Cells["A3"].StringValueWithoutFormat);
Console.WriteLine("A4 StringValueWithoutFormat: " + worksheet.Cells["A4"].StringValueWithoutFormat);
// Compare with formatted StringValue
Console.WriteLine("\nComparison with formatted values:");
Console.WriteLine("A2 StringValue (formatted): " + worksheet.Cells["A2"].StringValue);
Console.WriteLine("A3 StringValue (formatted): " + worksheet.Cells["A3"].StringValue);
// Save the workbook
workbook.Save("StringValueWithoutFormatDemo.xlsx");
Console.WriteLine("\nWorkbook saved successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class Cell
- namespace Aspose.Cells
- assembly Aspose.Cells