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

Free Support Forum - aspose.com

Want to create spacing in between the list indendation

Hi,

I want to create my document with indentation. Like this :

  1. Clause1

      a. Clause2 
    
         This is a testing clause.
    
     b. Clause3
    
        This is a testing clause.
    
  2. Clause2

      a. Clause2 
    
         This is a testing clause.
    
     b. Clause3
    
        This is a testing clause.
    

But when i write my code , i am not able to get how will i insert the blank line and then insert text (i.e. “This is a testing clause”).

I am using builder.getListFormat().listIndent();

I am able to generate this -

Clause1
  a. Clause2
  b. Clause3

Clause2
  a. Clause2 
  b. Clause3

I need to insert the blank line and then text without incrementing the count of list.

Thanks

@saurabh.arora,

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

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create a list based on a template.
Aspose.Words.Lists.List list1 = doc.Lists.Add(ListTemplate.NumberArabicParenthesis);
// Modify the formatting of the list.
list1.ListLevels[0].Font.Color = Color.Red;
list1.ListLevels[0].Alignment = ListLevelAlignment.Right;

builder.Writeln("List 1 starts below:");
// Use the first list in the document for a while.
builder.ListFormat.List = list1;
builder.Writeln("Item 1" + ControlChar.LineBreak + "This is a testing clause.");
builder.Writeln("Item 2" + ControlChar.LineBreak + "This is a testing clause.");
builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "output.docx");

Thanks for the reply.

I need to have different formatting style for the texts , in your case “Item 1” and "This is a testing clause.

I need to have different fonts format for the both texts.

Thanks

@saurabh.arora,

Thanks for your inquiry. In this case, please use following code example. If you still face problem, please share your expected output Word document. We will then provide you more information about your query along with code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create a list based on a template.
Aspose.Words.Lists.List list1 = doc.Lists.Add(ListTemplate.NumberArabicParenthesis);
// Modify the formatting of the list.
list1.ListLevels[0].Font.Color = Color.Red;
list1.ListLevels[0].Alignment = ListLevelAlignment.Right;

builder.Writeln("List 1 starts below:");
// Use the first list in the document for a while.
builder.ListFormat.List = list1;
builder.Font.Size = 10;
builder.Write("Item 1" + ControlChar.LineBreak);
builder.Font.Size = 12;
builder.Font.Bold = true;
builder.Writeln("This is a testing clause.");

builder.Font.Size = 10;
builder.Font.Bold = false;
builder.Write("Item 1" + ControlChar.LineBreak);
builder.Font.Bold = true;
builder.Font.Size = 12;
builder.Writeln("This is a testing clause.");

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + "output.docx");