Create a two content controls on same line

Hi ,
I have a simple requirement where I want to create a two content controls (StructuredDocuemntTag) on same line.

I tried to create but it always create it on new line.
I also checked the documentation but it did not help.
Can you please provide me some example to create content controls on same line ?

@bipih.oswal,

Please check the following code that inserts two RichText content controls in the same Line/Paragraph. Hope, this helps.

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

builder.Writeln("before");
builder.InsertParagraph();
Paragraph para = (Paragraph)builder.CurrentParagraph.PreviousSibling;
builder.Writeln("after");

StructuredDocumentTag sdt = new StructuredDocumentTag(doc, SdtType.RichText, MarkupLevel.Inline);
sdt.ChildNodes.Clear();
sdt.AppendChild(new Run(doc, "STD"));
para.AppendChild(sdt);
para.AppendChild(sdt.Clone(true));

doc.Save(@"E:\Temp\19.8.docx");

Thanks hafeez. It resolves my problem.

@bipih.oswal,

Thanks for your feedback. Please let us know if you have any troubles in future and we will be glad to look into this further for you.