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.

Wed Dec 25, 2019 5:31 am

I want that the chartarea is no background color and no any border, with macro i can use this code :
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").Fill.Visible = msoFalse
ActiveSheet.Shapes("Chart 1").Line.Visible = msoFalse

With spire.xls i have tryed the next code,but it does't work for me,what can i do to set the background and border off?

chart.Fill.Visible = false;
chart.Line.Visible = false;

standheo
 
Posts: 24
Joined: Mon Oct 08, 2018 11:13 am

Wed Dec 25, 2019 8:16 am

Hi,

Thanks for your inquiry.
Please use the code below to set the background of chart as "No fill".
Code: Select all
            //set the background color of ChartArea
            chart.ChartArea.Fill.FillType = ShapeFillType.NoFill;
            //set the background color of PlotArea
            chart.PlotArea.Fill.FillType = ShapeFillType.NoFill;


And please refer to the code below to set the border of char as "No line".
Code: Select all
            //set the border of chart in ChartArea
            chart.ChartArea.Border.Pattern = ChartLinePatternType.None;
            //set the border of chart in PlotArea
            chart.PlotArea.Border.Pattern = ChartLinePatternType.None;

If the code couldn't solve your issue, to help us investigate it accurately, please offer us the following information.
1. Your input Excel file.
2. Your desired result file.
You could upload them here or send us([email protected]) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Wed Dec 25, 2019 10:16 am

I have tryed your code,it works with barchart and column chart,but it does't work with line chart which has a table , chart.HasDataTable = true;
what can i do to disbale background and border with line-table chart?

standheo
 
Posts: 24
Joined: Mon Oct 08, 2018 11:13 am

Thu Dec 26, 2019 1:56 am

Hi,

Thanks for your reply.
I made an initial test with Spire.XLS Pack(Hotfix) Version:9.12.20 but didn't reproduce your issue. Both of the background and the border in the line chart with a data table could be set correctly on my side. I'm afraid it is difficult for us to locate the reason of your issue if we don't reproduce it on our side.
To help us investigate your issue accurately, please offer us the following information.
1. Your input Excel file(if any).
2. The complete code you were using which could reproduce your issue directly.

You could upload them here or send us([email protected]) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Dec 26, 2019 2:46 am

After many times tryed,i hava found what code i had missing :

chart.ChartArea.Fill.Visible = false;
chart.PlotArea.Fill.Visible = false;

with above two line code it works,thank you !

standheo
 
Posts: 24
Joined: Mon Oct 08, 2018 11:13 am

Thu Dec 26, 2019 2:57 am

Hi,

Thanks for sharing the solution. Glad to hear that you have managed to solve the issue by yourself.
Any question, welcome to contact us. Have a nice day.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.XLS