You can edit a read only file in Excel and Word, you just can't save it over the read only file, you have to do a Save As. I was trying to read a file, modify it, and then write it back out to a different file. Like using a Template. Using POI I was able to make changes to the in-memory representation of the document, but I was not able to write it out, even to a different file.
On Thu, Jun 2, 2016 at 4:27 PM, Javen O'Neal <javenon...@gmail.com> wrote: > > [XWPF] Read Only ... won't let me write to any file > That seems _almost_ correct. A read only file shouldn't be editable. But if > it's not editable, what's the point of saving it? Would be easier to copy > the file via the filesystem. > > To get around the underlying problems > 1. Copy the dotx to a docx, then open the docx as read-write. If you open > it with a FIS, close the FIS after you open the package to avoid a memory > leak. If you open it with a file, make sure you don't get a resource-in-use > filesystem error on Windows if saving the file to the same location as the > source. Depending on your business need, you may need to write out to a > temporary location and move files around, and roll back file changes if an > error occurs. > On Jun 2, 2016 12:33 PM, "Nick Burch" <apa...@gagravarr.org> wrote: > > > On Thu, 2 Jun 2016, Murphy, Mark wrote: > > > >> Read Only doesn't work in XWPF, it won't let me write to any file. > Plenty > >> of bugs to go around. > >> > > > > Hmm, that's bad, it ought to! Maybe add a quick disabled unit test for > > that (along the lines of the one we have for XSSF), and maybe also a XSLF > > one too just to be safe, and we can all try to chip away at the bugs > until > > it passes? > > > > Nick > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org > > For additional commands, e-mail: dev-h...@poi.apache.org > > > > >