Spire.DocViewer for .NET is a powerful Word Viewer component for developers to display, convert and interact with Word Documents easily.

Fri Apr 10, 2020 11:25 am

How to set "space" after number? I alse see the tabspaceafter at liststyle.

Liyuanyuan
 
Posts: 13
Joined: Tue Mar 17, 2020 1:12 pm

Mon Apr 13, 2020 9:40 am

Hello,

Thanks for your inquiry.
Our Spire.DocViewer product just supports viewing Word document, not support manipulating Word document. Do you want to use our Spire.Doc to manipulate Word document? If so, please refer to the following code.
Code: Select all
            //Create word document
            Document document = new Document();
            Section section = document.AddSection();

            //Create a list style
            ListStyle listStyle = new ListStyle(document, ListType.Numbered);
            listStyle.Name = "levelstyle";
            listStyle.Levels[0].PatternType = ListPatternType.Arabic;
            listStyle.Levels[0].NumberPosition = -28.3f;
            listStyle.Levels[0].TabSpaceAfter = 0;
            listStyle.Levels[0].TextPosition = 28.3f;
            document.ListStyles.Add(listStyle);

            //Add the first paragarph
            Paragraph paragraph = section.AddParagraph();
            TextRange tr = paragraph.AppendText("Paragraph 1");
            paragraph.ListFormat.ApplyStyle("levelstyle");

            //Add the second paragarph
            paragraph = section.AddParagraph();
            tr = paragraph.AppendText("Paragraph 2");
            paragraph.ListFormat.ApplyStyle("levelstyle");

            document.SaveToFile("result.docx");

If this is not what you want, please provide your desired output for further investigation.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Apr 15, 2020 12:11 pm

Image
Set the number with "space" instead of "tab"。

Liyuanyuan
 
Posts: 13
Joined: Tue Mar 17, 2020 1:12 pm

Thu Apr 16, 2020 1:28 am

Hello,

Thanks for your more information.
Please refer to the following code snippet to achieve your requirements. If there is any other question, please feel free to let us know.
Code: Select all
listStyle.Levels[0].FollowCharacter = FollowCharacterType.Space;


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Apr 16, 2020 9:07 am

This is my first time to use spire.doc,Thank you for your help

Liyuanyuan
 
Posts: 13
Joined: Tue Mar 17, 2020 1:12 pm

Thu Apr 16, 2020 11:07 am

Hello,

You are welcome.
Feel free to contact us if you need further assistance. Wish you all the best!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon Jan 08, 2024 3:39 pm

Thank you for info!

Michael_Merel24
 
Posts: 3
Joined: Mon Jan 08, 2024 3:34 pm

Return to Spire.DocViewer