doc pdf ppt与 txt之间的转换 :
组件的作用一般是将文件读出成字符格式,并不是单纯的转换文件名后缀,所以需要将读出的东西写入txt文件 。
添加office引用
.net中对office中的word及ppt进行编程时,确保安装office时已经安装了word,ppt可编程组件(自定义安装时可查看)或者安装“Microsoft Office 2003 Primary Interop Assemblies”
安装后,在编程页面添加引用:
添加引用-com—microsoft powerpoint object 11.0 libaray/word 11.0 object library;
还得添加office组件
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.PowerPoint;
using org.pdfbox.pdmodel;
using org.pdfbox.util;
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop.PowerPoint;
public void pdf2txt(FileInfo file,FileInfo txtfile)
{
PDDocument doc = PDDocument.load(file.FullName);
PDFTextStripper pdfStripper = new PDFTextStripper

这篇博客介绍了如何使用C#编程实现读取doc、pdf和ppt文件,并将它们的内容转换成txt格式。通过利用Microsoft Office Interop库和PDFBox库,博主展示了具体的代码实现,包括读取pdf、doc、ppt文件的文本内容,并将这些内容写入txt文件。
最低0.47元/天 解锁文章
3500

被折叠的 条评论
为什么被折叠?



