We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Range.copy with PasteType.VALUES_AND_NUMBER_FORMATS

Hi!

I`m trying to use Range.copy() method with PasteType.VALUES_AND_NUMBER_FORMATS and after copying there is no values in new Range. Only cells formats has been copied.
Could you explain what is wrong?

I`m using Java 8 and Aspose.cells 18.5.1 (actually 18.6 makes same result).

Source and result files are in attachment.

My code:

public void copyRangeTest() throws Exception {
Workbook wbSource = new Workbook(“files\source.xlsx”);
Workbook wbDest = new Workbook(“files\dest.xlsx”);
wbDest.getWorksheets().add(“COPY VALUES_AND_NUMBER_FORMATS”);
wbDest.getWorksheets().add(“COPY FORMATS”);
wbDest.getWorksheets().add(“COPY VALUES”);

    Range srcRange = wbSource.getWorksheets().get(0).getCells().createRange(0, 0, 3, 3);
    Range destRangeVNF = wbDest.getWorksheets().get("COPY VALUES_AND_NUMBER_FORMATS").getCells().createRange(0, 0, 3, 3);
    Range destRangeF = wbDest.getWorksheets().get("COPY FORMATS").getCells().createRange(0, 0, 3, 3);
    Range destRangeV = wbDest.getWorksheets().get("COPY VALUES").getCells().createRange(0, 0, 3, 3);

    PasteOptions pasteValuesNFormats = new PasteOptions();
    pasteValuesNFormats.setPasteType(PasteType.VALUES_AND_NUMBER_FORMATS);
    destRangeVNF.copy(srcRange, pasteValuesNFormats);

    PasteOptions pasteFormats = new PasteOptions();
    pasteFormats.setPasteType(PasteType.FORMATS);
    destRangeF.copy(srcRange, pasteFormats);

    PasteOptions pasteValues = new PasteOptions();
    pasteValues.setPasteType(PasteType.VALUES);
    destRangeV.copy(srcRange, pasteValues);

    wbDest.save("files\\dest.xlsx");
}

Thanks!

files.zip (14.2 KB)

@nikiton,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42699 - Problem when copying range with PasteOptions

@nikiton,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42699”) now. We will soon provide you the fixed version after performing QA and include other enhancements and fixes.

Thanks!
This is good news!

@nikiton,

You are welcome.

@nikiton,

Please try our latest version/fix: Aspose.Cells for Java v18.8.2 (attached)

Your issue should be fixed in it.

Let us know your feedback.
fix18.8.2.zip (6.3 MB)

Thanks! It works now!

@nikiton,

Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-42699) have been fixed in Aspose.Cells for Java 18.9. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: https://docs.aspose.com/display/cellsjava/Installation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi