Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fields in odt files for Word compatibility #39

Open
tstenner opened this issue Apr 6, 2018 · 12 comments
Open

Use fields in odt files for Word compatibility #39

tstenner opened this issue Apr 6, 2018 · 12 comments
Labels

Comments

@tstenner
Copy link

tstenner commented Apr 6, 2018

The odt format also allows fields, as the following experiment confirms:

  • Create a new document in Word 2013 with some dummy entries (W13_Z.docx)
  • open in LibreOffice, edit the text in a citation, save as odt
  • Reopen the odt file in LibreOffice, save as docx
  • Reopen the docx file in Word, the changes are visible and all citations are recognized by the Zotero Word extension

What does not work:

  • Saving the document as odt in Word and opening it (either directly in Word and after converting it to docx in LibreOffice)

The extension currently doesn't recognize the citation fields, but libreoffice loads and writes them correctly in both formats. If they could be either loaded natively or converted on loading / saving the document, interoperability with Word users would be much improved.

@adomasven
Copy link
Member

LibreOffice has incomplete support for Word fields. It clearly recognises and avoids erasing them, but there is no UI to edit the field contents within LibreOffice, nor programming API to interface with them from the plugin.

@tstenner
Copy link
Author

tstenner commented Apr 8, 2018

Editing the contents of a field works for me (Libreoffice 6.0) and the changes are shown correctly in Word.

Creating fields also works (insert the citation, create a com.sun.star.text.Fieldmark, set the type (i.e. the citation data) and attach the field to the citation text) but I haven't found a way to find the fields again to edit them. Would you accept a PR to either convert citations on loading / saving or support them natively?

@adomasven
Copy link
Member

Ok, I've done some more research on Fieldmarks and while, as noted above, LibreOffice clearly has some internal support for them. I am not sure it is complete and the programming API doesn't seem to be documented, which means that we would avoid using it for now since it is likely to change and break the plugin.

Once the API is stable and documented, we would definitely accept a PR, although we would move to just using Fields in LibreOffice to simplify interoperability with Word, and convert old-style fields on document open or interaction.

@adomasven adomasven reopened this Apr 9, 2018
@tstenner
Copy link
Author

tstenner commented Apr 9, 2018

I've done some preliminary testing on inserting fieldmarks and asked on StackOverflow about finding Fieldmarks. JIM k's solution works (not sure about citations in footnotes though), but it might be a lot slower than Reference Marks. Still, "This document contains Fieldmarks, do you want to convert them to edit/insert citations" is a lot better than "This document uses fields and you need Word installed to change anything about it"

@adomasven
Copy link
Member

"This document contains Fieldmarks, do you want to convert them to edit/insert citations" is a lot better than "This document uses fields and you need Word installed to change anything about it"

We receive a lot of user feedback via the Zotero forums and I don't remember a single instance over the past couple of years of users being confused regarding collaboration between Word and LibreOffice.

Either way, in the case of collaborative work across LO and Word we already support Bookmarks. Conversion from Fieldmarks to Reference Marks wouldn't help in this case, since the Word user would not be able to continue working on the document. If collaboration is expected Zotero already supports conversion to Bookmarks via the document preferences.

We could suggest converting Fieldmarks to Bookmarks, but Bookmarks increase the risk of accidentally corrupting the fields or the document itself. Given that users often tend to click "Yes" in dialogs without reading them this could cause more problems than solve.

Furthermore, having code based on unstable API makes it vulnerable to breaking with updates from LO, which means increased additional maintenance over the long run.

Once the API is stable and there is a way to access Fieldmarks in the document, we will move to using Fieldmarks and remove the need for Bookmarks and Reference Marks completely. That is desirable, because it will simplify all plugin architecture significantly.

@tstenner
Copy link
Author

tstenner commented Apr 12, 2018

We receive a lot of user feedback via the Zotero forums and I don't remember a single instance over the past couple of years of users being confused regarding collaboration between Word and LibreOffice.

The problem is not the confusion, but the irritating extra steps for everyone (e.g. here).

Either way, in the case of collaborative work across LO and Word we already support Bookmarks. Conversion from Fieldmarks to Reference Marks wouldn't help in this case, since the Word user would not be able to continue working on the document.

That's right, but the other way (Refmarks->Fieldmarks) will be needed for older documents even after the change to Fieldmarks. This could be done in LO Basic so the Java component can get simplified.
Also, converting to Fieldmarks means collaborators won't have to use the more fragile bookmarks.

I've created a bug report to get the ball rolling.

@adomasven
Copy link
Member

I've created a bug report to get the ball rolling.

Thanks for the interest and for creating the bug report. Another venue worth asking on is the LibreOffice developer mailing list since they may want to discuss this in more detail and you may be able to get this included into one of their weekly meeting's agenda.

@ilDon
Copy link

ilDon commented Oct 31, 2018

Any update on this? I have lots of documents with "fields" citations and that is forcing me to stick with Word. Having the ability to edit "fields" citations in LibreOffice would be great!

@MatthiasSiewert
Copy link

This would be really nice. Libreoffice and MS compatibility is a major issue for me running Linux.

@adomasven
Copy link
Member

I have not looked into this in more detail, but we may be able to support Word fields/fieldmarks in LibreOffice 7.6 and later. See

@adomasven
Copy link
Member

After testing LibreOffice 7.6 and talking with LibreOffice developers I have discovered the following:

  1. Writer functionality has not been changed regarding Word fields. That is, Word fields are still not editable in Writer, i.e. the content is marked read-only.
  2. The APIs documented above are only available using LibreOfficeKit, which is a different API which seems to be developed by Collabora to be used with C++, so not useful to us.
  3. However, there may actually be an undocumented way to access and edit Word Fields with the current Java API. More investigation of LibreOffice source code is required (which is not very accessible without figuring out the full architecture of the software).

Regarding (1), we could consider adding a patch to LibreOffice which would make Word Field text editable. Assuming LibreOffice developers would be willing to accept it, we could move forwards with Field support. We generally wouldn't be as interested in this, but with the development of the new Word JS plugin, we would rather not support Bookmark citations given their various problems. On the other hand, with support for transferring Zotero citations via the transfer format, we could just slash Bookmark support for the time being without adding Field support to LibreOffice.

@raffaem
Copy link

raffaem commented Aug 31, 2024

I guess still nothing about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants