Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Thu Sep 13, 2018 1:10 pm

dear support

in C#, I'm trying to open xls file (already created) and I add new cell value into Worksheets (for example Worksheets[0]) and save him.
The problemis that after saving I found only new cell data just added and old data cell are empty...
Steps are
1 load file workbook.LoadFromFile(name, ExcelVersion.Version97to2003); (for example in A1 I have "MIKE")
2 add new cell for example in B1 I add "TOM"
3 SAVE file

If I open the file, I found only TOM in B1 and A1 is empty...
I don't understand what I'm wronging...

Thanks
Marcello

magerra@gmail.com
 
Posts: 3
Joined: Mon Feb 08, 2016 2:12 pm

Fri Sep 14, 2018 1:56 am

Hello Marcello,

Thanks for your interests in our Spire.XLS.
After an initial test with our latest Spire.XLS Pack(Hotfix) Version:8.8.5 and below sample code, I didn't reproduce your issue. If you were using an old version, I suggest upgrading to the latest one to try again, if the issue still exists after trying, please provide your input Xls file and your full code to help us further investigate your issue. You could send them to us via email(support@e-iceblue.com).
Code: Select all
Workbook wb = new Workbook();
wb.LoadFromFile(@"C:\Users\Test1\Desktop\914xls\test.xls",ExcelVersion.Version97to2003);
Worksheet sheet = wb.Worksheets[0];
sheet.Range["B1"].Text = "TOM";
wb.SaveToFile("Result.xls",ExcelVersion.Version97to2003);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Sep 17, 2018 8:59 am

Hello Marcello,

Greetings from E-iceblue.
Did the latest version work for you? Could you please give us some feedback at your convenience? Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Sep 17, 2018 9:26 am

dear Lisa

usign my application in C#, according your suggestion I'm able to
-load a file (for examle test.xls)
-change, modify values or add new cell values
- save the file with several name (for example output_test.xls), and on outputfile, I found all my value.

What I'd like to do is load , change. modify a test.xls and save with same name test.xls.
i I try, I found only new cell added, but I don't found old cell value not touched by my application.

If (using my application in C#) I load test.xls, with value "GERRY" in A1, and I add "TOM" in A2, and is I save test.xls (USING THE SAME NAME) when I load test.xls normally using MS EXCEL, I found only "GERRY" in A2 and A1 is empty.
It seem that I overwrite old value and I preserve only newer.
thanks for kind support
Marcello

magerra@gmail.com
 
Posts: 3
Joined: Mon Feb 08, 2016 2:12 pm

Mon Sep 17, 2018 10:34 am

Hello Marcello,

Thanks for your quick response.
I tested your case even saving to the same file name with below testing code, there is still no problem. Please refer to the attachment(result.xls) which generated from our side. To help us further investigate your issue, please provide your input Xls file and your testing code. Thanks in advance.
Code: Select all
Workbook wb = new Workbook();
wb.LoadFromFile(@"test.xls",ExcelVersion.Version97to2003);
Worksheet sheet = wb.Worksheets[0];
sheet.Range["A2"].Text = "TOM";
//wb.SaveToFile(@"test.xls", ExcelVersion.Version97to2003);
wb.Save();

Sincerely,
Lisa
E-iceblue support team
Attachments
result.zip
(2.06 KiB) Downloaded 281 times
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Sep 18, 2018 2:05 pm

dear Lisa

now is all OK.
Thanks for support

magerra@gmail.com
 
Posts: 3
Joined: Mon Feb 08, 2016 2:12 pm

Wed Sep 19, 2018 1:12 am

Dear Marcello,

Glad to hear that! If you need any assistance in the future, just feel free to contact us. Have a nice day!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS