WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit cd29948

Browse files
committed
Updated the comments
1 parent 25ceace commit cd29948

File tree

1 file changed

+2
-3
lines changed
  • Find-item-in-word-document/Retrieve-and-replace-superscript-subscript-text/.NET/Retrieve-and-replace-superscript-subscript-text

1 file changed

+2
-3
lines changed

Find-item-in-word-document/Retrieve-and-replace-superscript-subscript-text/.NET/Retrieve-and-replace-superscript-subscript-text/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ public static void Main(string[] args)
2525
/// <param name="displayNormalText">True if the replaced text should be converted to normal text; false to keep formatting.</param>
2626
static void ReplaceSuperscriptAndSubscriptText(WordDocument document, string subSuperScriptType, bool displayNormalText)
2727
{
28-
// Find all text ranges in the document that have superscript or subscript formatting.
28+
// Find all text ranges with the given superscript or subscript formatting.
2929
List<Entity> textRangesWithsubsuperScript = document.FindAllItemsByProperty(EntityType.TextRange, "CharacterFormat.SubSuperScript", subSuperScriptType);
30-
// Replace the super script text
3130
for (int i = 0; i < textRangesWithsubsuperScript.Count; i++)
3231
{
3332
// Cast the entity to a text range.
3433
WTextRange textRange = textRangesWithsubsuperScript[i] as WTextRange;
35-
// Replace the text
34+
// Replace the existing text with new content
3635
textRange.Text = $"<{subSuperScriptType}> {textRange.Text} </{subSuperScriptType}>";
3736
// If the replaced content displayed as normal text
3837
if(displayNormalText)

0 commit comments

Comments
 (0)