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 Aug 11, 2021 12:20 pm

Hello,
I’m generating the following column chart via spire.xls.
Now I’m looking for a way to make the background of the labels on top of the columns (As marked in the attached screenshot) with white background.
So that they don't interfere with the horizontal lines anymore.
In your guides I only find an example with line charts, which doesn’t seem to work for this kind of chart.

I’m Looking forward to your answer.
Attachments
chart screenshot.png
chart screenshot.png (24.51 KiB) Viewed 2361 times

Fabian.jaenicke
 
Posts: 1
Joined: Wed Aug 11, 2021 12:14 pm

Thu Aug 12, 2021 2:48 am

Hello,

Thanks for your inquiry.
Please refer to following code to meet your needs.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"test.xlsx");

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

            foreach (ChartSerie chartSerie in chart.Series)
            {
                chartSerie.DataLabels.FrameFormat.Fill.ForeColor = Color.White;
            }
            workbook.SaveToFile("result.xlsx", ExcelVersion.Version2016);

If this is not what you want, please provide your input file and your desired output for further investigation. You can upload them here or send them to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Aug 31, 2021 10:43 am

Hello,

Greetings from E-iceblue!
Did the code we provided work for you? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS

cron