private void SetContextMenu() { if (Math.Abs(writerControl1.Selection.Length) == 1) { XTextElement element = this.writerControl1.Selection.ContentElements[0]; if (element is XTextImageElement) { this.writerControl1.ContextMenuStrip = this.cmImage; return; } } bool isInCell = false; if (writerControl1.Selection.Cells != null && writerControl1.Selection.Cells.Count > 0) { isInCell = true; } else { XTextContainerElement c = null; int index = 0; writerControl1.Document.Content.GetCurrentPositionInfo(out c, out index); if (c is XTextTableCellElement || c.OwnerCell != null) { isInCell = true; } } if (isInCell) { writerControl1.ContextMenuStrip = cmTableCell; return; } writerControl1.ContextMenuStrip = cmEdit; }
void Verify(XTextElement element) { var str = element.ToString(); var restored = XTextParser.Parse(str); restored.ShouldBe(element); }
void Verify(XTextElement element) { var str = element.ToString(); var restored = XTextParser.Parse(str); restored.ShouldBe(element); }