- visual studio 2010
- Microsoft Office 2010
Hi,everyone,I have a problem using Aspose.
I want to write some numbers into an Excel,look at the code below:
-----------------------------------------------------------------------------------------------
string templatePath = Server.MapPath("~/Template/123.xls");
Workbook workbook = null;
workbook = new Workbook(templatePath);
Worksheet workSheet = workbook.Worksheets[0];
decimal _value = decimal.Parse("6000000.5");//7668870.55
decimal _value0 = decimal.Parse("6000000.50");
float dou = 7668870.55F;
workSheet.Cells[0, 0].PutValue(_value);
workSheet.Cells[0, 1].PutValue(_value0);
workSheet.Cells[0, 2].Value = dou;
SaveFormat fileFormat = SaveFormat.Auto;
fileFormat = SaveFormat.Excel97To2003;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
workbook.Save(stream, fileFormat);
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment;filename=wanda.xls");
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(stream.ToArray());
------------------------------------------------------------------------------------
Excel has the wrong value:
_value ---->-4737417.74
_value0---->-4737417
dou---->-3068548
When I tried some other numbers,it worked fine.
I found that the problem may be [template]
When the numbers are in the same line,error
not in the same line , right
Any help is appreciated!
Thanks very much!
Very important!