We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cell - Negative bigInt problem?

Hi guys

I found, I think, a bug in Aspose, which caused me 2 days pulling my hair :frowning:
For the financial reports we’re using bigint in SQL Server 2005/2008.
The following SP is used for the testing.

CREATE PROCEDURE TestBigInteger_DELETE_AFTER_USE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Table TABLE (LatestAnalysisShares BIGINT,
PreviousAnalysisShares BIGINT);

INSERT INTO @Table VALUES(4512323039, 12641751472)
INSERT INTO @Table VALUES(2807463858, 408857681)
INSERT INTO @Table VALUES(2807463858, 848528493)

SELECT LatestAnalysisShares + PreviousAnalysisShares AS LatestAnalysisShares, LatestAnalysisShares - PreviousAnalysisShares AS Change, PreviousAnalysisShares
FROM @Table;
END
GO

The report template:
A1: &=[TopShareholders].TopShareholdersLatestAnalysisShares
B1: &=[TopShareholders].TopShareholdersChange
C1: &=[TopShareholders].TopShareholdersPreviousAnalysisShares

The following code is running (we’re using Enterprice library for Data Access, but SqlClient makes not difference):
private DataTable GetTestBigInteger()
{
Database db = DatabaseFactory.CreateDatabase();

using (DbCommand command = db.GetStoredProcCommand(“dbo.TestBigInteger_DELETE_AFTER_USE”))
{
return db.ExecuteDataSet(command).Tables[0];
}
}

private DataTable RenameTableAndPrefixColumns(DataTable RawDataTable, string NewTableName)
{
RawDataTable.TableName = NewTableName;
for (int index = 0; index < RawDataTable.Columns.Count; ++index)
{
RawDataTable.Columns[index].ColumnName = String.Concat(NewTableName, RawDataTable.Columns[index].ColumnName);
}
return RawDataTable;
}


private void button1_Click(object sender, EventArgs e)
{
WorkbookDesigner wsd = new Aspose.Cells.WorkbookDesigner();
wsd.Workbook = new Workbook(“Book1.xls”);

DataTable dt = GetTestBigInteger();
dt = RenameTableAndPrefixColumns(dt, “TopShareholders”);
wsd.SetDataSource(dt);
wsd.Process(true);

wsd.Workbook.Save(@“c:\temp\Test\test.xls”);
}

as a result - see the screenshot. For some reason, Aspose the negative difference 4512323039 - 12641751472 calculates into 460506159, instead of -8129428433.
I found the following way to fix: cast the difference column into decimal in SP:
CAST(LatestAnalysisShares - PreviousAnalysisShares as decimal) AS Change

We’re using Aspose.Cell 5.1.4, but I tried on Aspose 7.0.2 - the same problem.

Thanks



Hi,

We fixed a similar issue regarding numbers in recent fixes. Could you please try our latest version/fix: Aspose.Cells for .NET v7.0.2.2
Let us know if it works fine with it or not.

Thank you.

Hi
Thanks for your answer.
It does not work for 7.0.2.2 as well.
Here is the more easier example:

private void button1_Click(object sender, EventArgs e)
{
WorkbookDesigner wsd = new Aspose.Cells.WorkbookDesigner();
wsd.Workbook = new Workbook(“Book1.xls”);

DataTable dt = GetTestBigInteger();
dt.TableName = “TestData”;
dt.Columns.Add(“Value”, typeof(Int64));
//dt.Load(
//List data = new List();
/data.Add(-8129428433);
data.Add(2398606177);
data.Add(1958935365);/
DataRow row1 = dt.NewRow();
row1[“Value”] = -8129428433;
dt.Rows.Add(row1);

DataRow row2 = dt.NewRow();
row2[“Value”] = 1958935365;
dt.Rows.Add(row2);

DataRow row3 = dt.NewRow();
row3[“Value”] = 2398606177;
dt.Rows.Add(row3);

wsd.SetDataSource(dt);
wsd.Process(true);
//Aspose.Cells.License lic = new Aspose.Cells.License();
//lic.SetLicense(“Aspose.Cells.lic”);

wsd.Workbook.Save(@“c:\temp\Test\test.xls”);
}

Hi,


Thanks for the simplified sample code.

I am now able to reproduce the issue as you have mentioned with a test template file. The first negative value is not rightly imported into the worksheet cells. I have logged a ticket with an id: CELLSNET-40065. We will figure it out soon.

Thank you.

Hi,

We have fixed this issue. Please download:
Aspose.Cells for .NET v7.0.2.6

The issues you have found earlier (filed as CELLSNET-40065) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.