/// <summary> /// 获取office文档内容 /// </summary> /// <param name="file"></param> /// <returns></returns> private static string _GetContent(IOfficeFile file) { if (file is IWordFile) { IWordFile wordFile = file as IWordFile; return(wordFile.ParagraphText); } else if (file is IPowerPointFile) { IPowerPointFile pptFile = file as IPowerPointFile; return(pptFile.AllText); } else if (file is ITextFile) { ITextFile textFile = file as ITextFile; return(textFile.CommentText); } else if (file is IPDFFile) { IPDFFile pdfFile = file as IPDFFile; return(pdfFile.CommentText); } else if (file is IHtmlFile) { IHtmlFile htmlFile = file as IHtmlFile; return(htmlFile.CommentText); } else if (file is IExcelFile) { IExcelFile excelFile = file as IExcelFile; return(excelFile.CommentText); } else { return(String.Format("无法解析")); } }
public void Write(IHtmlFile file) { Write($"{file.Name}.{file.FileExtension}", file.HtmlContent); }