How to convert line number and column number into caretPosition

Post here questions and problems related to oXygen frameworks/document types.
Isabelle
Posts: 142
Joined: Fri Jan 20, 2017 1:11 pm

How to convert line number and column number into caretPosition

Post 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
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply