Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8746549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:12:42+00:00 2026-06-13T12:12:42+00:00

I’m working on a program in C# that uses Microsoft Word 14.0 Object Library

  • 0

I’m working on a program in C# that uses Microsoft Word 14.0 Object Library to create a .doc file, add paragraphs to it and saves it. There is a small form with a button that does described actions (see the code below). This part has no problems.

Problem:

Current text in created word file will be the following:

Some text beff = 3.0

What I need to accomplish, is creating a paragraph, which has subscript characters inside.(in paragraph above letters “eff” should be subscripted):

enter image description here

The final document would contain around 100 of lines like above, with different characters that are subscripted.

I found a way to subscript the whole paragraph with line,

paragraph1.Range.Font.Subscript = 1;

but found no way to implement it on separate characters.

I’m also aware that there are subscript letters and numbers in Unicode that I could use, but, unfortunately, Unicode does not have full alphabet in subscript format, so that is not an option either.

Question:
Is there a way for me to accomplish the Goal and insert something like “eff“ in subscript inside a paragraph in a freshly created Word Document?

Sample code:

private void btnReport_Click(object sender, EventArgs e)
    {

        Word._Application oWord;
        Word._Document oDoc;
        oWord = new Word.Application();
        oDoc = oWord.Documents.Add();


        var paragraph1 = oDoc.Content.Paragraphs.Add();
        paragraph1.Range.Text = "Some text   beff = 3.0";

        SaveFileDialog saveFileDialog1 = new SaveFileDialog();
        saveFileDialog1.Filter = "Word document|*.doc";
        saveFileDialog1.Title = "Save the Word Document";
        if (DialogResult.OK == saveFileDialog1.ShowDialog())
        {
            string docName = saveFileDialog1.FileName;
            if (docName.Length > 0)
            {
                object oDocName = (object)docName;
                oDoc.SaveAs(ref oDocName);
            }
        }
        oWord.Quit();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:12:43+00:00Added an answer on June 13, 2026 at 12:12 pm

    Create a Word document and add text with subscipt/superscript and unzip the .docx to examine it’s XML content you will notice that the text containing the subscript/superscript is placed in a separate run element.

    One way to achieve this is OpenXML SDK.Once you’ve downloaded and installed the SDK you can use the following code:

    using System;
    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    
    namespace OpenXML
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (var doc = WordprocessingDocument.Create("C:\\Subscript.docx", WordprocessingDocumentType.Document))
                {
                    MainDocumentPart mainPart = doc.AddMainDocumentPart();
    
                    mainPart.Document = new Document();
                    Body body = mainPart.Document.AppendChild(new Body());
                    Paragraph p = body.AppendChild(new Paragraph());
    
                    p.AppendChild(AddRun(false, "Some text   b "));
                    p.AppendChild(AddRun(true, "eff"));
                    p.AppendChild(AddRun(false, "= 3.0"));
                }
    
                Console.WriteLine("Done...");
                Console.ReadLine();
            }
    
            public static Run AddRun(bool isSubscript, string text)
            {
                Run run = new Run();
                if (isSubscript)
                {
                    var props = new RunProperties();
                    var fontSize = new FontSizeComplexScript() { Val = "20" };
                    var vAlignment = new VerticalTextAlignment() { Val = VerticalPositionValues.Subscript };
    
                    props.Append(fontSize);
                    props.Append(vAlignment);
                    run.Append(props);
                }
                run.Append(new Text(text));
                return run;
            }
        }
    }
    

    EDIT:

    And here’s a Interop solution:

        using WordNS = Microsoft.Office.Interop.Word;
    
        WordNS.Document doc = _application.ActiveDocument;
        WordNS.Paragraph p = doc.Paragraphs.Add();
        p.Range.Text = "Some text   beff = 3.0";
    
        int start = p.Range.Text.IndexOf("eff");
        int end = p.Range.Text.IndexOf("=");
    
        WordNS.Range range = doc.Range(start, end);
        range.Select();
    
        WordNS.Selection currentSelection = _application.Selection;
        currentSelection.Font.Subscript = 1;
    
        doc.SaveAs2("C:\\SubscriptInterop.docx");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a program that deals with a file that uses hashes. The
I am working on a program that uses IE to display its help pages.
Greetings, Forum. I'm working on a program in Python that uses Twisted to manage
I'm working on a program that takes in a Wavefront .obj file and eventually
Working with a program that uses 16bytes 4v4 one byte matrices : unsigned char
I'm working on a program that uses HTML/CSS/Javascript/JQuery for its user interface. One of
I am working on a C program that uses a Union. The union definition
I have been working on a Android Web Services program that uses a number
I was working with a program that uses a function to set a new
I wrote a program that uses OLE and it was working fine until I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.