簡體   English   中英

OpenXML:在C#中創建Power Point

[英]OpenXML: while creating power point in c#

我正在使用下面的代碼,在此代碼中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";

PS:我還添加了OpenXML和WindowsBase。

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

一切都很好。 只有您需要從Google庫名稱下載一個庫:DocumentFormat.OpenXml.dll

我也對此感到非常困惑,只是下載並鏈接到您的項目

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM