使用 SevenZip.SevenZipExtractor.ExtractFile实现
public static String docxParser(String filename)
{
//path to the systems temporary folder
String tempFolderPath = Path.GetTempPath();
//set the path of the 7z.dll (it needs to be in the debug folder)
SevenZipExtractor.SetLibraryPath("7z.dll");
SevenZipExtractor extractor = new SevenZipExtractor(filename);
//create a filestream for the file we are going to extract
FileStream f = new FileStream(tempFolderPath + "document.xml", FileMode.Create);
//extract the document.xml
extractor.ExtractFile("word\\document.xml", f);
//get rid of the object because it is unmanaged
extractor.Dispose();
//close the filestream
f.Close();
//send document.xml that we extracted from the .docx to the xml par
C#压缩包中解压指定文件
最新推荐文章于 2022-06-16 11:14:38 发布