Get Libreoffice Writer to restablish links with JabRef when I reopen the .docx file? - citations

I'm using Libreoffice Writer V 5.1.6.2 on Ubuntu Linux (16.04) and managed to get it to connect to Jabref, such that I can insert citations in line in the text, and it generates the References section at the bottom of the document quite nicely. The problem arises when I quit for the day and return later. If I close both Writer and JabRef, and then restart Writer, open the previously saved .docx file, then open JabRef and make the manual connection from Jabref, it looses the connections to the previous citations. The previous ones are there, but in text format only, so If I add new citation, it begins again at Reference 1 as in [1]. My question is, is there a way to save the docx file such that when I reopen it, it will again establish connection with JabRef so I can continue citing from where I left off, eg. if I've already added 5 citations in the previous session, it will add a new one at [6]?
Thanks, J.

You're using the wrong file type. From http://help.jabref.org/en/OpenOfficeIntegration:
Make sure to save your Writer document in OpenDocument format (odt). Saving to Word format will lose your reference marks.

Related

Cant open a .docx file after overwriting it with a different encoding

This is not exactly a programming question but I came to this problem while I was trying to access to a .docx document using Python.
Basically, I opened manually the .docx with notepad and I overwrote it with utf-8 encoding (ANSI was the default encoding). After I did this if I try to open the document I see the next message: "We're sorry. We can´t open filename because we found a problem with its contents". Clicking on details you'll see "The file it's corrupt and cannot be opened".
It doesn't matter if I save the file with ANSI again, it won't open. Later I tried it with a new document and the same thing happened, but it also happens if I overwrite it with "ANSI" (even that it's the default one).
I can still open it with notepad so my question is: Is there a way to recover my file or to convert it to a readable document?
I've tried every single Method of the following link https://learn.microsoft.com/en-US/office/troubleshoot/word/damaged-documents-in-word and none of them worked.
Edit: If I open any ms-word with notepad and I save it with any encoding I wont be able to open it with ms-word anymore. I don't know why but if I open the document and erase the first two letters (PK - which I believe stands for zip document) I can open the file with ms-word but it would have unreadable characters.
Thank you in advance
Word files are zip archives containing XML, which is already encoded in UTF. A zip archive is a binary format and is not encoded. Notepad makes a guess, but it's wrong. That's why when you reopen the Word file that you thought you saved in UTF, Notepad still thinks it's ANSI format.
Unfortunately, your file is hosed. It's not even a zip archive anymore, so you can't open it to extract the text from the XML. Best to experiment on a copy next time.

Strange link in local dir for file being edited in emacs [duplicate]

This question already has answers here:
Why does emacs create temporary symbolic links for modified files?
(2 answers)
Closed 6 years ago.
Whenever I edit a file in emacs, I get a link in the current directory that looks like
lrwxrwxrwx 1 mpersico users 65 Feb 15 12:04 .#theFile -> mpersico#myhostname.nnnnn:nnnnnnnnnn
where the 'n's are 0-9. The first five n's are the pid of the emacs process. The file only appears while there are unsaved edits. Typing one key in the buffer creates the file. Saving the buffer removes the file.
Any idea what that file is and if it can be moved somewhere else? It's causing spurious errors in my rsync snapshotting setup.
TIA
It's an interlock: it's created when a buffer is modified in order to allow emacs to warn you when somebody else has modified it. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html#Interlocking . I don't think you can move it to some other directory without compromising emacs's ability to detect such conflicts. OTOH, you can disable it (see the link above) and emacs will ignore the conflict all together.

Rubymine creating text files by default [duplicate]

This question already has answers here:
Pycharm utils.py not getting syntax highlight
(6 answers)
Closed 3 years ago.
I am attempting to create a .rb file within Ruby, using these steps:
1. Create New File
2. Name new file "a"
3. Associate file to .rb filetype
This creates a file named "a" that works fine; however, when I rename this file to a.rb it immediately converts the file to a text file. Why is that?
I have been creating files this entire time by creating a new file and naming it "a.rb" from the start, and it automatically associates it to a ruby file. Now it just associates that naming to a text file and I have to leave off the .rb and manually assign the filetype later. What changed?
FOR MAC USERS you can find the settings you need to fix this here:
RubyMine | Preferences | Editor | File Types
The above answer is correct – removing a.rb does solve the problem – and I realize that this question is two years old now… But having come across this problem today and not having been able to find a solution for the longest time, hopefully this will help someone else too. Default Settings under File does NOT have this tab in the current version of RubyMine on Macs, and it took me forever to find the tab where File Types is.

How to read text file and save it in excel sheet using asp.net c#

I have one text file with the below structure
10180,65,395,
10182,65,395,
10183,65,395,
10185,65,395,
I need that after read the text file, the cell in the excel sheet contains the value as below
fristcell, secondcell, thirdcell
10180 65 395
means after the commas the value placed in the new cell.
I read the text file with the commas, but not get how to insert it or import data in excel.
Please guide me.
Thanks
Since want to write to an excel file and save it and considering that your scenario is not too complicated, I would recommend Closed XML which is a wrapper around Open XML SDK
Go through the Closed XML documentation. That should help you get started.
The general way I would go about this is :
1. Read the text file into a List<string>.
2. Create a file using Closed XML.

Prevent Word 2010 from saving o:gfxdata base64 or uuencoded VML?

I am working with .docx files containing several drawing canvases with images inserted and some lines and arrows drawn in Word 2010. I am using 2010 format with no compatibility mode.
Word inserts an o:gfxdata attribute into each v:shape and v:group element and fills it with ascii encoded something. From what I have read it may be a copy of the VML describing the v:shape or v:group. I don't know if I just don't know what to look for, but I cannot determine what this data is for as its removal has no apparent effect on my ability to read or edit the document in Word 2003, 2007, or 2010.
It does swell the document.xml to almost twice the (apparent) necessary size. This considerably slows OpenTBS' processing so I would like to remove it, if possible. Does anyone know of a way to tell Word 2010 to quit saving this extra data? Or what it is for? I have really struggled to find any documentation on it beyond this post.
Edit:
Here is a sample .docx. The document.xml is ~141KB and OpenTBS takes an average of 10.35 seconds to create a file that includes this as a subtemplate 21 times. If I remove all of the o:ogfxdata attributes, the file size is reduced to ~37KB and OpenTBS takes only 2.99 seconds to produce the same file.
Edit 2:
After further investigation, it appears the removal of the o:gfxdata may cause Word 2003 with an older Compatibilty Pack installed, to object to the file with the following error:
"This is a pre-release version of the Compatibility Pack and can open
pre-release Office 2007 files only. Do you want to check for a newer
version of the Compatibility Pack?"
I have been able to open the file by installing a newer compatibility pack - though it prompts the user about the incompatibility and converts the file in order to open it. This does not damage my file, but it is something to look out for.
Attribute o:ogfxdata is poorly documented in the web.
According to your investigations, it's some kind of compatibility extra information.
You can delete those attributes in your template using OpenTBS.
The cleaning can be done once on your template without any merging, and then save the cleaned template as a new template. Or you can perform the cleaning each time you open the template.
Cleaning the DOCX file:
while ($x = clsTbsXmlLoc::FindStartTagHavingAtt($TBS->Source, 'o:gfxdata', 0) ) {
$x->ReplaceAtt('o:gfxdata', '');
$TBS->Source = str_replace(' o:gfxdata=""', '', $TBS->Source);
}
Note that the class clsTbsXmlLoc is provided with OpenTBS and is undocumented.
The code should work since OpenTBS 1.8.0. (which is currently in stable beta version).
I've noticed that since attributes o:gfxdata are deleted, they do not come back immediately when you edit the docx.