We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How do I set text is title that I have already defined in the document

1、How do I set text is title that I have already defined in the document,The title with a list of.

Hi there,

Thanks for your inquiry. Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.
This is question 1
File attachment:TestSource.Docx is my source file, Target.docx is my target file

File attachment is question 3.I have defined multilevel list style in the document

Hi there,

Thanks for sharing the detail.
lovecomputer:
This is question 1
File attachment:TestSource.Docx is my source file, Target.docx is my target file
Regarding your first question, please use latest version of Aspose.Words for .NET 16.11.0 and following modifed code example to get the desired output.

Document doc = new Document(MyDir + "TestSource.Docx");

doc.Styles["TestTitleNumber"].ParagraphFormat.PageBreakBefore = false;

doc.Styles["TestTitleNumber"].ParagraphFormat.Alignment = ParagraphAlignment.Left;

doc.Styles["TestTitleNumber"].ParagraphFormat.FirstLineIndent = 0;

foreach (Aspose.Words.Paragraph p in doc.Sections[0].Body.Paragraphs)

{

if (p.Range.Text.Contains(""))

{

// The TestTitleNumber style name,I have already defined in the document.

p.ParagraphFormat.StyleName = "TestTitleNumber";

p.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;

p.Range.Replace(new Regex(""), "", new FindReplaceOptions());

}

if (p.Range.Text.Contains(""))

{

p.ParagraphFormat.StyleName = "TestTitleNumber";

p.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;

p.Range.Replace(new Regex(""), "", new FindReplaceOptions());

}

if (p.Range.Text.Contains(""))

{

p.ParagraphFormat.StyleName = "TestTitleNumber";

p.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;

p.Range.Replace(new Regex(""), "", new FindReplaceOptions());

}

}

doc.Save(MyDir + "Out v16.11.0.docx");

lovecomputer:
File attachment is question 3.I have defined multilevel list style in the document,this multilevel list style in the document is :
How do I get this multilevel list through code?
The question 2 is:How can I through the code to create multilevel list,the multilevel list style is:
ListLevel.NumberFormat property returns or sets the number format for the list level. Among normal text characters, the string can contain placeholder characters \x0000 to \x0008 representing the numbers from the corresponding list levels.

For example, the string "\x0000.\x0001)" will generate a list label that looks something like "1.5)". The number "1" is the current number from the 1st list level, the number "5" is the current number from the 2nd list level.

Please check the following code example for your kind reference.


Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberDefault);

builder.ListFormat.ListLevel.Font.Bold = true;

builder.ListFormat.ListLevel.Font.Color = Color.Red;

builder.Writeln("Main Section1");

builder.ListFormat.ListIndent();

builder.ListFormat.ListLevel.Font.Italic = true;

builder.ListFormat.ListLevel.Font.Color = Color.Green;

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.Arabic;

builder.ListFormat.ListLevel.NumberFormat = "\x0000.\x0001";

builder.Writeln("Sub Section1.1 ");

builder.ListFormat.ListIndent();

builder.ListFormat.ListLevel.Font.Underline = Underline.Dash;

builder.ListFormat.ListLevel.Font.Color = Color.Blue;

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.Arabic;

builder.ListFormat.ListLevel.NumberFormat = "\x0000.\x0001.\x0002";

builder.Writeln("Sub Section 1.1.1");

builder.ListFormat.ListOutdent();

builder.Writeln("Sub Section 1.2 ");

builder.ListFormat.ListOutdent();

builder.Writeln("Main Section2");

builder.ListFormat.ListIndent();

builder.Writeln("Sub Section2.1");

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + @"out.docx");


Hope this helps you. Please let us know if you have any more queries.

how set the number format is

by ListLevel.NumberFormat

how set continue number by multilist?

Hi there,


Thanks for your inquiry. Please use following code example to get the desired output. Hope this helps you.

Document doc = new Document();<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder(doc);

builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberDefault);

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.SimpChinNum3;

builder.ListFormat.ListLevel.NumberFormat = "\0 ";

for (int i = 1; i <= 10; i++)

{

builder.Writeln("Item "+i);

}

builder.ListFormat.ListIndent();

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.SimpChinNum3;

builder.ListFormat.ListLevel.NumberFormat = "\u0000).\u0001)";

builder.Writeln("Sub Section1.1 ");

builder.Writeln("Sub Section1.1 ");

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "Out v16.11.0.docx");

help me,thanks

Hi there,

Thanks for your inquiry. Please use following code example to get the shared output. Hope this helps you.

If you still face problem, please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

List list = doc.Lists.Add(ListTemplate.NumberDefault); ;

list.ListLevels[0].NumberStyle = NumberStyle.SimpChinNum3;

list.ListLevels[1].NumberStyle = NumberStyle.Arabic;

list.ListLevels[2].NumberStyle = NumberStyle.Arabic;

list.ListLevels[1].NumberFormat = "\u0001";

list.ListLevels[2].NumberFormat = "\u0001.\u0002";

builder.ListFormat.List = list;

for (int i = 1; i <= 10; i++)

{

builder.Writeln("Item " + i);

}

builder.ListFormat.ListIndent();

builder.Writeln("Sub Section ");

builder.ListFormat.ListIndent();

builder.Writeln("Sub Section 1.1");

builder.Writeln("Sub Section 1.2");

builder.ListFormat.ListOutdent();

builder.Writeln("Sub Section 2 ");

builder.ListFormat.ListIndent();

builder.Writeln("Sub Section 2.1");

builder.Writeln("Sub Section 2.2");

builder.Writeln("Sub Section 2.3");

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "Out v16.11.0.docx");

How do I set enclosed parentheses ListFormat,For example, ①②③④,

The enclosed parenthesis is the character code 2460(in word) format

After I create a new bulleted list,How can I add this created current new bulleted list to word list of library(or Word list templates library)?
Hi there,

Thanks for your inquiry. Please use following code example to achieve your requirements. Hope this helps you.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

List list = doc.Lists.Add(ListTemplate.NumberDefault); ;

list.ListLevels[0].NumberStyle = NumberStyle.NumberInCircle;

builder.ListFormat.List = list;

for (int i = 1; i <= 10; i++)

{

builder.Writeln("Item " + i);

}

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "Out v16.11.0.docx");

After I create a new bulleted list,How can I add this created current new bulleted list to word list of library(or Word list templates library)?


How to write code to add a directory which newly created to the list library in Microsoft Office Word?

Attachment is what I want effect
Hi there,

Thanks for your inquiry. The ListCollection.Add method creates a new list based on a predefined template and adds it to the collection of lists in the document. Please check the following highlighted line of code.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

List list = doc.Lists.Add(ListTemplate.NumberDefault); ;

list.ListLevels[0].NumberStyle = NumberStyle.NumberInCircle;

builder.ListFormat.List = list;

for (int i = 1; i <= 10; i++)

{

builder.Writeln("Item " + i);

}

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "Out v16.11.0.docx");

After I create a new bulleted list,How can I add this created current new bulleted list to word list of library(or Word list templates library)?


How to write code to add a directory which newly created to the list library in Microsoft Office Word?

Attachment is what I want effect

Hi there,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-14531 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@lovecomputer,

Regarding WORDSNET-14531, could you please ZIP and attach your expected output word document here for our reference? It will help us to understand your requirement. We will then implement the requested feature accordingly. Thanks for your cooperation.