Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Apr 19, 2023 11:34 pm

Hi,

I am trying convert numeric values from the word document into superscript using C# and Spire. It is working for some instances but then some unwanted HTML like data is generating before the values, as below.

inleishmaniasis ADDINEN.CITE<EndNote><Cite><Author>Martori</Author><Year>2021</Year><RecNum>23</RecNum><DisplayText>[9].


Here is how the actual data in the document looks like,

thus Vitamin D can have an appropriate effect inleishmaniasis (9).


I tried below steps as I found on internet but no still luck!

Word 2007: Choose Office button (top left) > Word Options (bottom).
Word 2010/2013/2016: Choose File > Options.
Choose Advanced (left menu) and scroll down to the section titled "Show Document Content."
Uncheck the item titled "Show field codes instead of their values" and click OK.

Pasted below is my code,
foreach (var item in excludeSuperscript)
{
Spire.Doc.Documents.TextSelection[] selectionSup = destinationDoc.FindAllString(item, true, true);
if (selectionSup != null)
{
//Change font style for all occurrences of the word
foreach (Spire.Doc.Documents.TextSelection text in selectionSup)
{
text.GetAsOneRange().CharacterFormat.SubSuperScript = SubSuperScript.SuperScript;
break;
}
}
}


I am new to using Spire with C#, your inputs will be really helpful.

Thanks,
Shashi

shashiSpries
 
Posts: 1
Joined: Wed Apr 19, 2023 11:24 pm

Thu Apr 20, 2023 5:35 am

Hi,

Thanks for your message.
To help look into your issue accurately, please provide us with the following more information. Thanks in advance.
1.Your input Word file, which you can upload it here or provide to us by email ([email protected]).
2. Your desired output effect.
3.Your complete code.

Best Regards,
Herman
E-iceblue support team
User avatar

Herman.Yan
 
Posts: 115
Joined: Wed Mar 08, 2023 2:00 am

Return to Spire.Doc

cron