internal bool InMergedRanges(int Row, int Col, out PrinterTextAlign Pos, out Range o) { bool InMergedRanges = false; for (int i = 1; i <= mergers.Count; i++) { o = mergers.GetItem(i); if (Row > 0 && Col > 0) { if (Row >= o.StartRow && Row <= o.EndRow && Col >= o.StartCol && Col <= o.EndCol) { InMergedRanges = true; } if (InMergedRanges) { if (Row == o.StartRow && Col == o.StartCol) { Pos = PrinterTextAlign.LeftTop; } else if (Row == o.StartRow && Col == o.EndCol) { Pos = PrinterTextAlign.RightTop; } else if (Row == o.EndRow && Col == o.StartCol) { Pos = PrinterTextAlign.LeftBottom; } else if (Row == o.EndRow && Col == o.EndCol) { Pos = PrinterTextAlign.RightBottom; } else if (Row == o.StartRow && Col < o.EndCol && Col > o.StartCol) { Pos = PrinterTextAlign.CenterTop; } else if (Row == o.EndRow && Col < o.EndCol && Col > o.StartCol) { Pos = PrinterTextAlign.CenterBottom; } else if (Col == o.StartCol && Row < o.EndRow && Row > o.StartRow) { Pos = PrinterTextAlign.LeftMiddle; } else if (Col == o.EndCol && Row < o.EndRow && Row > o.StartRow) { Pos = PrinterTextAlign.RightMiddle; } else { Pos = PrinterTextAlign.CenterMiddle; } return(InMergedRanges); } } } o = default(Range); Pos = (PrinterTextAlign)(-1); return(InMergedRanges); }