PNG JPG BMP TIFF PPTX
Aspose.Slides  for .NET

Biểu đồ định dạng PPTX trong C#

Biểu đồ tài liệu PPTX nguyên bản và hiệu suất cao bằng cách sử dụng Aspose.Slides phía máy chủ cho các API .NET mà không cần sử dụng bất kỳ phần mềm nào như Microsoft hoặc Adobe PDF.

Cách tạo biểu đồ PPTX bằng C#

Để tạo biểu đồ PPTX, chúng tôi sẽ sử dụng

Aspose.Slides dành cho .NET

API là một API thao tác tài liệu giàu tính năng, mạnh mẽ và dễ sử dụng cho nền tảng C#. Mở

NuGet

quản lý gói, tìm kiếm ** Aspose.Slides ** và cài đặt. Bạn cũng có thể sử dụng lệnh sau từ Bảng điều khiển Trình quản lý Gói.

Yêu cầu


PM> Install-Package Aspose.Slides.NET

Các bước tạo biểu đồ tệp PPTX trong C#

Lập biểu đồ tài liệu cơ bản với API Aspose.Slides for .NET có thể được thực hiện chỉ với vài dòng mã.

  1. Tạo đối tượng lớp Presentation.

  2. Chọn Trang trình bày.

  3. Thêm biểu đồ vào trang trình bày.

  4. Thêm chuỗi biểu đồ có liên quan với dữ liệu.

  5. Lưu tệp PPTX

yêu cầu hệ thống

Các API của chúng tôi được hỗ trợ trên tất cả các nền tảng và Hệ điều hành chính. Trước khi thực hiện mã bên dưới, hãy đảm bảo rằng bạn có các điều kiện tiên quyết sau trên hệ thống của mình.

  • Microsoft Windows hoặc hệ điều hành tương thích với .NET Framework, .NET Core, Windows Azure, Mono hoặc Xamarin Platforms
  • Môi trường phát triển như Microsoft Visual Studio
  • Aspose.Slides cho .NET DLL được tham chiếu trong dự án của bạn - Cài đặt từ NuGet bằng cách sử dụng nút Tải xuống ở trên
 

Tạo biểu đồ tệp PPTX - C#

//Creating Charts in a Presentation
    Presentation pres = new Presentation();
    
    ISlide slide = pres.Slides[0];
    
    //Creating the default chart
    IChart chart = slide.Shapes.AddChart(ChartType.ScatterWithSmoothLines, 0, 0, 400, 400);
    
    //Getting the default chart data worksheet index
    int defaultWorksheetIndex = 0;
    
    //Accessing the chart data worksheet
    IChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
    
    //Delete demo series
    chart.ChartData.Series.Clear();
    
    //Add new series
    chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 1, 1, "Series 1"), chart.Type);
    chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 1, 3, "Series 2"), chart.Type);
    
    //Take first chart series
    IChartSeries series = chart.ChartData.Series[0];
    
    //Add new point (1:3) there.
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 1), fact.GetCell(defaultWorksheetIndex, 2, 2, 3));
    
    //Add new point (2:10)
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 2), fact.GetCell(defaultWorksheetIndex, 3, 2, 10));
    
    //Edit the type of series
    series.Type = ChartType.ScatterWithStraightLinesAndMarkers;
    
    //Changing the chart series marker
    series.Marker.Size = 10;
    series.Marker.Symbol = MarkerStyleType.Star;
    
    //Take second chart series
    series = chart.ChartData.Series[1];
    
    //Add new point (5:2) there.
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 2, 3, 5), fact.GetCell(defaultWorksheetIndex, 2, 4, 2));
    
    //Add new point (3:1)
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 3, 3, 3), fact.GetCell(defaultWorksheetIndex, 3, 4, 1));
    
    //Add new point (2:2)
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 4, 3, 2), fact.GetCell(defaultWorksheetIndex, 4, 4, 2));
    
    //Add new point (5:1)
    series.DataPoints.AddDataPointForScatterSeries(fact.GetCell(defaultWorksheetIndex, 5, 3, 5), fact.GetCell(defaultWorksheetIndex, 5, 4, 1));
    
    //Changing the chart series marker
    series.Marker.Size = 10;
    series.Marker.Symbol = MarkerStyleType.Circle;
    
    pres.Save("AsposeScatterChart.pptx", SaveFormat.Pptx);  

    
 
  • Giới thiệu về Aspose.Slides cho .NET API

    API Aspose.Slides có thể được sử dụng để đọc, viết, thao tác và chuyển đổi tài liệu Microsoft PowerPoint sang PDF, XPS, HTML, TIFF, ODP và nhiều định dạng khác. Người ta có thể tạo các tệp mới từ đầu và lưu chúng ở các định dạng được hỗ trợ có liên quan. Aspose.Slides là một API độc lập để tạo, phân tích cú pháp hoặc thao tác với các bản trình bày, trang trình bày và các phần tử và nó không phụ thuộc vào bất kỳ phần mềm nào như Microsoft hoặc OpenOffice. Tạo biểu đồ PPT (X), biểu đồ PPT (X) từ dữ liệu excel, dựa trên mẫu biểu đồ.

    Online PPTX Chart Creation Live Demos

    Generate PPTX documents charts right now by visiting our Live Demos website . The live demo has the following benefits

      No need to download Aspose API.
      No need to write any code.
      Just upload your PPTX files.
      Chart will be created instantly.

    PPTX Những gì là PPTX Tập Tin Định Dạng

    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.

    Đọc Thêm

    Các định dạng biểu đồ được hỗ trợ khác

    Sử dụng C#, người ta có thể dễ dàng xử lý biểu đồ với các định dạng khác nhau bao gồm.

    PPT (Microsoft PowerPoint 97-2003)