我正忙着用 xml 重新创建一个 powerpoint。我已经添加了所有必需的文件,但是当我在 powerpoint 中打开文档时,它说内容有问题。有什么地方我可以看到更多像这样工作的例子吗?这是我如何使用它的示例:
private static void SlideMaster1Xml()
{
FileStream slideMaster1stream = new FileStream(slideMaster1FilePath, FileMode.Create, FileAccess.Write);
XmlWriter slideMaster1Writer = null;
try
{
XmlWriterSettings contentTypesSettings = new XmlWriterSettings();
contentTypesSettings.Indent = true;
slideMaster1Writer = XmlWriter.Create(slideMaster1stream, contentTypesSettings);
slideMaster1Writer.WriteStartDocument(true);
slideMaster1Writer.WriteStartElement("p", "sldMaster", "http://schemas.openxmlformats.org/presentationml/2006/main");
slideMaster1Writer.WriteAttributeString("xmlns","r",null ,"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
slideMaster1Writer.WriteAttributeString("xmlns", "a",null, "http://schemas.openxmlformats.org/drawingml/2006/main");
slideMaster1Writer.WriteStartElement("p", "cSld", null);
slideMaster1Writer.WriteStartElement("p", "bg", null);
slideMaster1Writer.WriteStartElement("p", "bgRef", null);
slideMaster1Writer.WriteAttributeString("Idx", "1001");
slideMaster1Writer.WriteStartElement("a", "schemeClr", null);
slideMaster1Writer.WriteAttributeString("val", "bg1");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "spTree", null);
slideMaster1Writer.WriteStartElement("p", "nvGrpSpPr", null);
slideMaster1Writer.WriteStartElement("p", "cnvPr", null);
slideMaster1Writer.WriteAttributeString( "name", "" );
slideMaster1Writer.WriteAttributeString("Id", "1");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "cNvGrpSpPr", null);
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "nvPr", null);
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "grpSpPr", null);
slideMaster1Writer.WriteStartElement("a", "xfrm", null);
slideMaster1Writer.WriteStartElement("a", "off", null);
slideMaster1Writer.WriteAttributeString( "y", "0" );
slideMaster1Writer.WriteAttributeString("x", "0");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("a", "ext", null);
slideMaster1Writer.WriteAttributeString("cy", "0");
slideMaster1Writer.WriteAttributeString("cx", "0");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("a", "chOff",null);
slideMaster1Writer.WriteAttributeString( "y", "0" );
slideMaster1Writer.WriteAttributeString("x", "0");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("a", "chExt",null);
slideMaster1Writer.WriteAttributeString("cy", "0");
slideMaster1Writer.WriteAttributeString("cx", "0");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "sp",null);
slideMaster1Writer.WriteStartElement("p", "nvSpPr",null);
slideMaster1Writer.WriteStartElement("p", "cNvPr",null);
slideMaster1Writer.WriteAttributeString( "name", "Title Placeholder 1" );
slideMaster1Writer.WriteAttributeString("id", "2");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "cNvSpPr",null);
slideMaster1Writer.WriteStartElement("a", "spLocks",null);
slideMaster1Writer.WriteAttributeString("noGrp", "1");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "nvPr",null);
slideMaster1Writer.WriteStartElement("p", "ph",null);
slideMaster1Writer.WriteAttributeString("type", "title");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "spPr",null);
slideMaster1Writer.WriteStartElement("a", "xfrm",null);
slideMaster1Writer.WriteStartElement("a", "off",null);
slideMaster1Writer.WriteAttributeString( "y", "274638" );
slideMaster1Writer.WriteAttributeString("x", "457200");
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("a", "ext",null);
slideMaster1Writer.WriteAttributeString("cy", "1143000");
slideMaster1Writer.WriteAttributeString( "cx", "8229600" );
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("a", "prstGeom",null);
slideMaster1Writer.WriteAttributeString("prst", "rect");
slideMaster1Writer.WriteStartElement("a", "avLst",null);
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteEndElement();
slideMaster1Writer.WriteStartElement("p", "txBody",null);
slideMaster1Writer.WriteStartElement("a", "bodypr",null);
slideMaster1Writer.WriteAttributeString("anchor", "ctr");
slideMaster1Writer.WriteAttributeString("rtlCol", "0");
slideMaster1Writer.WriteAttributeString("bIns", "45720");
slideMaster1Writer.WriteAttributeString("rIns", "91440");
slideMaster1Writer.WriteAttributeString("tIns", "45720");
slideMaster1Writer.WriteAttributeString("lIns", "91440");
slideMaster1Writer.WriteAttributeString("vert", "horz");
我已经浏览了所有代码 100 次,但看不出有什么问题。任何帮助将不胜感激。