@FloMart,
We have tried this scenario using our own sample files but could not reproduce this issue here. Could you please share your sample files for our reference?
Workbook workbook = new Workbook("input.xlsx");
Cell cell = workbook.Worksheets[0].Cells["A1"];
//cell.Value = 0.29;
Console.WriteLine(cell.Value);
Console.WriteLine(cell.DisplayStringValue);
var sheet = workbook.Worksheets[0];
Workbook TmpWorkbook = new Workbook();
TmpWorkbook.Worksheets.RemoveAt(0);
var sheetTemp = TmpWorkbook.Worksheets.Add(sheet.Name);
sheetTemp.Copy(sheet);
TmpWorkbook.Save("output.xlsx");
Workbook workbook1 = new Workbook("output.xlsx");
Console.WriteLine(workbook1.Worksheets[0].Cells["A1"].DisplayStringValue);
@FloMart,
I can not open the input file. Could you please create the Zip file with WinRar or any other application, instead of changing the file extension to Zip.
@FloMart,
We have observed the issue and logged it in our database for further investigation. We will write back here once any update is ready for sharing.
This issue is logged as: CELLSNET-47896 -Formatting lost while copying sheet from one workbook to other
The formula value cached in the template file is wrong.
Workbook workbook = new Workbook(dir + "Test.xlsm");
Console.WriteLine(workbook.Worksheets["Granulométrie"].Cells["A47"].Value);
workbook.CalculateFormula();
Console.WriteLine(workbook.Worksheets["Granulométrie"].Cells["A47"].Value);
This file is very strange. If you unhide Row 1 to Row 28 on the worksheet “TxSaisieGranulo”, you will find that the value of A37 is empty, and A47 is displayed as 0 in the worksheet “Granulométrie”.
We saw a special setting in the file: <xcalcf:feature name=“microsoft.com:CNMTM”/>, if we remove this, when the file is opened, A47 in the worksheet “Granulométrie” shows 0 .
What version of Excel are you using, and what type of license are you using? We found some information about CNMTM:
So please force all formulas to be recalculated in Excel or call workbook.CalculateFormula(); to recalculate formulas.
I don’t know what is the office 365 version because the file is not managed by me.
Your idea to calculateformula on the new workbook cannot be worked on my case because the others worksheets used in the formulas are not copied but I succeed to find a solution without copying the worksheet but deleting all the unnecessary worksheets on the original file.
If you copy the worksheet to another workbook in MS Excel manually, you will get same results as Aspose.Cells produces. And, we cannot generate your excepted file for now, So, it’s better to remove other worksheets to get it now.
Yes but if I copy worksheet on another worbook I lose conditional formatting and others settings.
The goal is to understand why they are conflict when I update only one shape on others graphical aspects.
In my case, I update one shape and not only this shape is updated
When you copy a worksheet to another workbook in MS Excel manually, you will also loose the formatting, so Aspose.Cells behaves the same way as MS Excel does. Aspose.Cells follows MS Excel standards and specifications and mimics the same behavior while copying worksheets b/w workbooks.
Anyways we will further check and may give you more details on it.