How to insert non-paragraph text?

I want to insert a non-paragraph text right where the cursor is.

The easiest example is explains how to insert a new paragraph.

var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("Hello world!");
oDocument.InsertContent([oParagraph]);

The issue with inserting a new paragraph is that it pushes the next text to a new line, and does not follow the same style.

I saw the Api.CreateInlineLvlSdt().AddText() function but that needs to be inserted to a paragraph and I haven’t found how to detect current paragraph.

Hello @str
We are checking the described scenario. I will come back to you as soon as possible.

Unfortunately, there’s no way to achieve it, this is a known bug and we are working on it already. I will update this thread when we have something to share.
As for scenario of avoiding pushing text to next line, we are checking the situation.

1 Like

@Alexandre in an ideal world, it would be awesome to have an API like this:

var oDocument = Api.GetDocument();
var span      = Api.CreateInlineText();
span.AddText("Hello");
var who       = Api.CreateInlineText();
who.AddText(" world!");
oDocument.InsertContent([span, who]);

Hello @str
We are still checking the described behavior. Thank you for your sharing, I will update this thread once we have something.

1 Like