List Format

Hi,
I am trying to insert a html. I am getting the output as
· These are impacts****
· these are risks involved in this project and whtejgjgggjgvgjjhkhkhkhkhkhkhkhkhkhkhkh khkhkhkhkhkhkhkhkhkhkhkhkhkhkhhkhkh
· hjkgjgjgggggggggggggggggffffffffffddddddddd ddddddjjjjjjjjjjjjjjjjjjjjjjjjhhhhhhhhhhhhhhhhhhhhh hhhhhjjjjjjjjjjjjjjjjjjjjjjjjhgjdgg
But I want to get tthe output as

  • These are impacts
  • these are risks involved in this project and whtejgjgggjgvgjjhkhkhkhkhkhkhkhkhkhkhkh khkhkhkhkhkhkhkhkhkhkhkhkhkhkhhkhkh
  • hjkgjgjgggggggggggggggggffffffffffddddddddd ddddddjjjjjjjjjjjjjjjjjjjjjjjjhhhhhhhhhhhhhhhhhhhhh hhhhhjjjjjjjjjjjjjjjjjjjjjjjjhgjdgg

I am using the below code.

builder.Font.Size = 10;
builder.Font.Name = "Verdana";
builder.Font.Bold = false;
builder.ParagraphFormat.LeftIndent = 40;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
currNode = builder.CurrentParagraph;
builder.InsertHtml(Server.HtmlDecode(dtScope.Rows[0][AppConstants.ImpactAndRisks].ToString()));
do {
    if (currNode.NodeType == NodeType.Paragraph)
    {
        Paragraph currentPar = (Paragraph) currNode;
        currentPar.ParagraphFormat.LeftIndent = 40;
        if (currentPar.IsListItem)
        {
            currentPar.ListFormat.ListLevel.NumberPosition = 40;
        }
    }
    // move to the next node
    currNode = currNode.NextSibling;
    if (currNode == null)
        break;
} while (currNode != (builder.CurrentParagraph));
builder.Write(ControlChar.LineBreak);
builder.ParagraphFormat.ClearFormatting();

Can you please give me the solution for this?

Hi

Thanks for your request. I think you should play with NumberPosition, TabPosition and TextPosition values in your post-processing code. Please see the following snippet of code:

// Perform post-processing
do {
    if (currNode.NodeType == NodeType.Paragraph)
    {
        Paragraph currentPar = (Paragraph) currNode;
        currentPar.ParagraphFormat.LeftIndent = 40;
        if (currentPar.IsListItem)
        {
            currentPar.ListFormat.ListLevel.NumberPosition = 40;
            currentPar.ListFormat.ListLevel.TabPosition = 40;
            currentPar.ListFormat.ListLevel.TextPosition = 40;
        }
    }
    // move to the next node
    currNode = currNode.NextSibling;
}
while (currNode != null && !currNode.Equals(builder.CurrentParagraph));

Change values of NumberPosition, TabPosition and TextPosition as you need.
Best regards.

Hi,
Can you please explain me the concept of tab position & text position?
Than only I can implement that on my code.

Hi

Thanks for your request. Please see the documentation for more information:
https://reference.aspose.com/words/net/aspose.words.lists/listlevel/numberposition/
https://reference.aspose.com/words/net/aspose.words.lists/listlevel/tabposition/
https://reference.aspose.com/words/net/aspose.words.lists/listlevel/textposition/
Best regards.

Hi;
I had tried different number position, text position & tab position.
But I am not getting what I want. Can you please help me out?
I am using this code.

builder.Font.Size = 10;
builder.Font.Name = "Verdana";
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
currNode = builder.CurrentParagraph;
builder.InsertHtml(Server.HtmlDecode(dtScope.Rows[0][AppConstants.ImpactAndRisks].ToString()));
do {
    if (currNode.NodeType == NodeType.Paragraph)
    {
        Paragraph currentPar = (Paragraph) currNode;
        currentPar.ParagraphFormat.LeftIndent = 40;
        currentPar.ParagraphFormat.StyleIdentifier = StyleIdentifier.Normal;
        if (currentPar.IsListItem)
        {
            currentPar.ListFormat.ListLevel.NumberPosition = 50;
            currentPar.ListFormat.ListLevel.TabPosition = 40;
            currentPar.ListFormat.ListLevel.TextPosition = 50;
            // currentPar .ListFormat .ListLevel .TrailingCharacter =ListTrailingCharacter .Tab;
            // currentPar .ListFormat .ListLevel .Alignment =ListLevelAlignment .Left ;
            currentPar.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
        }
    }
    // move to the next node
    currNode = currNode.NextSibling;
    if (currNode == null)
        break;
} while (currNode != (builder.CurrentParagraph));
I am getting the output as

· These are impacts ang ajgghk mjgjg kkhyut jgjght jgy jhjgjg jgg gkhg kgj hkjg khg ,h gjgj jg gjkkhjtj jt t****
· these are risks involved in this project whtejgjgggjg vgjjhkhkhkhk hkhkhkhkhk hkhkh khkhkh khkhkhkhkhkhk hkhkhkhkhkh hkhkh
· hjkgj jggggggg ggggggg gggfffff fffffdd ddddddd ddddddjjj jjjjjjjjj hhhhhhhhh hhhhhj jjjjjjjjjjjjjjjj jjjjjjjh gjdgg
I want the margin as 40.

Hi

Thanks for your request. Please attach your HTML string for testing. I will investigate the issue and provide you more information.
Best regards.

Hi.
The html string is:

<UL><LI>These are impacts ang ajgghk mjgjg kkhyut jgjght jgy jhjgjg jgg gkhg kgj hkjg khg ,h gjgj jg gjkkhjtj jt t<LI>these are risks involved in this project whtejgjgggjg vgjjhkhkhkhk hkhkhkhkhk hkhkh khkhkh khkhkhkhkhkhk hkhkhkhkhkh hkhkh<LI>hjkgj jggggggg ggggggg gggfffff fffffdd ddddddd ddddddjjj jjjjjjjjj hhhhhhhhh&nbsp; hhhhhj jjjjjjjjjjjjjjjj jjjjjjjh gjdgg</LI></UL>

My code is

builder.Font.Size = 10;
builder.Font.Name = "Verdana";
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Justify;
currNode = builder.CurrentParagraph;
builder.InsertHtml(Server.HtmlDecode(dtScope.Rows[0][AppConstants.ImpactAndRisks].ToString()));
do {
    if (currNode.NodeType == NodeType.Paragraph)
    {
        Paragraph currentPar = (Paragraph) currNode;
        currentPar.ParagraphFormat.LeftIndent = 40;
        currentPar.ParagraphFormat.StyleIdentifier = StyleIdentifier.Normal;
        if (currentPar.IsListItem)
        {
            currentPar.ListFormat.ListLevel.NumberPosition = 40;
            currentPar.ListFormat.ListLevel.TabPosition = 50;
            currentPar.ListFormat.ListLevel.TextPosition = 80;
        }
    }
    // move to the next node
    currNode = currNode.NextSibling;
    if (currNode == null)
        break;
} while (currNode != (builder.CurrentParagraph));

I want the exact postion.
The margin is 40 .

Hi

Thanks for your request. Please try using the following code:

//Insert HTML
builder.InsertHtml("<UL><LI>These are impacts ang ajgghk mjgjg kkhyut jgjght jgy jhjgjg jgg gkhg kgj hkjg khg ,h gjgj jg gjkkhjtj jt t<LI>these are risks involved in this project whtejgjgggjg vgjjhkhkhkhk hkhkhkhkhk hkhkh khkhkh khkhkhkhkhkhk hkhkhkhkhkh hkhkh<LI>hjkgj jggggggg ggggggg gggfffff fffffdd ddddddd ddddddjjj jjjjjjjjj hhhhhhhhh&nbsp; hhhhhj jjjjjjjjjjjjjjjj jjjjjjjh gjdgg</LI></UL>");
 
//Perform post-processing 
do
{
    if (currNode.NodeType == NodeType.Paragraph)
    {
        Paragraph currentPar = (Paragraph)currNode;
        if (currentPar.IsListItem)
        {
            currentPar.ListFormat.ListLevel.NumberPosition = 40;
            currentPar.ListFormat.ListLevel.TabPosition = 55;
            currentPar.ListFormat.ListLevel.TextPosition = 55;
        }
        else
        {
            currentPar.ParagraphFormat.LeftIndent = 40;
        }
    }
    // move to the next node
    currNode = currNode.NextSibling;
}
while (currNode != null && !currNode.Equals(builder.CurrentParagraph));

Also see the attached image.

Hope this helps.

Best regards.

Hi,
Thanks for your support. Now its working fine.