Copy pasting with intersecting merged cells

Posted by: ernests on 27 September 2020, 6:00 pm EST

  • Posted 27 September 2020, 6:00 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?
  • Replied 29 September 2020, 5:01 pm 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
  • Replied 12 November 2020, 8:04 pm EST

    Hello Reeva,

    Do you have any update on this topic?
  • Replied 12 November 2020, 11:41 pm 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
  • Replied 12 November 2020, 11:59 pm EST

    Hello Reeva,

    Thank you for the update!

    Cheers
    Ernests
  • Marked as Answer

    Replied 6 January 2021, 8:15 pm 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