/** * openxml 默认是 zip 格式构造起来比较麻烦,这个格式可以方便文本编辑,word 也能直接打开 */ import { Unzipped } from '../util/fflate'; import { PackageParser } from './PackageParser'; export default class XMLPackageParser implements PackageParser { private xml; private files; private contentTypesDoc; /** * 加载 zip 文件 */ load(fileContent: ArrayBuffer | string | Uint8Array): void; /** * 读取 xml 文件,转成 json 对象 * @param filePath 文件路径 * @returns 转成 json 的结果 */ getXML(filePath: string): Document; /** * 在 xml 下基本不用这个 */ getFileByType(filePath: string, type: 'string' | 'blob'): string | Uint8Array | Blob | null; /** * 读取文本内容 */ getString(filePath: string): string; saveFile(filePath: string, content: Uint8Array | string): void; /** * 判断文件是否存在 */ fileExists(filePath: string): boolean; /** * 生成 zip 文件 */ generateZipBlob(docContent: string): Blob; getZip(): Unzipped; generateZip(): Uint8Array; }