Copy pasting with intersecting merged cells

Posted by: ernests on 28 September 2020, 3:00 am EST

    • Post Options:
    • Link

    Posted 28 September 2020, 3:00 am EST - Updated 29 September 2022, 3:48 pm EST

    Hello!

    I’m trying to perform a copy operation between workbooks on a range that intersects a merged cell that it doesn’t fully contain.

    See the image for illustration of the range

    A:A
    that I’m trying to copy:

    The operation fails with an exception “java.lang.IllegalStateException: Invalid Paste Operation: can’t paste partially on an array formula, merge cell or pivot table.”

    However, copy-pasting in excel of that kind of range is not considered illegal. The merged cell is simply ignored. The outcome looks like this:

    This is the code I’m using:

    
    var rangeAddress = "A:A"
    var filePath = "..."
    
    var sourceWorkbook: Workbook = Workbook().apply { open(filePath) }
    val sourceSheet: IWorksheet = sourceWorkbook.worksheets.get(0)
    var sourceRange: IRange = sourceSheet.getRange(rangeAddress)
    
    var destinationWorkbook = Workbook()
    val destinationSheet: IWorksheet = destinationWorkbook.worksheets.get(0)
    var destRange: IRange = destinationSheet.getRange(rangeAddress)
    
    sourceRange.copy(destRange, EnumSet.allOf(PasteType::class.java))
    
    

    My questions:

    • do you plan to support this (in the sense of Excel behavior)?
    • how would you recommend to work around this problem?
  • Posted 30 September 2020, 2:01 am EST

    Hello,

    We are working on your query and is looking for a workaround for the same. We will get back to you soon.

    Tracking id for your issue is #DOCXLS-3161

    Thanks,

    Reeva

  • Posted 13 November 2020, 5:04 am EST

    Hello Reeva,

    Do you have any update on this topic?

  • Posted 13 November 2020, 8:41 am EST

    Hello Ernests,

    This bug has been postponed by our developers as it is not a small change.

    It might be out in V 4.0.1 release but there is not ETA yet as the work has not been started yet.

    Thanks,

    Reeva

  • Posted 13 November 2020, 8:59 am EST

    Hello Reeva,

    Thank you for the update!

    Cheers

    Ernests

  • Posted 7 January 2021, 5:15 am EST

    Hello,

    Our developers have fixed your issue and build fixing your issue is out:-https://search.maven.org/artifact/com.grapecity.documents/gcexcel/4.0.2/jar

    Please try the same and let us know if you still face any issues.

    Thanks,

    Reeva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels