Convert TXT to PPT using C# or online
Build Microsoft Word TXT to PowerPoint PPT conversion apps on .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
How to Convert TXT to PPT Using C#
In order to automate the process for any Word txt files to PowerPoint ppt presentation batch conversion, we’ll use Aspose.Words for .NET and Aspose.Slides for .NET APIs. The former is a word processing API for processing or manipulating Microsoft Word documents. Whereas, the latter is a presentation manipulation API that lets you create or modify Microsoft PowerPoint slides. Both APIs are part of Aspose.Total for .NET package. You can directly download from Nuget or may use the following commands from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Total
Steps to Convert TXT to PPT via C#
Aspose.Total makes it easy for the developers to load & convert TXT files to PPT in just a few lines of code.
- Add reference of Aspose.Total for .NET
- Load TXT file using Aspose.Words.Document class
- Save the TXT document into HTML
- Create Aspose.Slides.Presentation Object
- Import HTML content in text frame of any slide shape inside presentation
- Save the document using Aspose.Slides.Presentation.Save(“output.ppt”, SaveFormat.Ppt)
System Requirements
Aspose.Total for .NET is supported on all major operating systems. Just make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
- Development environment like Microsoft Visual Studio.
- Aspose.Words for .NET & Aspose.Slides for .NET DLLs or Aspose.Total for .NET DLL referenced in your project.
This code sample shows how to convert a TXT to PPT using C#
Aspose.Words.Document txt = new Aspose.Words.Document("sourceWordFile.txt");
// Save TXT file to HTML
txt.Save("filepath\\test.html", SaveFormat.Html);
// To convert multi pages TXT documents, export each page to HTML separately using Aspose.Words and then use the below code to convert to PPT.
using (Presentation ppt = new Presentation()){
// Access the default first slide of presentation
ISlide slide = pres.Slides[0];
// Adding the AutoShape to accomodate the HTML content
// Adjust it as of your need
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("filepath\\test.html");
// Adding text from HTML stream reader in text frame
ashape.TextFrame.Paragraphs.AddFromHtml(tr.ReadToEnd());
// Save the PPT Presentation
ppt.Save("filepath\\pres.ppt", Aspose.Slides.Export.SaveFormat.Ppt);
}
Online Converter for TXT to PPT
Free App to Convert TXT to PPT
Check our live demos for TXT to PPT conversion with following benefits.
About Aspose.Total
Aspose.Total for .NET is complete package of document Manipulation APIs. APIs are easily integratable within any .NET based application to manipulate Microsoft Word, Excel, PowerPoint, Outlook, PDF, Images, Barcodes and more than 100 other formats. Programmers can easily use these to create, modify, render, print and convert between most popular file formats within any .NET, C#, ASP.NET and VB.NET applications without the need of any other software.Other Supported Conversions
You can also convert TXT into many other file formats including few listed below.