Page 1 of 1

How to convert line number and column number into caretPosition

Posted: Mon Sep 20, 2021 8:02 pm
by Isabelle
Hello,

I work with the version 22 of Oxygen SDK.

I want to use

Code: Select all

 WSXMLTextEditorPage wsxmlTextEditorPage = (WSXMLTextEditorPage) editorAccess.getCurrentPage();
 wsxmlTextEditorPage.setCaretPosition(position);
But I only have a column and a line number.
How can i convert this two informations to a valid position ?

Thanks,
Regards,
Isabelle

Re: How to convert line number and column number into caretPosition

Posted: Tue Sep 21, 2021 7:04 am
by Radu
Hi Isabelle,

You can use the API ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage.getOffsetOfLineStart(int) with the line being 1-indexed to get the absolute offset for a line and then add the column value to that.

Regards,
Radu