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 528465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:59:22+00:00 2026-05-13T08:59:22+00:00

I am using Interop.Microsoft.Office.Interop.Word.dll to dynamically build a Word document in C#. Does anyone

  • 0

I am using Interop.Microsoft.Office.Interop.Word.dll to dynamically build a Word document in C#.

Does anyone have a code example to create a a numbered list?

  • 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-05-13T08:59:22+00:00Added an answer on May 13, 2026 at 8:59 am

    Try this… it assumes you have a reference to Word10 (you can use other versions, you’ll have to change the constants). Don’t forget the using Microsoft.Office.Interop.Word;

    // setup
    object missing = System.Reflection.Missing.Value;
    ApplicationClass app = new ApplicationClass();
    Document doc = app.Documents.Add(ref missing, ref missing, 
        ref missing, ref missing);
    app.Visible = true;
    
    // whatever is selected will be turned into a numbered list.
    object n = 1;
    ListTemplate template = 
        app.ListGalleries[WdListGalleryType.wdNumberGallery].ListTemplates.get_Item(ref n);
    ListLevel level = template.ListLevels[1];
    level.NumberFormat = "%1.";
    level.TrailingCharacter = WdTrailingCharacter.wdTrailingTab;
    level.NumberStyle = WdListNumberStyle.wdListNumberStyleArabic;
    level.NumberPosition = app.InchesToPoints(0.25f);
    level.Alignment = WdListLevelAlignment.wdListLevelAlignLeft;
    level.TextPosition = app.InchesToPoints(0.5f);
    level.TabPosition = (float)WdConstants.wdUndefined;
    level.ResetOnHigher = 0;
    level.StartAt = 1;
    
    level.Font.Bold = (int)WdConstants.wdUndefined;
    level.Font.Italic = (int)WdConstants.wdUndefined;
    level.Font.StrikeThrough = (int)WdConstants.wdUndefined;
    level.Font.Subscript = (int)WdConstants.wdUndefined;
    level.Font.Superscript = (int)WdConstants.wdUndefined;
    level.Font.Shadow = (int)WdConstants.wdUndefined;
    level.Font.Outline = (int)WdConstants.wdUndefined;
    level.Font.Emboss = (int)WdConstants.wdUndefined;
    level.Font.Engrave = (int)WdConstants.wdUndefined;
    level.Font.AllCaps = (int)WdConstants.wdUndefined;
    level.Font.Hidden = (int)WdConstants.wdUndefined;
    level.Font.Underline = WdUnderline.wdUnderlineNone;
    level.Font.Color = WdColor.wdColorAutomatic;
    level.Font.Size = (int)WdConstants.wdUndefined;
    level.Font.Animation = WdAnimation.wdAnimationNone;
    level.Font.DoubleStrikeThrough = (int)WdConstants.wdUndefined;
    
    level.LinkedStyle = "";
    
    template.Name = "";
    object bContinuePrevList = false;
    object applyTo = WdListApplyTo.wdListApplyToWholeList;
    object defBehavior = WdDefaultListBehavior.wdWord10ListBehavior;
    
    app.Selection.Range.ListFormat.ApplyListTemplateWithLevel(
        template, ref bContinuePrevList, 
        ref applyTo, ref defBehavior, ref missing);
    

    edit: formatting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to make horizontal orientation (album) word document using Microsoft.Office.Interop.Word
I'm using the following code to generate an Excel file using Microsoft.Interop.Excel. The problem
I managed to run Microsoft Office Word 2007 and programmatically manipulate doc files in
I'm trying to find a way using the Office.Interop.Outlook COM object to connect to
I have a windows service written in c# which reads the text from word
I have a large amount of Word documents that I need to parse. As
I am trying to retrieve the value of all fields in a word document
I'm using the Excel interop and it seems to be creating a process every
I'm trying to create a mail item and add some attachments to it using
Recently deployed my web app on Windows Server2008, IIS7 (with Office installed). After chasing

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.