private bool IsOpenSuccessful(MemoryStream dataStream, Spire.Doc.FileFormat format) { try { Document doc = new Document(dataStream, format); } catch (InvalidOperationException) { return(false); } catch (Exception) { return(false); } return(true); }
//Подумать над названием private static string GetFilepathAfterConvertSpireDoc(string filepath, Spire.Doc.FileFormat fileFormat) { Document document = new Document(); document.LoadFromFile(filepath); if (fileFormat == Spire.Doc.FileFormat.Html) { filepath = FolderWork.CreateForlderForHTML(filepath); filepath = $"{filepath}\\{formatWord}.{fileFormat.ToString().ToLower()}"; } else { filepath = $"{filepath}_{formatWord}.{fileFormat.ToString().ToLower()}"; } document.SaveToFile(filepath, fileFormat); return(filepath); }