How to remove tabstop inherited from style

Hello,

i want to remove a tabstop from a paragraph that gets inherited from a paragraphstyle without removing itself from the style.
I cant find anything in the documentation and the posts on the forum are so old that the samples are no longer available.

Codesnitppet:

var doc = new WordDocument();
var s = doc.AddSection();
var p = s.AddParagraph();
var normal = doc.Styles.FindByName("Normal") as WParagraphStyle;
normal.ParagraphFormat.Tabs.AddTab(300, TabJustification.Centered, TabLeader.NoLeader); // Tabstop in the style
p.ApplyStyle("Normal");
p.AppendText("blub1\tblub2\tblub3");
p.ParagraphFormat.Tabs.AddTab().DeletePosition = 300; // doesn't do anything
doc.Save("tab.docx");

Best regards



3 Replies

MR Manikandan Ravichandran Syncfusion Team March 6, 2020 01:07 PM UTC

Hi Robin,

Thank you for contacting Syncfusion support.

On further analysing the provided code example, to achieve your requirement with “Remove tab stop from the paragraph”, we suggest you to use the following code example in your sample to resolve the reported problem.

 
p.ParagraphFormat.Tabs.AddTab().DeletePosition = 300 * DLSConstants.TwipsInOnePoint; 

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



RD Robin Dostal March 9, 2020 09:36 AM UTC

Thanks,

that did the trick.

Best regards


VA Vijayasurya Anandhan Syncfusion Team March 9, 2020 09:51 AM UTC

Hi Robin,

Thank you for your update and confirmation.

We are glad to know that the provided solution was helpful.

Please let us know if you need further assistance in this. As always, we will be happy to assist you. 

Regards,
Vijayasurya A


Loader.
Up arrow icon