Microsoft 365 and Office | Excel | For home | Windows
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello, how to change the label font size of a column in the current excel sheet which is open
To change the label font size of a column in the current Excel sheet, you can use the Excel JavaScript API to manipulate the font properties of the data labels. Here’s a general approach:
format property of the data label to access font settings.size property to the desired font size.Here is a sample code snippet that demonstrates how to change the font size:
Excel.run(function (context) {
var chart = context.workbook.worksheets.getActiveWorksheet().charts.getItem("ChartName");
var dataLabel = chart.series.getItemAt(0).dataLabels;
dataLabel.format.font.size = 14; // Set font size to 14
return context.sync();
}).catch(function (error) {
console.log(error);
});
Make sure to replace "ChartName" with the actual name of your chart and adjust the index in getItemAt(0) to target the correct series.
This will change the font size of the data labels in the specified chart on the active worksheet.