Using office scripts to read superScripts characters from a cell in excel online

0 votes
I'm attempting to read data from Excel cells using office scripts; some of the values in these cells are formatted as superscripts. When I use office scripts (Typescript) to read data from these cells, the contents of the cell are returned as regular numbers ( completely ignoring the superscripts , displaying them as usual numbers ). Another problem is that the cell loses its superscript formatting whenever I select its text in Excel Online, and the only way to restore it is by pressing (CTRL + Z).

In the same excel file, I attempted to put in a new cell with data that contained superscripts that I had made and copied from the website SuperScriptGenerator. I can now read the content of the cell using office scripts, and that would display the text of the cell while preserving the superscript characters. I can also pick the cell's content without losing the formatting of the superscript characters.

I am aware that there may be a text encoding problem, but in this instance, on Excel Online, I was unable to determine the text's encoding. The existing superscripts are causing problems (superscripts formatting disappears as I choose the cell content, and shows as regular numbers when reading the cell content with officeScripts/typescript), however the string I copied from the superscript generator and inserted on the excel worked great. Any advice or guidance on this matter?
Nov 16 in Others by Kithuzzz
• 20,660 points
21 views

1 answer to this question.

0 votes

My understanding is that superscript and subscript texts are basically just regular characters rendered with unique formatting capabilities in Office Apps (Excel, Word, PowerPoint, etc.). The HTML tags for "sup" and "sub" are presumably a reasonable counterparts for this.

For example, in HTML, A<sup>2</sup> + B<sup>2</sup> = C<sup>2</sup> will be rendered as:

A2 + B2 = C2

But if you copy it and paste into a plain text editor like Notepad, you will notice it will become:

A2 + B2 = C2

This is because any formatting properties (in this case, the <sup> property) would get lost for plain text.

As of right now, the Office Scripts APIs getValue and getText only handle raw texts and numbers without any formatting features, they behave identically. 

Now you can try to copy this text and paste it into Notepad again:

A² ⁺ B² ⁼ C²

You'll notice the superscripts still look correct in Notepad this time! 

I hope this helps you. 

answered Nov 17 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
1 answer

Change date format of cell in excel from dd.mm.yyyy to yyy/mm/dd ( excel version 2013 )

Hello :)   Excel’s Format Cells function can quickly ...READ MORE

answered Feb 9 in Others by gaurav
• 22,040 points
506 views
0 votes
1 answer
0 votes
1 answer

In Excel, how to find a average from selected cells

If one has the dynamic array formula ...READ MORE

answered Oct 9 in Others by narikkadan
• 37,660 points
47 views
0 votes
1 answer
0 votes
1 answer

Add .xll as AddIn to Excel

Hi, for adding an xll as Addln ...READ MORE

answered Feb 17 in Others by gaurav
• 22,040 points
116 views
0 votes
1 answer

JavaScript API does not work for Excel 2013?

Each method in the Office.js APIs is ...READ MORE

answered Sep 26 in Others by narikkadan
• 37,660 points
43 views
0 votes
1 answer

How to Paste JPEG as a gif in excel?

Solution  Step 1 Navigate to the folder that contains ...READ MORE

answered Oct 2 in Others by narikkadan
• 37,660 points
50 views
0 votes
1 answer

How to merge two cells in excel with same field name

Insert 2 new columns, G & H. Enter ...READ MORE

answered Oct 7 in Others by narikkadan
• 37,660 points
53 views
0 votes
1 answer

How to insert a new row in the specified cell only, of Excel sheet using c#?

I have this worksheet with a matrix ...READ MORE

answered 3 days ago in Others by narikkadan
• 37,660 points
8 views
0 votes
1 answer

Unable to import data in excel from another website using VB code

Replace : Set ieTable = ieDoc.all.Item("report-table") With: Set ieTable = ...READ MORE

answered Sep 21 in Others by narikkadan
• 37,660 points
63 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP