这是正确的Open Office XML吗? [英] Is this correct Open Office XML?

查看:62
本文介绍了这是正确的Open Office XML吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

        <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <?mso-application progid="Word.Document"?>
    <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
        <pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
            <pkg:xmlData>
                <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
                    <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" />
                </Relationships>
            </pkg:xmlData>
        </pkg:part>
        <pkg:part pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="256">
            <pkg:xmlData>
                <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
                    <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png" />
                </Relationships>
            </pkg:xmlData>
        </pkg:part>
        <pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
            <pkg:xmlData>
                <w:document mc:Ignorable="w14 w15 wp14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
                    <w:body>
                        <w:p w:rsidR="00AE3E50" w:rsidRDefault="00DE2072">
                            <w:r>
                                <w:drawing>
                                    <wp:inline distT="0" distB="0" distL="0" distR="0">
                                        <wp:extent cx="2194560" cy="1463040" />
                                        <wp:docPr id="1" name="My Video" />
                                        <wp:cNvGraphicFramePr>
                                            <a:graphicFrameLocks noChangeAspect="1" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" />
                                        </wp:cNvGraphicFramePr>
                                        <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
                                            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
                                                <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
                                                    <pic:nvPicPr>
                                                        <pic:cNvPr id="1" name="" />
                                                        <pic:cNvPicPr />
                                                    </pic:nvPicPr>
                                                    <pic:blipFill>
                                                        <a:blip r:embed="rId2">
                                                            <a:extLst>
                                                                <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                                                                    <a14:useLocalDpi val="0" xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" />
                                                                </a:ext>
                                                                <a:ext uri="{C809E66F-F1BF-436E-b5F7-EEA9579F0CBA}">
                                                                    <wp15:webVideoPr embeddedHtml="&lt;iframe width=&quot;800&quot; height=&quot;600&quot; src=&quot;http://www.youtube.com/embed/qk51u8-4uo4&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;" w="800" h="600" xmlns:wp15="http://schemas.microsoft.com/office/word/2012/wordprocessingDrawing" />
                                                                </a:ext>
                                                            </a:extLst>
                                                        </a:blip>
                                                        <a:stretch>
                                                            <a:fillRect />
                                                        </a:stretch>
                                                    </pic:blipFill>
                                                    <pic:spPr>
                                                        <a:xfrm>
                                                            <a:off x="0" y="0" />
                                                            <a:ext cx="2194560" cy="1463040" />
                                                        </a:xfrm>
                                                        <a:prstGeom prst="rect">
                                                            <a:avLst />
                                                        </a:prstGeom>
                                                    </pic:spPr>
                                                </pic:pic>
                                            </a:graphicData>
                                        </a:graphic>
                                    </wp:inline>
                                </w:drawing>
                            </w:r>
                        </w:p>
                    </w:body>
                </w:document>
            </pkg:xmlData>
        </pkg:part>
        <pkg:part pkg:name="/word/media/image1.png" pkg:contentType="image/png" pkg:compression="store">
            <pkg:binaryData>
                iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAHN6w8ZAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
                jwv8YQUAAAAGUExURQAAAAAAAKVnuc8AAAACdFJOU/8A5bcwSgAAAAlwSFlzAAAOxAAADsQBlSsO
                GwAAAAxJREFUGFdjYBgYAAAAeAABoRR6NAAAAABJRU5ErkJggg==
            </pkg:binaryData>
        </pkg:part>
    </pkg:package>

我不确定以上内容是否正确,但是在使用编程添加到MS word时,它始终会给我错误消息无效格式". 错误是 错误消息:指定的数据对象的格式无效. 错误代码:2006

I'm not sure whether above one is correct or not but it keeps giving me error "Invalid format" while adding to MS word using programming". The error is Error Message: The format of the specified data object is invalid. Error Code: 2006

这是buttonw的点击事件,正在插入代码...

Here is click event for the buttonw which is inserting code...

Office.context.document.setSelectedDataAsync
(
    xmlCode,
    { coercionType: "ooxml" }, 
    function (result)
    {
        console.log("test");
    }
);

可变xmlCode由ooxml代码作为字符串数据组成.

variable xmlCode is consists of ooxml code as string data.

推荐答案

现在已解决... 我做的错误是,我已将ooxml代码放在<textarea> html元素内.因此,当它在浏览器中呈现时,html编码的iframe代码被转换为HTML标签,这引起了问题.我更新了代码,从 <textarea>中删除了ooxml代码,并将其直接作为字符串放置到变量中,问题得以解决.

It's solved now... The mistake that I was doing is, I have placed the ooxml code inside a <textarea> html element. So while it was being rendered inside browser, the html encoded iframe code was converted into HTML tags which was causing issue. I updated my code, removed ooxml code from <textarea> and placed it directly as string to variable and the problem was solved.

现在,我可以使用office.js嵌入视频了

Now, I'm able to embed video using office.js

这篇关于这是正确的Open Office XML吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆