Document comparison result has invalid box position data in .NET

The Code :
using (Comparer comparer = new Comparer(docs.FirstOrDefault()))
{
comparer.Add(docs.LastOrDefault());
var options = new CompareOptions()
{
CalculateCoordinates = true,
DetectStyleChanges = true
};
comparer.Compare(options);
var changes = comparer.GetChanges();
var diff = changes.Select(s => new DocCompareDiffModel
{
ComponentType = s.ComponentType,
TargetText = s.TargetText,
Text = s.Text,
SourceText = s.SourceText,
Box = new DocCompareBox(s.Box.X, s.Box.Y, s.Box.Width, s.Box.Height) { },
Authors = s.Authors,
PageInfo = new DocComparePageInfo(s.PageInfo.Width, s.PageInfo.Height, s.PageInfo.PageNumber) { }
});
return Ok(changes);
}

Some samples do not have BOX data。
产品买卖合同a.docx (13.6 KB)

产品买卖合同aa.docx (14.2 KB)

Is there a problem?

1 Like

@chenranwang

Could you please share a sample (console) application also the output you are getting? We are getting this output.zip (13.5 KB) at our end. Also specify the API version that you are using (e.g. 21.1, 20.10).

output result is :
[
{
“id”: 0,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “北京”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “住所地:北京”,
“sourceText”: “住所地:上海”,
“componentType”: “Run”
},
{
“id”: 1,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “上海”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: “住所地:北京”,
“sourceText”: “住所地:上海”,
“componentType”: “Run”
},
{
“id”: 2,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “。”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “授权代表:李四。张飞”,
“sourceText”: “授权代表:李四”,
“componentType”: “Run”
},
{
“id”: 3,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “张飞”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “授权代表:李四。张飞”,
“sourceText”: “授权代表:李四”,
“componentType”: “Run”
},
{
“id”: 4,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: " 甲方 100 一键 乙方 200 两件 ",
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: " 甲方 100 一键 乙方 200 两件 ",
“sourceText”: null,
“componentType”: “Table”
},
{
“id”: 5,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “”,
“sourceText”: null,
“componentType”: “Paragraph”
},
{
“id”: 6,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “对”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 7,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “包”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 8,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “新”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 9,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “装的特”,
“styleChanges”: [
{
“propertyName”: “FontName”,
“newValue”: “宋体”,
“oldValue”: “Calibri”
}
],
“authors”: [
“chenran_wang”
],
“type”: 6,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 10,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “殊”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 11,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “要求:”,
“styleChanges”: [
{
“propertyName”: “FontName”,
“newValue”: “宋体”,
“oldValue”: “Calibri”
}
],
“authors”: [
“chenran_wang”
],
“type”: 6,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 12,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “防”,
“styleChanges”: [
{
“propertyName”: “FontName”,
“newValue”: “宋体”,
“oldValue”: “Calibri”
}
],
“authors”: [
“chenran_wang”
],
“type”: 6,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 13,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “水”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 14,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “寒”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 15,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “。”,
“styleChanges”: [
{
“propertyName”: “FontName”,
“newValue”: “宋体”,
“oldValue”: “Calibri”
}
],
“authors”: [
“chenran_wang”
],
“type”: 6,
“targetText”: “3、乙方产品新装的特要求:防寒。”,
“sourceText”: “3、乙方对产品包装的特殊要求:防水。”,
“componentType”: “Run”
},
{
“id”: 16,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “5.甲方对产品要求高”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 2,
“targetText”: “5.甲方对产品要求高”,
“sourceText”: null,
“componentType”: “Paragraph”
},
{
“id”: 17,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “三、价款”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: null,
“sourceText”: “三、价款”,
“componentType”: “Paragraph”
},
{
“id”: 18,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “1、产品的单价与总价:”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: null,
“sourceText”: “1、产品的单价与总价:”,
“componentType”: “Paragraph”
},
{
“id”: 19,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “单价:人民币50元。”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: null,
“sourceText”: “单价:人民币50元。”,
“componentType”: “Paragraph”
},
{
“id”: 20,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “总价:人民币15000元。”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: null,
“sourceText”: “总价:人民币15000元。”,
“componentType”: “Paragraph”
},
{
“id”: 21,
“comparisonAction”: 0,
“pageInfo”: {
“width”: 0,
“height”: 0,
“pageNumber”: 0
},
“box”: {
“height”: 1.3329,
“width”: 1.3329,
“x”: 1.3329,
“y”: 1.3329
},
“text”: “2、甲方产品的包装费用、运输费用、保险费用及交付时的上下列支费用等按下列约定承担:”,
“styleChanges”: [],
“authors”: [
“chenran_wang”
],
“type”: 3,
“targetText”: null,
“sourceText”: “2、甲方产品的包装费用、运输费用、保险费用及交付时的上下列支费用等按下列约定承担:”,
“componentType”: “Paragraph”
}
]

The width and height data of the box property is wrong.

sdk version: GroupDocs.Comparison:21.3.0

1 Like

@chenranwang

In order to further investigate this issue, we need a sample application from you and the output file. What is the expected box width?

I upload our source code here:

I used the latest version : 21.4.0

The point position information of the difference item is obviously wrong:企业微信截图_9765ee60-e515-4506-ac80-1fe0e088d06c.jpg (200.5 KB)

thx.

@chenranwang

Thank you for the details. We are now further investigating this issue with ticket ID COMPARISONNET-2694. You’ll be notified in case of any update.

hi, Is there an update on this issue?

@chenranwang

We are still trying to fix this issue. As there’s any further update, we’ll notify you.

The issues you have found earlier (filed as COMPARISONNET-2694) have been fixed in this update. This message was posted using Bugs notification tool by anton.samarskyy

hi, the issues has not been fixed in the latest version.
The position for the difference results is incorrect .

@chenranwang

Sorry for the inconvenience you are facing. Could you please share the screenshot of wrong positions? Are you facing this issue with a particular document or for all the files?

你们可以用我上面提供的那个源码,将sdk版本更新到21.5.0版本,运行代码后可以看到差异结果的box属性里面的 x,y 这些信息依然是错误的

1 Like

@chenranwang

据观察,当未应用 API 许可证时,我们会得到不同结果的错误位置。但是如果我们申请许可证,我们就会得到正确的职位。请看一看这个截图.PNG (14.6 KB) 或这个 输出.zip (590 Bytes). 如果您目前没有许可证文件,好消息是您可以在 此处 申请临时许可证。让我们知道它是否有效。