Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Nov 16, 2010 10:35 am

Hello.

How can i copy a chart from one sheet to another?

Regards

dfense
 
Posts: 12
Joined: Tue Jan 20, 2009 2:35 pm
Location: Frankfurt, Germany

Tue Nov 16, 2010 2:54 pm

Hello,

Thank you for your inquiry.
Please check post attachment for your reference.
Please let me know if you have any questions and concerns.

Best Regards
Attachments
CopyChartSheet.zip
(14.34 KiB) Downloaded 600 times
Jason Tan
Technical Support / Developer,
e-iceblue Support Team
User avatar

Jason.Tan
 
Posts: 30
Joined: Tue May 25, 2010 7:17 am

Wed Nov 17, 2010 8:40 am

Hello.

I'm sorry, but this not want i wanted to do. I just want to copy a single chart from sheet1 to sheet2.

Regards

dfense
 
Posts: 12
Joined: Tue Jan 20, 2009 2:35 pm
Location: Frankfurt, Germany

Thu Nov 18, 2010 3:44 am

Hello,

Sorry for confused to you.
For copying a single chart from sheet1 to sheet2, please check attachment for new demostration.
Please let me know if you have any questions and concerns.

Best Regards
Attachments
CloneChart.zip
(21.29 KiB) Downloaded 599 times
Jason Tan
Technical Support / Developer,
e-iceblue Support Team
User avatar

Jason.Tan
 
Posts: 30
Joined: Tue May 25, 2010 7:17 am

Thu Nov 18, 2010 9:37 am

Hello Jason.

The code looks good, but i cant use it. I didnt have the option to pass a chart as a parameter to the charts.Add function. The only possible parameter for this function is the excel version.

I think the reason is that i use an old version of the spire.xls library. As per file version info, i use the 3.0.0.0 version.

Regards,
Steve

dfense
 
Posts: 12
Joined: Tue Jan 20, 2009 2:35 pm
Location: Frankfurt, Germany

Tue Dec 15, 2020 10:05 am

Jason.Tan wrote:Hello,

Sorry for confused to you.
For copying a single chart from sheet1 to sheet2, please check attachment for new demostration.
Please let me know if you have any questions and concerns.

Best Regards


Good morning.
This example does not work with version 10.1.0 of FreeSpire.XLS. When you execute the
Code: Select all
srcChart.Clone(chartEmpty.Parent)
statement you get the following error: "Reference to object not set as an instance of an object"

Ideas?

A greeting

blastdoman
 
Posts: 27
Joined: Thu Jul 02, 2020 7:06 am

Tue Dec 15, 2020 11:10 am

Hi blastdoman,

Thanks for your post.
I did an initial test and did reproduce your issue. I have logged it in our bug tracking system with the ticket SPIREXLS-3023. We will let you know if there is any update. Sorry for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon Feb 08, 2021 9:41 am

Hello,

Hope you are doing well.
Glad to inform that we just released Spire.XLS Pack(Hotfix) Version:11.2.3 which fixed the issue SPIREXLS-3023, please download it from the following links and refer to the code below to test.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.XLS/11.2.3

Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("ChartSample1.xlsx");
            Chart srcChart = workbook.Worksheets[0].Charts[0];
            workbook.Worksheets[1].Charts.Add(srcChart.Clone(workbook.Worksheets[1]));
            workbook.SaveToFile("result.xlsx");


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.XLS