Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Aug 05, 2022 9:23 am

How can I tell if the current cell has been merged with other cells

cc_cc_cc_cc
 
Posts: 4
Joined: Fri Aug 05, 2022 9:18 am

Fri Aug 05, 2022 10:09 am

Hello,

Thanks for your inquiry.

You can refer to the following code to judge the merged state of a cell and also here is a sample screenshot for your reference.

Code: Select all
        //Get Horizontal merge state
        CellMerge hMerge=cell.getCellFormat().getHorizontalMerge();
        //Get Vertical merge state
        CellMerge vMerge=cell.getCellFormat().getVerticalMerge();
        //judge the merged state of a cell
        switch (hMerge){
            case Start:
                //The first cell of a cell merger
                break;
            case Continue:
                //The middle cell of a cell merger
                break;
            case None:
                //No merge cell
                break;
        }

3CCCF496-0E36-429c-8070-27DFEBDCD015.png
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Fri Aug 05, 2022 10:30 am

Thank you. Your code is working

cc_cc_cc_cc
 
Posts: 4
Joined: Fri Aug 05, 2022 9:18 am

Mon Aug 08, 2022 3:51 am

You are welcome!
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.Doc