Enum Granularity

Granularity enumeration

指定比较两个文档时要跟踪的更改的粒度。

public enum Granularity

价值观

姓名价值描述
CharLevel0
WordLevel1

例子

显示以在比较文档时指定粒度。

Document docA = new Document();
DocumentBuilder builderA = new DocumentBuilder(docA);
builderA.Writeln("Alpha Lorem ipsum dolor sit amet, consectetur adipiscing elit");

Document docB = new Document();
DocumentBuilder builderB = new DocumentBuilder(docB);
builderB.Writeln("Lorems ipsum dolor sit amet consectetur - \"adipiscing\" elit");

// 指定是否跟踪变化
// 按字符 ('Granularity.CharLevel'),或按单词 ('Granularity.WordLevel')。
Aspose.Words.Comparing.CompareOptions compareOptions = new Aspose.Words.Comparing.CompareOptions();
compareOptions.Granularity = granularity;

docA.Compare(docB, "author", DateTime.Now, compareOptions);

// 第一个文档的修订组集合包含文档之间的所有差异。
RevisionGroupCollection groups = docA.Revisions.Groups;
Assert.AreEqual(5, groups.Count);

也可以看看