Ask Your Question

how access fieldmarks with API? [closed]

asked 2014-02-21 08:58:37 +0100

gma gravatar image

updated 2015-09-12 05:02:06 +0100

Alex Kemp gravatar image

When I import .doc with form fields, I see ‘fieldmarks’ in my LibreOffice 4.2 instead of form fields.

    <field:fieldmark-start text:name="__Fieldmark__0_2026164759" field:type="vnd.oasis.opendocument.field.FORMTEXT">
    <field:param field:name="Description" field:value=""/>
    <field:param field:name="Name" field:value="Field1"/>

For example, in OpenOffice I get input fields and access them through getTextFields.createEnumeration.

Well, now I need to access fieldmark by name, get it range, delete it. There is no any documentaion in sdk. Neither getBookmarks nor getTextFields give me this fields.

How can I find them?

I cannot allow my program's users to install LibreOffice instead of OpenOffice due to this problem.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-19 11:28:25.255548


Please edit your question to more clearly indicate what a "fieldmark" is i.e., what is the underlying XML? If you can link to a screenshot or example document that includes an example of the type of "fieldmark" you wish to delete, that would be even better. Thanks.

oweng gravatar imageoweng ( 2014-02-22 04:11:44 +0100 )edit

By enumerating the document's text, it is possible to find the appropriate text portions and get the bookmarks. See

Jim K gravatar imageJim K ( 2018-04-09 17:00:45 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-02-22 05:10:43 +0100

oweng gravatar image

I am going to have a go at answering your query, based on the currently provided information. I asked a similar question a couple of years ago in relation to deleting fields in Word-produced DOC files that contained EndNote citation fields:

<field:fieldmark-start text:name="__Fieldmark__9119_405037922" field:type=""/>
    Highlighted field text

It is worth noting that there is no field:fieldmark... element in either the ODF v1.2 or OOXML 3rd ed., 2012 specification. Instead, these XML entries are currently created by Writer as a workaround to cater for input fields (and possibly other unsupported fields). OASIS issue OFFICE-2096 is the related proposal to fully support these fieldmarks[1]. Bugs fdo#43569 and fdo#45341 are related, in terms of input fields not being editable when saved to the DOC format (as they are effectively an as-yet-unsupported feature).

The class reference for sw::mark::Fieldmark may be of some use in determining how these elements are accessed via the UNO API.

[1] ODF v1.3 will likely support the field:fieldmark, field:fieldmark-start, and field:fieldmark-end elements.

edit flag offensive delete link more


Thank you for your answer. I'm still researching behaviour of LO with fieldmarks. There is some info: fdo#30711

Way to create fieldmark:

FM = createInstance("")
getText.InsertTextContent(cursor, FM, True)

I have not found yet way to name it and display in editor. I have not found yet way to find it in text and make changes.

And if I cannot delete simple input field, I am pessimistic about fieldmark...

gma gravatar imagegma ( 2014-02-22 06:47:14 +0100 )edit

Yes, the implementation at present appears to be only partial. I had a read through fdo#30711 before posting my answer, but I was not sure it contained enough detail to be useful. I'm not sure if XMLTextMarkImportContext_8cxx_source.html contains any useful detail. It does seem to indicate though that the fieldmark implementation (at least in the import filter) is not complete.

oweng gravatar imageoweng ( 2014-02-23 04:24:34 +0100 )edit

Question Tools

1 follower


Asked: 2014-02-21 08:58:37 +0100

Seen: 390 times

Last updated: Feb 22 '14