public static bool LoadFileInDetectionMode(this RichEditDocumentServer server, string path, DetectedDocumentFormat format) { var ext = System.IO.Path.GetExtension(path); var docFormat = Mapping[format]; if (new string[] { ".dot", ".dotx" }.Contains(ext)) { var documentLoaded = server.LoadDocumentTemplate(path, docFormat); // Dot, Dotx if (documentLoaded) { server.Document.DocumentProperties.Created = System.DateTime.Now; } return(documentLoaded); } else if (new string[] { ".doc", ".docx" }.Contains(ext)) { return(server.LoadDocument(path, docFormat)); // Doc, Docx } else { return(false); // Unidentified } }