Free Support Forum - aspose.com

Rewriting Cell value doesn't work properly

Hello,
I tried this example with Evaluation Aspose.Excel 1.0.1219.23144 in VS .NET 2003. I created sheet “template.xls” and tried add some values into it.

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
const string outpfile = “output.xls”;
Excel xls;
Worksheet sheet;
xls = new Excel();
xls.Open(Server.MapPath(“template.xls”));
sheet = xls.Worksheets.GetAt(0);
sheet.Cells.GetAt(“A2”).PutValue(“First Put”);
sheet.Cells.GetAt(“A2”).PutValue(“Second Example Second Put”);
xls.Save(outpfile, SaveType.OpenInBrowser, FileFormatType.ExcelXP, Response);
}

But value “Second Example Second Put” didn’t rewrite previous value “First Put”! There is “First Put” value in output! When I changed “Second Example Second Put” to “Second Example” only it worked properly! It seems, there is an interisting bug!
Thank you for any answers!


Thanks for your consideration.

I have added your code into the method CreateProductsList(Excel excel) of the demos like this:

string path = MapPath(".");
path = path.Substring(0, path.LastIndexOf("\"));
string designerFile = path + “\Designer\AlphabeticalList.xls”;
excel.Open(designerFile);

this.dataTable1.Reset();
this.oleDbSelectCommand1.CommandText = @“SELECT DISTINCTROW Products.ProductName,
Categories.CategoryName,
Products.QuantityPerUnit,
Products.UnitsInStock
FROM Categories INNER JOIN Products
ON Categories.CategoryID = Products.CategoryID
WHERE
(((Products.Discontinued) = No))
Order by Products.ProductName”;
this.oleDbDataAdapter1.Fill(this.dataTable1);

Worksheet sheet = excel.Worksheets.GetAt(0);
sheet.Cells.ImportDataTable(this.dataTable1, false, 6, 1);
sheet.Name = “Products List”;

sheet = excel.Worksheets.GetAt(0);
sheet.Cells.GetAt(“A100”).PutValue(“First Put”);
sheet.Cells.GetAt(“A100”).PutValue(“Second Example Second Put”);

excel.Save(“AlphabeticalList.xls”, SaveType.OpenInBrowser, FileFormatType.Default, this.Response);


The result is as expected.

Could you double check your code or excel file?

It doesn’t really work at my machine. I thought that the problem could be in caching, but result is the same when worksheet is saved to disk ( xls.Save(Server.MapPath(outpfile), FileFormatType.ExcelXP) )

I changed ONLY 1 row in my previous source code

sheet.Cells.GetAt(“A100”).PutValue(“Second Example Second Put”);

I found out that the cell A100 was still empty after running this code!!! A100 is empty even when I created EMPTY “designed” worksheet template.xls! BUT when I changed A100 to A2 it was OK!

Thanks for ideas.

Dear koudelka,

What are you thinking about the evluation?

Do you have any problems about tech, licensing or payment?

I’m afraid, I don’t understand.

I wanted to try this product because I had to make decision about using it in our product. Unfortunately, it doesn’t work properly and I have to solve problem using another way.


Dear koudelka,

As I’m not sure what really matters you so would you like to contact me at aspose@hotmail.com via MSN Messenger?

Dear koudelka,

Sorry I have forgotten to inform you that the latest fix updated on May 22nd should work for you.

Please download it and then replace the installed Aspose.Excel.dll with it.

Also please let me know what happens.