I am developing an Excel add-in that extracts the text of cell A1, INCLUDING its format, and displays the text in its area. Thus, the appendix contains this (see screenshot below): • Area for displaying formatted text • Button for starting extraction
Press to view image
Below is the code I use to get the text
function displaySelectedCells() {
Office.context.document.getSelectedDataAsync(Office.CoercionType.Text,
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
showNotification('The selected text is:', '"' + result.value + '"');
} else {
showNotification('Error', result.error.message);
}
});
}
The code above uses "CoercionType" as "Text." I tried a lot to find a solution for getting text in the format written in the sheet cell. The answer I get is just the text on the plane :( Please help me solve the problem