OpenXML:在c#中创建功率点

时间:2015-10-15 12:33:08

标签: c# asp.net-mvc-4

我正在使用下面的代码,在此代码中PowerPointTemplate()给出错误,即

PowerPointTemplate()未显示在intellisense中,因为它应该在openXML中

public class PowerPointParameter
 {
    public string Name { get; set; }
    public string Text { get; set; }
    public FileInfo Image { get; set; }
 }
        var templ = new PowerPointTemplate();
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "[#Paragraph1#]", Text = "Slide 1" });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "[#Paragraph2#]", Text = "Slide 2" });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "[#List1(string[])#]", Text = "test1 \n test 2 \n test3 \n test 2" });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "[#List2(string[])#]", Text = "test1 \n test 2 \n test3 \n test 2" });

        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "1", Image = new FileInfo(GetRootPath() + @"\Images\1.jpg") });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "2", Image = new FileInfo(GetRootPath() + @"\Images\2.jpg") });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "3", Image = new FileInfo(GetRootPath() + @"\Images\3.jpg") });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "4", Image = new FileInfo(GetRootPath() + @"\Images\4.jpg") });
        templ.PowerPointParameters.Add(new PowerPointParameter() { Name = "5", Image = new FileInfo(GetRootPath() + @"\Images\5.jpg") });

        var templatePath = GetRootPath() + @"\Templates\Template.pptx";
        var outputPath = GetRootPath() + @"\Output\Document.pptx";

P.S:我也添加了OpenXML和WindowsBase。

http://www.dotnet-geek.co.uk/index.php/openxml-power-point-templates-processing/#comment-576

1 个答案:

答案 0 :(得分:0)

这一切都很好。只需从谷歌库名称下载一个库: DocumentFormat.OpenXml.dll

我也很困惑,只需下载并链接到您的项目