addImageRels(imageName, imageData, i) {
        if (i == null) {
            i = 0;
        }
        const realImageName = i === 0 ? imageName : imageName + `(${i})`;
        const imagePath = `${this.prefix}/charts/${realImageName}`;
        if (this.zip.files[imagePath] != null) {
            return this.addImageRels(imageName, imageData, i + 1);
        }
        //todo 添加文件
        const image = {
            name: imagePath,
            data: imageData,
            options: {
                binary: false,
            },
        };
        this.zip.file(image.name, image.data, image.options);
        this.addOverrideRels(imagePath);
        const relationships = this.relsDoc.getElementsByTagName("Relationships")[0];
        const newTag = this.relsDoc.createElement("Relationship");
        newTag.namespaceURI = null;
        const maxRid = this.loadChartRels() + 1;
        newTag.setAttribute("Id", `rId${maxRid}`);
        newTag.setAttribute("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart");
        newTag.setAttribute("Target", `${this.mediaPrefix}/${realImageName}`);
        relationships.appendChild(newTag);
        return maxRid;
    }
// Add an image and returns it's Rid
Add an image and returns it's Rid
Add an image and returns it ' s Rid
addImageRels(imageName, imageData, i) {
        if (i == null) {
            i = 0;
        }
        const realImageName = i === 0 ? imageName : imageName + `(${i})`;
        const imagePath = `${this.prefix}/charts/${realImageName}`;
        if (this.zip.files[imagePath] != null) {
            return this.addImageRels(imageName, imageData, i + 1);
        }
        const image = {
            name: imagePath,
            data: imageData,
            options: {
                binary: false,
            },
        };
        this.zip.file(image.name, image.data, image.options);
        this.addOverrideRels(imagePath);
        const relationships = this.relsDoc.getElementsByTagName("Relationships")[0];
        const newTag = this.relsDoc.createElement("Relationship");
        newTag.namespaceURI = null;
        const maxRid = this.loadChartRels() + 1;
        newTag.setAttribute("Id", `rId${maxRid}`);
        newTag.setAttribute("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart");
        newTag.setAttribute("Target", `${this.mediaPrefix}/${realImageName}`);
        relationships.appendChild(newTag);
        return maxRid;
    }
addImageRels ( imageName , imageData , i ) { if ( i == null ) { i = 0 ; } const realImageName = i === 0 ? imageName : imageName + ` ${ i } ` ; const imagePath = ` ${ this . prefix } ${ realImageName } ` ; if ( this . zip . files [ imagePath ] != null ) { return this . addImageRels ( imageName , imageData , i + 1 ) ; } const image = { name : imagePath , data : imageData , options : { binary : false , } , } ; this . zip . file ( image . name , image . data , image . options ) ; this . addOverrideRels ( imagePath ) ; const relationships = this . relsDoc . getElementsByTagName ( "Relationships" ) [ 0 ] ; const newTag = this . relsDoc . createElement ( "Relationship" ) ; newTag . namespaceURI = null ; const maxRid = this . loadChartRels ( ) + 1 ; newTag . setAttribute ( "Id" , ` ${ maxRid } ` ) ; newTag . setAttribute ( "Type" , "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" ) ; newTag . setAttribute ( "Target" , ` ${ this . mediaPrefix } ${ realImageName } ` ) ; relationships . appendChild ( newTag ) ; return maxRid ; }
Add an image and returns it's Rid
Add an image and returns it ' s Rid
//todo 添加文件