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, 2022 in Others by Kithuzzz
• 38,010 points
548 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, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

Activating a Specific Cell in Excel Using VBA Results to Error 400

I think you trying to select cells(4, ...READ MORE

answered Dec 27, 2022 in Others by narikkadan
• 63,420 points
351 views
0 votes
1 answer

How to remove borders from cells in a range in Excel using VB.net?

range.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle ...READ MORE

answered Jan 5, 2023 in Others by narikkadan
• 63,420 points
1,130 views
0 votes
1 answer

Is there a way to test a formula result in excel and type it only once, all within one cell and not using a user defined function?

Use the Let function: =LET(Value,A1+B2+C4+G3+B4,IF(Value>10,"No",Value)) I hope this helps ...READ MORE

answered Jan 9, 2023 in Others by narikkadan
• 63,420 points
411 views
0 votes
1 answer

Using Visual Basic to pull data from within a range to use in an Excel function

Use AVERAGEIFS instead of the full range. ...READ MORE

answered Jan 14, 2023 in Others by narikkadan
• 63,420 points
307 views
0 votes
1 answer

Add .xll as AddIn to Excel

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

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
942 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, 2022 in Others by narikkadan
• 63,420 points
403 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, 2022 in Others by narikkadan
• 63,420 points
394 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, 2022 in Others by narikkadan
• 63,420 points
1,211 views
0 votes
1 answer
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 Nov 24, 2022 in Others by narikkadan
• 63,420 points
1,871 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