OfficeJs - Get Font/Theme colors of excel/powerpoint file

384 Views Asked by At

How can i get excel/powerpoint theme colors in font settings via officeJs?

Is it possible at all?

I need first row, but if i get all rows it is not problem.

1

There are 1 best solutions below

3
Raymond Lu On

You may have a try Office.OfficeTheme API, see if this API works for you. the document can be found at https://learn.microsoft.com/en-us/javascript/api/office/office.officetheme?view=word-js-preview,

function applyOfficeTheme(){
    // Get office theme colors.
    var bodyBackgroundColor = Office.context.officeTheme.bodyBackgroundColor;
    var bodyForegroundColor = Office.context.officeTheme.bodyForegroundColor;
    var controlBackgroundColor = Office.context.officeTheme.controlBackgroundColor;
    var controlForegroundColor = Office.context.officeTheme.controlForegroundColor;

    // Apply body background color to a CSS class.
    $('.body').css('background-color', bodyBackgroundColor);
}

if this doesnt work for you, that should be a new feature ask, and then you could submit your request in uservoice and upvote for this feature at https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback?category_id=163563. and upvote for this feature. thanks for your support