2.1.3.1.1 RTF Compression ABNF Grammar

This section uses Augmented Backus-Naur Form (ABNF), as specified in [RFC5234], to define the format of the contents stored in the PidTagRtfCompressed property ([MS-OXPROPS] section 2.941).

 RTFCOMPRESSED=Header CONTENTS
  
 Header=COMPSIZE RAWSIZE COMPTYPE CRC    ; The size of the Header field is 
                                         ; 16 (0x0010) bytes.
  
 COMPSIZE =DWORD           ; Writers MUST set the COMPSIZE field to
                           ; the length of the compressed data 
                           ; (the CONTENTS field) in bytes 
                           ; plus 12 (the count of the 
                           ; remaining bytes from the header).
  
 RAWSIZE =DWORD                          ; The size in bytes of the 
                                         ; uncompressed content.
 COMPTYPE=COMPRESSED / UNCOMPRESSED      ; The type of compression.
 COMPRESSED =%x4C.5A.46.75               ; Value of 0x75465A4C.
 UNCOMPRESSED=%x4D.45.4C.41              ; Value of 0x414C454D.
  
 CRC =DWORD                ; If the COMPTYPE field is set to 
                           ; COMPRESSED, then the CRC field is 
                           ; computed from the CONTENTS field.
                           ; If the COMPTYPE field is set to 
                           ; UNCOMPRESSED, then the CRC field 
                           ; MUST be set to %x00.00.00.00.
  
 CONTENTS=RAWDATA / COMPRESSEDDATA       ; The CONTENTS field is set
                                         ; to RAWDATA if the COMPTYPE 
                                         ; field is set to UNCOMPRESSED.
                                         ; The CONTENTS field is set 
                                         ; to COMPRESSEDDATA if the COMPTYPE
                                         ;  field is set to COMPRESSED.
  
 RAWDATA=*LITERAL
 COMPRESSEDDATA=[*RUN] ENDRUN [PADDING]
 RUN=CONTROL 8*8TOKEN
 ENDRUN=CONTROL 1*8TOKEN
 CONTROL= OCTET
 Token=REFERENCE / LITERAL
 REFERENCE=WORD                          ; Value is in big-endian format.
 LITERAL=OCTET
 PADDING=*OCTET