firetext icon indicating copy to clipboard operation
firetext copied to clipboard

.docx support

Open HR opened this issue 11 years ago • 41 comments

I found this my microsoft for support on their formats, just download the documentation and you might find something useful. Or decompile and .apk of an android app (i.e. Quickoffice) and look at the java code if it helps. http://msdn.microsoft.com/en-us/library/cc313118%28v=office.1.2%29.aspx

HR avatar Apr 26 '13 21:04 HR

I'm going to create a parser for this for v2

HR avatar May 02 '13 20:05 HR

Ok, when we have a significant amount implemented, we can change the milestone.

Note: You probably already know this, but commits for this go to the doc branch (will be merged into the appropriate release branch. Also, files go in resources/doc/.

Thanks!

ferndot avatar May 02 '13 20:05 ferndot

Ok, here we have a js parser that we can use: https://github.com/stephen-hardy/DOCX.js

HR avatar May 24 '13 19:05 HR

Ya, I saw it yesterday, looks perfect :)

ferndot avatar May 24 '13 19:05 ferndot

Moving this to 0.2

ferndot avatar May 24 '13 19:05 ferndot

I am working on dropbox right now, anyone want to finish this for me?

Thanks in advance!

ferndot avatar Jun 05 '13 18:06 ferndot

Well, this is the last bug. I think we shouldn't delay the release of Firetext anymore, and we already have quite the changelog for 0.2, so if nobody wants to take this I'll move it to 0.3.

Docx files are hard because they are zips, and I have no experience with jszip.

ferndot avatar Jun 11 '13 18:06 ferndot

@Logi0 Can you please finish this?

HR avatar Jul 21 '13 08:07 HR

Can you @jackd1 finish this please?

HR avatar Jul 29 '13 20:07 HR

Sure.

jackd1 avatar Jul 29 '13 20:07 jackd1

:cool:

HR avatar Jul 29 '13 21:07 HR

I've been working on Implementing this, but I can't seem to get it to work, first I had to fix some programming errors in the docx.js code, and then I finally got it to output something, but the docx file wasn't valid.

jackd1 avatar Jul 30 '13 16:07 jackd1

use another docx file, I uploaded a docx in dp in /Firetext

HR avatar Jul 30 '13 17:07 HR

Ok, that seemed to work, now I have to figure out how to do the opposite and convert html to docx.

jackd1 avatar Jul 30 '13 17:07 jackd1

There is a default setting or structure that you should use (have it in resources/docx) that you duplicate everytime a user wants to save and currently only support bold, italic, underline and some other basic types that you would insert into the user docx file encoded into Open XML syntax.

HR avatar Jul 30 '13 17:07 HR

Maybe this could help: http://msdn.microsoft.com/en-us/library/office/aa338205(v=office.12).aspx#office2007aboutnewfileformat_developingsolutionsusingtheoffice http://msdn.microsoft.com/en-us/library/cc313153(v=office.12).aspx http://msdn.microsoft.com/en-us/library/gg278327(v=office.14).aspx http://msdn.microsoft.com/en-us/library/cc850833(v=office.14).aspx

HR avatar Jul 30 '13 17:07 HR

@jackd1 how is it going? By when will you finish this?

HR avatar Aug 19 '13 18:08 HR

Actually, I've just implemented fairly simple reading of docx documents, I'll push that right now.

jackd1 avatar Aug 19 '13 19:08 jackd1

Editing shouldn't be much harder to implement

HR avatar Aug 19 '13 20:08 HR

No, it won't be very hard, I should be able to do that tomorrow, as well as add some more rich text features.

jackd1 avatar Aug 19 '13 20:08 jackd1

:+1:

HR avatar Aug 19 '13 22:08 HR

:+1: How did you do this, it stumped me!

ferndot avatar Aug 20 '13 10:08 ferndot

I wrote a custom class to interpret the document per the iso/iec 29500 spec (downloadable at http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html). The load method loads a document from an ArrayBuffer (calling the constructor with an ArrayBuffer does the same thing). The HTMLout method produces html which can be edited and passed back to the HTMLin method (not yet implemented) which updates the document with the new html. Finally, when finished editing, the generate method generates the docx document. I imagine it was hard to read, it was pretty hard to read the spec :smile:

jackd1 avatar Aug 20 '13 13:08 jackd1

Nice :)

ferndot avatar Aug 20 '13 16:08 ferndot

I finally implemented writing to docx, took a little longer than I thought.

jackd1 avatar Aug 22 '13 23:08 jackd1

Awesome

HR avatar Aug 23 '13 01:08 HR

We'll enhance this in the future

HR avatar Aug 23 '13 01:08 HR

Ok, I still need to add a default template for creating new documents, also it only supports text right now.

jackd1 avatar Aug 23 '13 01:08 jackd1

Okay, just add a header, a horizontal line and then a paragraph or user can use blank template

HR avatar Aug 23 '13 01:08 HR

Oh, does this work with Dropbox?

ferndot avatar Aug 29 '13 17:08 ferndot