Aspose.Words.Examples.CSharp.Programming_Documents.Working_with_Tables.MergedCells.PrintCellMergeType C# (CSharp) Method

PrintCellMergeType() public static method

public static PrintCellMergeType ( Cell cell ) : string
cell Cell
return string
        public static string PrintCellMergeType(Cell cell)
        {
            bool isHorizontallyMerged = cell.CellFormat.HorizontalMerge != CellMerge.None;
            bool isVerticallyMerged = cell.CellFormat.VerticalMerge != CellMerge.None;
            string cellLocation = string.Format("R{0}, C{1}", cell.ParentRow.ParentTable.IndexOf(cell.ParentRow) + 1, cell.ParentRow.IndexOf(cell) + 1);

            if (isHorizontallyMerged && isVerticallyMerged)
                return string.Format("The cell at {0} is both horizontally and vertically merged", cellLocation);
            else if (isHorizontallyMerged)
                return string.Format("The cell at {0} is horizontally merged.", cellLocation);
            else if (isVerticallyMerged)
                return string.Format("The cell at {0} is vertically merged", cellLocation);
            else
                return string.Format("The cell at {0} is not merged", cellLocation);
        }
        // ExEnd:PrintCellMergeType