Switch Row/Column

Hi there,

I'm using the example posted here:

https://forum.aspose.com/t/97938

How do I Switch Row/Column programatically on the embedded Excel chart?

I'm inserting Excel charts in PowerPoint and now I'd like to be able to programmatically switch Row/Column just like clicking on the'Switch Row/Column' button under 'Design' in powerpoint.

Thanks

Hi,

Thank you for considering Aspose.

1). If you create chart with API, you can use NSeries.Add(string area,bool isVertical) to control switch row/column

a) Switch to Row :_chart.NSeries.Add(sheetName + “!A1:E4”, false)
b) Switch to Column :_chart.NSeries.Add(sheetName + “!A1:E4”, true)

2). If you want to change the source of the chart in the template file, please use the following codes:

Workbook workbook = new Workbook();

workbook.Open(@"F:\FileTemp\book1.xls");

Chart chart = workbook.Worksheets[0].Charts[0];

string[] startValues = chart.NSeries[0].Values.Split(':');

string[] endValues = chart.NSeries[chart.NSeries.Count - 1].Values.Split(':');

chart.NSeries.Clear();

string area = startValues[0] + ":" + endValues[1];

chart.NSeries.Add(area, true);

workbook.Save(@"F:\FileTemp\dest.xls");

It is to be noted that NSeries.Clear will remove all setting of the series.

Thank You & Best Regards,

Hi there,

I'm trying to embed Excel chart into PowerPoint but I understand I have to create an Image of the Excel chart first.

I have an Excel template with a sheet named "ChartSheet" and a single chart named "Chart 1". I'm able to update the chart data. Now, I need to get the image of this updated chart. I'm using the following code below but for some reason, imgChart is still "null" value. Could you please help? Thanks

Dim imgChart As Bitmap = wb.Worksheets("ChartSheet").Charts("Chart 1").ToImage()

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells and check if it works fine for you. As you are accessing the chart by Name, we have fixed the issue regarding accessing the chart with chart name. You may also try to use the chart index instead of chart name (as you have only one chart so you can use Dim imgChart As Bitmap = wb.Worksheets(“ChartSheet”).Charts(0).ToImage()). If you still face the problem with the attached latest version, please share your template file and we will check it soon.

Thank You & Best Regards,

Hi there,

Thank you for your prompt response. Please find the attached Template file. The image object is still null. I've tried to use the name and the index:

Dim imgChart As Bitmap = wb.Worksheets("ChartSheet").Charts(0).ToImage()

Dim imgChart As Bitmap = wb.Worksheets("ChartSheet").Charts("Chart 1").ToImage()

Hi,

We have found the issue as you have mentioned, we will figure it out soon.

Thank you.

Hi,

Thank you for considering Aspose.

After looking further into you issue, I am afraid the Cylinder type charts are not supported in the Chart2Image function. You may check the following documentation link to see the list of the supported charts in Chart2Image feature.

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/converting-chart-to-image.html

Also, we will recommend you to use Excel 2003 file format type to create charts as Excel 2007 Charts art not supported yet.

Sorry for the inconvenience caused,

Hi there,

Thank you for your reply. I changed the type and ToImage seems to work however, I am using MS Office 2007 and it seems that the color scheme seems to be that of MS 2003. Does it have to do with this line of code below? How can I change it to suit MS 2007?

AddOleObjectFrame(x, y, slideWidth, slideHeight, "Excel.Sheet.8", chartOleData)

Thanks

Hi,

Thank you for considering Aspose.

Please download and try our latest official release for Aspose.Cells for .NET: File Format APIs for .NET Core, Java, Python, C++, Android | products.aspose.com

We have fixed some of the coloring issues when using chart as ole object in our latest release. Please try it and let us know if it works fine for you. If you still face any problem, please create a sample application to reproduce the issue and share it here, we will check it soon.

Note: Just for your knowledge, in the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.

Thank You & Best Regards,

Hi,

Thank you for your response. I have another question. I'm now able to embed Excel chart from an Excel file into PowerPoint slide. However, when I click to edit the chart in PowerPoint, I noticed that everything is very small. It's hard to make out the data since it seems to be zoomed out. It seems I need to manually increase the fonts after I've embedded into PowerPoint. Have you come accrossed this issue before?

Hi,

Thank you for considering Aspose.

Please create a sample application and post it here to reproduce the issue. This will help us figure out and solve your mentioned issue asap.

Thank You & Best Regards,