public static INumberingMapper Build(WordprocessingDocument wpDoc) { var body = wpDoc.MainDocumentPart.Document.Body; if (TrackChangesDetector.HasAny(body)) { return(new TrackChangesNumberingMapper(wpDoc)); } else { return(new NumberingMapper(wpDoc)); } }
public void HasTrackChanges_ChangesTest() { var tests = new OpenXmlElement[] { new NumberingChange(), new ParagraphPropertiesChange(), new ParagraphMarkRunPropertiesChange() }; var p = new Paragraph(); var body = new Body(p); foreach (var test in tests) { p.RemoveAllChildren(); p.Append(test); Assert.IsTrue(TrackChangesDetector.HasAny(body)); } }
public void HasTrackChanges_RunPropsTest() { var tests = new OpenXmlElement[] { new DeletedRun(), new InsertedRun(), new MoveToRun(), new MoveFromRun() }; var p = new Paragraph(); var body = new Body(p); foreach (var test in tests) { p.RemoveAllChildren(); p.Append(test); Assert.IsTrue(TrackChangesDetector.HasAny(body)); } }
public void HasTrackChanges_RunMarkPropsTest() { var tests = new OpenXmlElement[] { new Deleted(), new Inserted(), new MoveFrom(), new MoveTo() }; var runMarkProps = new ParagraphMarkRunProperties(); var body = new Body(new Paragraph(new ParagraphProperties(runMarkProps))); foreach (var test in tests) { runMarkProps.RemoveAllChildren(); runMarkProps.Append(test); Assert.IsTrue(TrackChangesDetector.HasAny(body)); } }
public void HasTrackChanges_EmptyBodyTest() { Assert.IsFalse(TrackChangesDetector.HasAny(new Body())); }