-
Notifications
You must be signed in to change notification settings - Fork 57
Description
hello all, I'm not entirely sure if this is the correct repo to be asking this, but the documentation/resources/websites are so very confusing!
Anyway I've been banging my head against the wall on this problem for a day now and can't seem to get it to work!
Any pointers or help would be highly appreciated!
Some context:
We have an ODF text document (this can be considered as a template), and it has a bunch of text added such as <FOO_LIST>.
What we're trying to then do is simply find all instances of the above and then programmatically inserting a bullet point list at that text location.
Simple in theory right?
Well what I have almost works, however instead of placing the bullet point list near those "place holders" they just get added to the start of the document :(
anyway here is the gist of the code (its in Kotlin):
fun BulletPoints(data: List<String>, mount: String, doc: TextDocument) {
try {
val search = TextNavigation("<$mount>", doc)
while (search.hasNext()) {
val item: TextSelection = search.nextSelection() as TextSelection
val p = doc.getParagraphByIndex(item.index, false)
val tempDoc = TextDocument.newTextDocument()
tempDoc.addList().addItems(data.toTypedArray())
doc.insertContentFromDocumentAfter(tempDoc, p, false)
}
} catch (e: Exception) {
throw Exception
}
}