资源简介
通过解析doc,docx,ppt,pptx文件读取文件信息以及内容
完全不依赖Office读取Word、PPT
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using ExtendOffice.Office.Entity;
using ExtendOffice.Office.Summary;
namespace ExtendOffice.Office
{
public class CompoundBinaryFile : IOfficeFile
{
#region 常量
private const UInt32 HeaderSize = 0x200;//512字节
private const UInt32 DirectoryEntrySize = 0x80;//128字节
protected const UInt32 MaxRegSector = 0xFFFFFFFA;
protected const UInt32 DifSector = 0xFFFFFFFC;
protected const UInt32 FatSector = 0xFFFFFFFD;
protected const UInt32 EndOfChain = 0xFFFFFFFE;
protected const UInt32 FreeSector = 0xFFFFFFFF;
#endregion
#region 字段
protected FileStream _stream;
protected BinaryReader _reader;
protected Int64 _length;
protected List _fatSectors;
protected List _minifatSectors;
protected List _miniSectors;
protected List _dirSectors;
protected DirectoryEntry _dirRootEntry;
protected Dictionary> _entrySectorIDs;
protected Dictionary _entryData;
protected List _documentSummaryInformation;
protected List _summaryInformation;
#region 头部信息
private UInt32 _sectorSize;//Sector大小
private UInt32 _miniSectorSize;//Mini-Sector大小
private UInt32 _fatCount;//FAT数量
private UInt32 _dirStartSectorID;//Directory开始的SectorID
private UInt32 _miniCutoffSize;//Mini-Sector最大的大小
private UInt32 _miniFatStartSectorID;//Mini-FAT开始的SectorID
private UInt32 _miniFatCount;//Mini-FAT数量
private UInt32 _difStartSectorID;//DIF开始的SectorID
private UInt32 _difCount;//DIF数量
#endregion
#endregion
#region 属性
///
/// 获取DocumentSummaryInformation
///
public Dictionary DocumentSummaryInformation
{
get
{
if (this._documentSummaryInformation == null)
{
return null;
}
Dictionary dict = new Dictionary();
for (Int32 i = 0; i < this._documentSummaryInformation.Count; i++)
{
dict.Add(this._documentSummaryInformation[i].Type.ToString() this._documentSummaryInformation[i].Data.ToString());
}
return dict;
}
}
///
/// 获取SummaryInformation
///
public Dictionary SummaryInformation
{
get
{
if (this._summaryInformation == null)
{
return null;
}
Dictionary dict = new Dictionary();
for (
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-26 10:28 ExtendOffice.Office\
目录 0 2017-10-26 10:29 ExtendOffice.Office\bin\
目录 0 2017-10-26 10:36 ExtendOffice.Office\bin\Debug\
文件 31744 2017-10-26 10:36 ExtendOffice.Office\bin\Debug\ExtendOffice.Office.dll
文件 87552 2017-10-26 10:36 ExtendOffice.Office\bin\Debug\ExtendOffice.Office.pdb
目录 0 2017-10-26 10:29 ExtendOffice.Office\bin\Release\
文件 25615 2017-10-26 10:28 ExtendOffice.Office\CompoundBinaryFile.cs
目录 0 2017-10-26 10:28 ExtendOffice.Office\Entity\
文件 3830 2017-10-26 10:28 ExtendOffice.Office\Entity\DirectoryEntry.cs
文件 1066 2017-10-26 10:28 ExtendOffice.Office\Entity\PieceElement.cs
文件 3823 2017-10-26 10:28 ExtendOffice.Office\Entity\PowerPointRecord.cs
文件 3244 2017-10-26 10:29 ExtendOffice.Office\ExtendOffice.Office.csproj
目录 0 2017-10-26 10:28 ExtendOffice.Office\Helper\
文件 304 2017-10-26 10:28 ExtendOffice.Office\Helper\BitHelper.cs
文件 1908 2017-10-26 10:28 ExtendOffice.Office\Helper\NodeHelper.cs
文件 967 2017-10-26 10:28 ExtendOffice.Office\Helper\StringHelper.cs
文件 301 2017-10-26 10:28 ExtendOffice.Office\IOfficeFile.cs
文件 132 2017-10-26 10:28 ExtendOffice.Office\IPowerPointFile.cs
文件 289 2017-10-26 10:28 ExtendOffice.Office\IWordFile.cs
目录 0 2017-10-26 10:17 ExtendOffice.Office\obj\
目录 0 2017-10-26 10:50 ExtendOffice.Office\obj\Debug\
文件 683 2017-10-26 10:36 ExtendOffice.Office\obj\Debug\ExtendOffice.Office.csproj.FileListAbsolute.txt
文件 1435 2017-10-26 10:36 ExtendOffice.Office\obj\Debug\ExtendOffice.Office.csprojResolveAssemblyReference.cache
文件 31744 2017-10-26 10:36 ExtendOffice.Office\obj\Debug\ExtendOffice.Office.dll
文件 87552 2017-10-26 10:36 ExtendOffice.Office\obj\Debug\ExtendOffice.Office.pdb
目录 0 2017-10-26 10:17 ExtendOffice.Office\obj\Debug\TempPE\
文件 1187 2017-10-26 10:28 ExtendOffice.Office\OfficeFileFactory.cs
文件 4063 2017-10-26 10:28 ExtendOffice.Office\OfficeOpenxm
文件 6193 2017-10-26 10:28 ExtendOffice.Office\PowerPointFile.cs
文件 2540 2017-10-26 10:28 ExtendOffice.Office\PowerPointOOxm
目录 0 2017-10-26 10:52 ExtendOffice.Office\Properties\
............此处省略43个文件信息
评论
共有 条评论