PptxSaveOptions.EmbedXlsxAsChartDataSource
PptxSaveOptions.EmbedXlsxAsChartDataSource property
Indicates whether embedding an xlsx file as data source of the chart.
public bool EmbedXlsxAsChartDataSource { get; set; }
Remarks
The default value is true.
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Charts;
using System;
public class PptxSaveOptionsPropertyEmbedXlsxAsChartDataSourceDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Create a sample worksheet with chart data
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells["A1"].PutValue("Category");
worksheet.Cells["B1"].PutValue("Value");
worksheet.Cells["A2"].PutValue("Item1");
worksheet.Cells["B2"].PutValue(100);
worksheet.Cells["A3"].PutValue("Item2");
worksheet.Cells["B3"].PutValue(200);
// Add a chart to demonstrate the property's effect
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 10);
Chart chart = worksheet.Charts[chartIndex];
chart.NSeries.Add("B2:B3", true);
chart.NSeries.CategoryData = "A2:A3";
try
{
// Create PptxSaveOptions instance
PptxSaveOptions saveOptions = new PptxSaveOptions();
// Display the default value of EmbedXlsxAsChartDataSource
Console.WriteLine("Default EmbedXlsxAsChartDataSource value: " + saveOptions.EmbedXlsxAsChartDataSource);
// Set the property to true to demonstrate its usage
saveOptions.EmbedXlsxAsChartDataSource = true;
Console.WriteLine("EmbedXlsxAsChartDataSource set to: " + saveOptions.EmbedXlsxAsChartDataSource);
// Save the workbook as PPTX with the option enabled
workbook.Save("EmbedXlsxAsChartDataSourceDemo.pptx", saveOptions);
Console.WriteLine("PPTX saved with EmbedXlsxAsChartDataSource enabled");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class PptxSaveOptions
- namespace Aspose.Cells
- assembly Aspose.Cells