CSV output adds a negative sign in core 3.1 version as below. This can be recreated with any version of Aspose >= 18.10
Note: Template has the cell style set to “Number” (0.00). template attached
Expected behavior is for csv to be produced with “0.00”. Is there a work around/fix to suppress the “-ive” sign in .net core version?
==================================
.net framework version output: (works as expected)
TAG_STRING,TAG_DECIMAL1,TAG_DECIMAL2,Aspose Version,.NET Version
Row1,1.23,0.00,Aspose Ver: 22.4.0,".NETFramework,Version=v4.8"
.net core 3.1 version output: (incorrect -0.00 output)
TAG_STRING,TAG_DECIMAL1,TAG_DECIMAL2,Aspose Version,.NET Version
Row1,1.23,-0.00,Aspose Ver: 22.4.0,".NETCoreApp,Version=v3.1"
Sample code to recreate:
using Aspose.Cells;
using System;
using System.Data;
using System.IO;
using System.Reflection;
using System.Runtime.Versioning;
namespace AsposeTester
{
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Starting...");
var wkbkFilePath = @"c:\temp\template.xlsx";
var outputPath = @"c:\temp\output.csv";
var ds = CreateData();
var ms = new MemoryStream(File.ReadAllBytes(wkbkFilePath));
var populatedStream = new MemoryStream();
var designer = new WorkbookDesigner();
designer.Workbook = new Workbook(ms);
ms.Position = 0;
designer.SetDataSource(ds);
designer.Process();
designer.Workbook.CalculateFormula();
designer.Workbook.Save(populatedStream, SaveFormat.Csv);
populatedStream.Position = 0;
File.WriteAllBytes(outputPath, populatedStream.ToArray());
Console.WriteLine("Completed successfully...");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static DataSet CreateData()
{
var dt = new DataTable("DATA");
dt.Columns.Add(new DataColumn("TAG_STRING", typeof(System.String)));
dt.Columns.Add(new DataColumn("TAG_DECIMAL1", typeof(System.Decimal)));
dt.Columns.Add(new DataColumn("TAG_DECIMAL2", typeof(System.Decimal)));
dt.Columns.Add(new DataColumn("TAG_ASPOSE_VERSION", typeof(System.String)));
dt.Columns.Add(new DataColumn("TAG_NET_VERSION", typeof(System.String)));
var row = dt.NewRow();
row[0] = "Row1";
row[1] = 1.2345;
row[2] = -0.0008;
row[3] = $"Aspose Ver: {Aspose.Cells.CellsHelper.GetVersion()}";
row[4] = $"{Assembly.GetEntryAssembly()?.GetCustomAttribute<TargetFrameworkAttribute>()?.FrameworkName}";
dt.Rows.Add(row);
var ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
}
}
template.zip (7.6 KB)