PNG JPG BMP TIFF PPTX
Aspose.Slides  for .NET

PPTX formatta i grafici in C#

Grafici di documenti PPTX nativi e ad alte prestazioni che utilizzano Aspose.Slides lato server per API .NET, senza l’uso di software come Microsoft o Adobe PDF.

Come creare grafici PPTX usando C#

Per creare grafici PPTX, utilizzeremo

Aspose.Slides per .NET

API che è un’API di manipolazione dei documenti ricca di funzionalità, potente e facile da usare per la piattaforma C#. Aprire

NuGet

gestore pacchetti, cerca Aspose.Slides e installa. È inoltre possibile utilizzare il seguente comando dalla Console di gestione pacchetti.

Comando


PM> Install-Package Aspose.Slides.NET

Passaggi per creare grafici di file PPTX in C#

Una creazione di grafici di documenti di base con le API Aspose.Slides for .NET può essere eseguita con poche righe di codice.

  1. Crea oggetto classe Presentazione.

  2. Seleziona Diapositiva.

  3. Aggiungi il grafico alla diapositiva.

  4. Aggiungi serie di grafici pertinenti con i dati.

  5. Salva il file PPTX

Requisiti di sistema

Le nostre API sono supportate su tutte le principali piattaforme e sistemi operativi. Prima di eseguire il codice seguente, assicurati di avere i seguenti prerequisiti sul tuo sistema.

  • Microsoft Windows o un sistema operativo compatibile con piattaforme .NET Framework, .NET Core, Windows Azure, Mono o Xamarin
  • Ambiente di sviluppo come Microsoft Visual Studio
  • Aspose.Slides per .NET DLL a cui si fa riferimento nel progetto - Installa da NuGet utilizzando il pulsante Download sopra
 

Crea un grafico di file 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);  

    
 
  • Informazioni su Aspose.Slides per .NET API

    L’API Aspose.Slides può essere utilizzata per leggere, scrivere, manipolare e convertire documenti Microsoft PowerPoint in PDF, XPS, HTML, TIFF, ODP e vari altri formati. Si possono creare nuovi file da zero e salvarli nei relativi formati supportati. Aspose.Slides è un’API standalone per la creazione, l’analisi o la manipolazione di presentazioni, diapositive ed elementi e non dipende da alcun software come Microsoft o OpenOffice. Genera grafico PPT(X), diagramma PPT(X) dai dati di Excel, in base al modello di grafico.

    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 Cos'è il formato file PPTX

    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.

    Leggi di più

    Altri formati grafici supportati

    Utilizzando C#, è possibile gestire facilmente la creazione di grafici con diversi formati, tra cui.

    PPT (Microsoft PowerPoint 97-2003)