Fields for Zotero

Michael Stahl mst at libreoffice.org
Tue Aug 16 10:06:40 UTC 2022


On 16.08.22 09:03, Phillips Rogfield wrote:
> Hi Miklos,
> 
> thank you very much for your answer!
> 
> Let’s make sure we are on the same page here.
> 
> Zotero is already able to write its citation with LibreOffice.
> To do so, it currently uses one of two methods, at user’s choice:
> (1) ReferenceMarks, which are NOT compatible with Microsoft Word
> (2) Bookmarks, which are SOMEHOW compatible with Microsoft Word, in the 
> sense that you can’t put citations in footnotes, and they tend to break 
> very easily.
> 
> Instead, the Zotero plugin for Microsoft Word uses:
> (1) Fields, which are NOT compatible with LibreOffice
> (2) Bookmarks, see above.
> 
> The point of this post is to allow the plugin for LibreOffice to use 
> “Fields”.
> 
> In particular, I have to use the UNO interface to write the following in 
> the |word/document.xml| file inside a .docx file:
> 
> |<w:r> <w:fldChar w:fldCharType="begin"/> </w:r> <w:r> <w:instrText 
> xml:space="preserve"> [some text here] </w:instrText> </w:r> <w:r> 
> <w:fldChar w:fldCharType="separate"/> </w:r> <w:r w:rsidRPr="007C09F6"> 
> <w:rPr> <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:cs="Calibri"/> 
> </w:rPr> <w:t> [some text here] </w:t> </w:r> <w:r> <w:fldChar 
> w:fldCharType="end"/> </w:r> |
> 
> would the |com.sun.star.text.TextField.Bibliography| interface allow me 
> to write the above code?

kind of, there is code to export it as a CITATION field in 
DocxAttributeOutput::EndField_Impl in 
sw/source/filter/ww8/docxattributeoutput.cxx.

the other option is, you could insert this with arbitrary content via 
the Fieldmark service, and since about version 7.3 this kind of works in 
the document model and can be stored as an ODF extension in addition to 
DOCX/RTF.

however there is currently no implementation of *expanding* the 
fieldmark, that is, there is no code to evaluate the fieldmark command 
and overwrite the fieldmark result.


More information about the LibreOffice mailing list