Click here to Skip to main content
16,021,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After I copy the chart from Excel to PowerPoint, I want to re-size the chart object.

shapeRange.Height = 250.5F;
shapeRange.Width = 100;

But the above is not working because the "Lock aspect ratio" is selected by default.
I don't know how to disable the "Lock aspect ratio" so that I can change the Height and Width at the same time.

Thank you.
Posted
Comments
markelee-advid 19-May-20 6:53am    
I was able to successfully resize the chart using PowerPoint library from c#:

var presentation = PresentationDocument.Load("Chart.pptx");
var chart = ((GraphicFrame)presentation.Slides[0].Content.Drawings[0]).Chart;

chart.Frame.Layout.Width = Length.From(450.0, LengthUnit.Point);
chart.Frame.Layout.Height = Length.From(200.0, LengthUnit.Point);

presentation.Save("Resized Chart.pptx");

For more information you can refer to this example of PowerPoint charts in c#.

1 solution

Can anybody help me?

I am really stucked.
 
Share this answer
 
Comments
Yusuf 26-Oct-10 21:43pm    
Don't hit the Answer button. You can add a comment to your post.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900