Free Support Forum - aspose.com

Id of StructuredDocumentTag is wrong

Hi,

enclosed you find a word document with 2 StructuredDocumentTags (in Word ContentControls).

One of them (with the value 1000) shows a different id in Aspose than in Word. Additionally the id
in Aspose is negative.

Can you look at this issue ?

Kind regards,
Guido

Hi Guido,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7288 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

StructuredDocumentTag.Id attribute shall follow these rules:
  • The document shall retain SDT ids if the whole document is cloned Clone.
  • During ImportNode Id shall be retained if import does not cause conflicts with other SDT Ids in the target document.
  • If multiple SDT nodes specify the same decimal number value for the Id attribute, then the first SDT in the document shall maintain this original Id, and all subsequent SDT nodes shall have new identifiers assigned to them when the document is loaded.
  • DuringClone operation new unique ID will be generated for the cloned SDT node.
  • If Id is not specified in the source document, then the SDT node shall have a new unique identifier assigned to it when the document is loaded.

Hi Guido,


I have received response from our development team on this issue and like to share with you that this is not an issue. The negative ID values are legal in OOXML, it is explicitly defined by associated datatype.

MS Word simply casts this value to unsigned int, which results in displaying 4124699771 instead of -170267525 but the bitwise the value is the same. Aspose.Words do not force any additional constraints on IDs so these are exposed as int. If you compare these ID values by using following code snippet, it returns true.

<span style=“font-size:10.0pt;
font-family:“Courier New”;color:blue;mso-font-kerning:0pt;mso-ansi-language:
PL;mso-no-proof:yes”>uint<span style=“font-size:10.0pt;font-family:“Courier New”;
mso-font-kerning:0pt;mso-ansi-language:PL;mso-no-proof:yes”> i = 4124699771;<o:p></o:p>

int j = -170267525;

Console.Write(i == (uint)j);