【问题标题】:how to convert a specific html section to powerpoint format, ie ppt?如何将特定的 html 部分转换为 powerpoint 格式,即 ppt?
【发布时间】:2017-05-16 17:41:08
【问题描述】:

我在当前的 React 项目中有一个要求,将当前页面的特定 div 从客户端转换为 .ppt(不是 pdf 或图像)。 有没有办法直接这样做?

【问题讨论】:

  • 客户端还是服务器端?如果是服务器端,则与reactjs无关。

标签: html reactjs powerpoint


【解决方案1】:

finalOutputDoc.Save(@"C:\temp\temp.html", Aspose.Pdf.SaveFormat.Html);

        //Next convert to powerpoint
        //Create Empty presentation instance//Create Empty presentation instance
        //using (Aspose.Slides.Presentation pres = new Aspose.Slides.Presentation())
        //Create Empty presentation instance//Create Empty presentation instance
        //Create Empty presentation instance//Create Empty presentation instance
        using (Presentation pres = new Presentation())
        {
            //Acesss the default first slide of presentation

            ISlide slide = pres.Slides[0];

            //Adding the AutoShape to accomodate the HTML content
            IAutoShape ashape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, pres.SlideSize.Size.Width - 20, pres.SlideSize.Size.Height - 10);

            ashape.FillFormat.FillType = FillType.NoFill;

            //Adding text frame to the shape
            ashape.AddTextFrame("");

            //Clearing all paragraphs in added text frame
            ashape.TextFrame.Paragraphs.Clear();

            //Loading the HTML file using stream reader
            TextReader tr = new StreamReader(@"C:\temp\temp.html");

            //Adding text from HTML stream reader in text frame
            ashape.TextFrame.Paragraphs.AddFromHtml(tr.ReadToEnd());

            //Saving Presentation
            pres.Save(@"C:\temp\output.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

        }

【讨论】:

    猜你喜欢
    • 2014-04-15
    • 2012-12-12
    • 1970-01-01
    • 1970-01-01
    • 2016-12-04
    • 2021-07-01
    • 2012-03-21
    • 2012-11-05
    • 1970-01-01
    相关资源
    最近更新 更多