private DocumentFormat GetDocumentFormat(byte[] data, string fileName)
 {
     using (var ms = new MemoryStream(data))
     {
         var documentFormat = new RichEditDocumentServer().GetService <IFormatDetectorService>().DetectFormat(ms);
         if (documentFormat.Equals(DocumentFormat.Undefined))
         {
             documentFormat = Utils.GetRichEditDocumentFormatByExtension(fileName);
         }
         return(documentFormat);
     }
 }