【发布时间】:2017-05-16 17:41:08
【问题描述】:
我在当前的 React 项目中有一个要求,将当前页面的特定 div 从客户端转换为 .ppt(不是 pdf 或图像)。 有没有办法直接这样做?
【问题讨论】:
-
客户端还是服务器端?如果是服务器端,则与
reactjs无关。
标签: html reactjs powerpoint
我在当前的 React 项目中有一个要求,将当前页面的特定 div 从客户端转换为 .ppt(不是 pdf 或图像)。 有没有办法直接这样做?
【问题讨论】:
reactjs无关。
标签: html reactjs powerpoint
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);
}
【讨论】: