Hi,
In MS Excel, in order to replace formulas with its values, we can copy the cells and paste it to the original range as values.
However, I found that when using PasteType.Values option in Aspose, sometimes the values were not properly copied as values.
Code:
var workbook = new Workbook(@".\test.xlsx");
var worksheet = workbook.Worksheets[0];
var fromRange = worksheet.Cells.CreateRange(0, 0, 500, 40);
var toRange = worksheet.Cells.CreateRange(0, 0, 1, 1);
toRange.Copy(fromRange, new PasteOptions() { PasteType = PasteType.Values }); // values were pasted as formulas
var toRange2 = worksheet.Cells.CreateRange(522, 0, 1, 1);
toRange2.Copy(fromRange, new PasteOptions() { PasteType = PasteType.Values }); // values were properly pasted as values
workbook.Save(@".\asposeout.xlsx");
In the code, if the toRange is the original range, the values were still pasted as formulas. It seemed that the PasteType.Values in Aspose only works when the toRange is out of the fromRange.
But in MS Excel, it doesn’t have the issue. Values are always properly pasted over as values if we use paste - values option.
I’ve attached the test files and a screenshot for your reference. Could you please help us take a look?
test.zip (35.0 KB)
image.png (53.0 KB)
Thanks,