# แยกข้อความและรูปภาพจากเอกสาร PPTX ผ่าน .NET

> ซอร์สโค้ด C# เพื่อแยกข้อความและรูปภาพจากไฟล์ PPTX บน .NET Framework, .NET Core, Windows Azure, Mono หรือ Xamarin Platforms

Source: https://products.aspose.com/slides/th/net/parser/pptx/
Updated: 2026-08-11



## วิธีแยกไฟล์ PPTX โดยใช้ C#

 ในการแยกวิเคราะห์ไฟล์ PPTX เราจะใช้
 [Aspose.Slides สำหรับ .NET](https://products.aspose.com/slides/th/net)
 API ซึ่งเป็น API การจัดการเอกสารที่มีคุณลักษณะหลากหลาย มีประสิทธิภาพ และใช้งานง่ายสำหรับแพลตฟอร์ม C# เปิด
 [NuGet](https://www.nuget.org/packages/aspose.slides.net)
 package manager ค้นหา
 **สมมติ.สไลด์**
 และติดตั้ง คุณยังสามารถใช้คำสั่งต่อไปนี้จาก Package Manager Console

### สั่งการ

```cs

PM> Install-Package Aspose.Slides.NET

```

## ขั้นตอนในการแยกวิเคราะห์ไฟล์ PPTX ใน C#

การแยกวิเคราะห์เอกสารพื้นฐานด้วย [Aspose.Slides for .NET](https://products.aspose.com/slides/th/net) API สามารถทำได้โดยใช้โค้ดเพียงไม่กี่บรรทัด

โหลดไฟล์ PPTX

รับกรอบข้อความทั้งหมด

วนซ้ำแต่ละส่วนย่อหน้า

รับผลลัพธ์ที่ต้องการ เช่น ข้อความ แบบอักษร ฯลฯ

## ความต้องการของระบบ

 API ของเราได้รับการสนับสนุนบนแพลตฟอร์มหลักและระบบปฏิบัติการทั้งหมด ก่อนดำเนินการโค้ดด้านล่าง โปรดตรวจสอบให้แน่ใจว่าคุณมีข้อกำหนดเบื้องต้นต่อไปนี้ในระบบของคุณ

- Microsoft Windows หรือระบบปฏิบัติการที่เข้ากันได้กับ .NET Framework, .NET Core, Windows Azure, Mono หรือ Xamarin Platforms
- สภาพแวดล้อมการพัฒนาเช่น Microsoft Visual Studio
- Aspose.Slides สำหรับ .NET DLL ที่อ้างอิงในโครงการของคุณ - ติดตั้งจาก NuGet โดยใช้ปุ่มดาวน์โหลดด้านบน

### แยกไฟล์ PPTX - C#

```cs
//Extract Text from the Whole pptx Presentation
    Presentation pptxPresentation = new Presentation(dataDir + "demo.pptx");

    //Get an Array of ITextFrame objects from all slides in the PPTX
    ITextFrame[] textFramesPPTX = Aspose.Slides.Util.SlideUtil.GetAllTextFrames(pptxPresentation, true);

    //Loop through the Array of TextFrames
     for (int i = 0; i < textFramesPPTX.Length; i++)

        //Loop through paragraphs in current ITextFrame
        foreach (IParagraph para in textFramesPPTX[i].Paragraphs)

             //Loop through portions in the current IParagraph
             foreach (IPortion port in para.Portions)
             {
                //Display text in the current portion
                Console.WriteLine(port.Text);

                //Display font height of the text
                Console.WriteLine(port.PortionFormat.FontHeight);

                //Display font name of the text
                if (port.PortionFormat.LatinFont != null)
                   Console.WriteLine(port.PortionFormat.LatinFont.FontName);
            }

```

## เกี่ยวกับ Aspose.Slides สำหรับ .NET API

 Aspose.Slides API สามารถใช้อ่าน เขียน จัดการ และแปลงเอกสาร Microsoft PowerPoint เป็น PDF, XPS, HTML, TIFF, ODP และรูปแบบอื่นๆ ได้ หนึ่งสามารถสร้างไฟล์ใหม่ตั้งแต่เริ่มต้นและบันทึกในรูปแบบที่รองรับที่เกี่ยวข้อง Aspose.Slides เป็น API แบบสแตนด์อโลนสำหรับการสร้าง แยกวิเคราะห์ หรือจัดการการนำเสนอ สไลด์ และองค์ประกอบ และไม่ขึ้นกับซอฟต์แวร์ใดๆ เช่น Microsoft หรือ OpenOffice

Files with PPTX extension are presentation files created with popular Microsoft PowerPoint application. Unlike the previous version of presentation file format PPT which was binary, the PPTX format is based on the Microsoft PowerPoint open XML presentation file format. A presentation file is a collection of slides where each slide can comprise of text, images, formatting, animations, and other media. These slides are presented to audience in the form of slideshows with custom presentation settings.

## รูปแบบการแยกวิเคราะห์อื่น ๆ ที่รองรับ

- [ODP](https://products.aspose.com/slides/th/net/parser/odp/) — รูปแบบการนำเสนอ OpenDocument
- [PPT](https://products.aspose.com/slides/th/net/parser/ppt/) — Microsoft PowerPoint 97-2003
