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

Free Support Forum - aspose.com

Adding tab stop

@alexey.noskov I am trying to set the tab stop 0.65 for Heading 3 but it’s not working and the below code I used its. Kindly help me asap.

Please find the below input and expected output word document.
Expected_output200.docx (19.4 KB)
Input_headding3.docx (22.6 KB)

public static void Test(Document doc)
{
    var value = 0.65;
    Style heading3 = doc.Styles[StyleIdentifier.Heading3];

    if (heading3.ParagraphFormat.TabStops.ToString() != ConvertUtil.InchToPoint(Convert.ToDouble(value)).ToString())
    {
        heading3.ParagraphFormat.TabStops.Add(ConvertUtil.InchToPoint(Convert.ToDouble(value)), TabAlignment.Left, TabLeader.None);
    }
}

@Manasahr The condition in your code is always true. Since heading3.ParagraphFormat.TabStops is a collection and TabStops.ToString() always returns "Aspose.Words.TabStopCollection" and this value never be equal double string value.
If you need to check whether there is already a tab stop at the specified position you should use code like this:

Document doc = new Document(@"C:\Temp\in.docx");

Style heading3 = doc.Styles[StyleIdentifier.Heading3];

double tabStopPosition = ConvertUtil.InchToPoint(0.65);
// Check whether there is a tabsop at the specified position.
if (heading3.ParagraphFormat.TabStops[tabStopPosition] == null)
    heading3.ParagraphFormat.TabStops.Add(tabStopPosition, TabAlignment.Left, TabLeader.None);

doc.Save(@"C:\Temp\out.docx");

In the output document tab stop is properly added to the Heading 3 style: