Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template support insert image #186

Open
shps951023 opened this issue Apr 16, 2021 · 8 comments
Open

Template support insert image #186

shps951023 opened this issue Apr 16, 2021 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@shps951023
Copy link
Member

shps951023 commented Apr 16, 2021

概念来源 : Excel模板导出支持图片

@shps951023
Copy link
Member Author

shps951023 commented Apr 17, 2021

image

image

  1. [Content_Types].xml
<?xml version="1.0" encoding="UTF-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
    <Override PartName="/xl/worksheets/_rels/sheet1.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
    <Override PartName="/xl/drawings/drawing1.xml" ContentType="application/vnd.openxmlformats-officedocument.drawing+xml"/>
    <Override PartName="/xl/drawings/_rels/drawing1.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
    <Override PartName="/xl/media/image1.png" ContentType="image/png"/>
    <Override PartName="/xl/media/image2.png" ContentType="image/png"/>
    <Override PartName="/xl/media/image3.png" ContentType="image/png"/>
    <Override PartName="/xl/media/image4.png" ContentType="image/png"/>
    <Override PartName="/xl/media/image5.png" ContentType="image/png"/>
    <Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>
</Types>

xl\worksheets\sheet1.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
    xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
    xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <drawing r:id="rId1"/>
</worksheet>

xlsx\images\withoneimage\xl\drawings\drawing1.xml"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
    xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <xdr:twoCellAnchor editAs="absolute">
        <xdr:from>
            <xdr:col>0</xdr:col>
            <xdr:colOff>0</xdr:colOff>
            <xdr:row>0</xdr:row>
            <xdr:rowOff>0</xdr:rowOff>
        </xdr:from>
        <xdr:to>
            <xdr:col>0</xdr:col>
            <xdr:colOff>349920</xdr:colOff>
            <xdr:row>1</xdr:row>
            <xdr:rowOff>126360</xdr:rowOff>
        </xdr:to>
        <xdr:pic>
            <xdr:nvPicPr>
                <xdr:cNvPr id="0" name="Image 1" descr=""></xdr:cNvPr>
                <xdr:cNvPicPr/>
            </xdr:nvPicPr>
            <xdr:blipFill>
                <a:blip r:embed="rId1"></a:blip>
                <a:stretch/>
            </xdr:blipFill>
            <xdr:spPr>
                <a:xfrm>
                    <a:off x="0" y="0"/>
                    <a:ext cx="349920" cy="288720"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                    <a:avLst/>
                </a:prstGeom>
                <a:ln w="0">
                    <a:noFill/>
                </a:ln>
            </xdr:spPr>
        </xdr:pic>
        <xdr:clientData/>
    </xdr:twoCellAnchor>
    <xdr:twoCellAnchor editAs="absolute">
        <xdr:from>
            <xdr:col>1</xdr:col>
            <xdr:colOff>0</xdr:colOff>
            <xdr:row>0</xdr:row>
            <xdr:rowOff>0</xdr:rowOff>
        </xdr:from>
        <xdr:to>
            <xdr:col>1</xdr:col>
            <xdr:colOff>350280</xdr:colOff>
            <xdr:row>1</xdr:row>
            <xdr:rowOff>126720</xdr:rowOff>
        </xdr:to>
        <xdr:pic>
            <xdr:nvPicPr>
                <xdr:cNvPr id="1" name="Image 2" descr=""></xdr:cNvPr>
                <xdr:cNvPicPr/>
            </xdr:nvPicPr>
            <xdr:blipFill>
                <a:blip r:embed="rId2"></a:blip>
                <a:stretch/>
            </xdr:blipFill>
            <xdr:spPr>
                <a:xfrm>
                    <a:off x="813960" y="0"/>
                    <a:ext cx="350280" cy="289080"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                    <a:avLst/>
                </a:prstGeom>
                <a:ln w="0">
                    <a:noFill/>
                </a:ln>
            </xdr:spPr>
        </xdr:pic>
        <xdr:clientData/>
    </xdr:twoCellAnchor>
    <xdr:twoCellAnchor editAs="absolute">
        <xdr:from>
            <xdr:col>2</xdr:col>
            <xdr:colOff>0</xdr:colOff>
            <xdr:row>0</xdr:row>
            <xdr:rowOff>0</xdr:rowOff>
        </xdr:from>
        <xdr:to>
            <xdr:col>2</xdr:col>
            <xdr:colOff>350280</xdr:colOff>
            <xdr:row>1</xdr:row>
            <xdr:rowOff>126720</xdr:rowOff>
        </xdr:to>
        <xdr:pic>
            <xdr:nvPicPr>
                <xdr:cNvPr id="2" name="Image 3" descr=""></xdr:cNvPr>
                <xdr:cNvPicPr/>
            </xdr:nvPicPr>
            <xdr:blipFill>
                <a:blip r:embed="rId3"></a:blip>
                <a:stretch/>
            </xdr:blipFill>
            <xdr:spPr>
                <a:xfrm>
                    <a:off x="1627920" y="0"/>
                    <a:ext cx="350280" cy="289080"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                    <a:avLst/>
                </a:prstGeom>
                <a:ln w="0">
                    <a:noFill/>
                </a:ln>
            </xdr:spPr>
        </xdr:pic>
        <xdr:clientData/>
    </xdr:twoCellAnchor>
    <xdr:twoCellAnchor editAs="absolute">
        <xdr:from>
            <xdr:col>0</xdr:col>
            <xdr:colOff>0</xdr:colOff>
            <xdr:row>3</xdr:row>
            <xdr:rowOff>0</xdr:rowOff>
        </xdr:from>
        <xdr:to>
            <xdr:col>0</xdr:col>
            <xdr:colOff>350280</xdr:colOff>
            <xdr:row>4</xdr:row>
            <xdr:rowOff>126360</xdr:rowOff>
        </xdr:to>
        <xdr:pic>
            <xdr:nvPicPr>
                <xdr:cNvPr id="3" name="Image 4" descr=""></xdr:cNvPr>
                <xdr:cNvPicPr/>
            </xdr:nvPicPr>
            <xdr:blipFill>
                <a:blip r:embed="rId4"></a:blip>
                <a:stretch/>
            </xdr:blipFill>
            <xdr:spPr>
                <a:xfrm>
                    <a:off x="0" y="487440"/>
                    <a:ext cx="350280" cy="289080"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                    <a:avLst/>
                </a:prstGeom>
                <a:ln w="0">
                    <a:noFill/>
                </a:ln>
            </xdr:spPr>
        </xdr:pic>
        <xdr:clientData/>
    </xdr:twoCellAnchor>
    <xdr:twoCellAnchor editAs="absolute">
        <xdr:from>
            <xdr:col>2</xdr:col>
            <xdr:colOff>0</xdr:colOff>
            <xdr:row>3</xdr:row>
            <xdr:rowOff>0</xdr:rowOff>
        </xdr:from>
        <xdr:to>
            <xdr:col>2</xdr:col>
            <xdr:colOff>350280</xdr:colOff>
            <xdr:row>4</xdr:row>
            <xdr:rowOff>126360</xdr:rowOff>
        </xdr:to>
        <xdr:pic>
            <xdr:nvPicPr>
                <xdr:cNvPr id="4" name="Image 5" descr=""></xdr:cNvPr>
                <xdr:cNvPicPr/>
            </xdr:nvPicPr>
            <xdr:blipFill>
                <a:blip r:embed="rId5"></a:blip>
                <a:stretch/>
            </xdr:blipFill>
            <xdr:spPr>
                <a:xfrm>
                    <a:off x="1627920" y="487440"/>
                    <a:ext cx="350280" cy="289080"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                    <a:avLst/>
                </a:prstGeom>
                <a:ln w="0">
                    <a:noFill/>
                </a:ln>
            </xdr:spPr>
        </xdr:pic>
        <xdr:clientData/>
    </xdr:twoCellAnchor>
</xdr:wsDr>

xlsx\images\withoneimage\xl\drawings_rels\drawing1.xml.rels

<?xml version="1.0" encoding="UTF-8"?>

-<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">

<Relationship Target="../media/image1.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId1"/>

<Relationship Target="../media/image2.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId2"/>

<Relationship Target="../media/image3.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId3"/>

<Relationship Target="../media/image4.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId4"/>

<Relationship Target="../media/image5.png" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Id="rId5"/>

</Relationships>

@shps951023 shps951023 added the help wanted Extra attention is needed label Apr 17, 2021
@huangyedie
Copy link

目前模板插入图片功能还没好吗?

@shps951023
Copy link
Member Author

@huangyedie 是,模版的插入图片逻辑比较复杂

@xsacha
Copy link

xsacha commented Nov 16, 2022

Is there a roadmap for this?
We can support image from new creation but not a template. It seems odd.

Isn't the logic similar? You are adding the file and then replacing the element.

@hy2048
Copy link

hy2048 commented May 9, 2023

我也遇到了,这个issue还是2021年的啊,有点尴尬...

@huangyedie
Copy link

还没解决

@hy2048
Copy link

hy2048 commented May 9, 2023 via email

@SA2687890878
Copy link

麻烦作者大大解决下这个issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Status: In progress
Development

No branches or pull requests

5 participants