1

Is there anyway you can convert a .doc .docx to a spannable text. I have looked through through the internet and unfortunately I dont think its possible but I thought I might as well throw out the question to see if I missed something.

Kara
  • 6,115
  • 16
  • 50
  • 57
Mathew Kurian
  • 5,949
  • 5
  • 46
  • 73

1 Answers1

1

There's a POI project that capable of converting DOC formats to text but I think the size is prohibitive. You may consider web service that consumes the doc, produces txt equivalent. You can look at this answer for the possible solutions. Then the phone can get the text (or HTML) from your service which you can turn into spannable text

Community
  • 1
  • 1
Bostone
  • 36,858
  • 39
  • 167
  • 227
  • @Droidln.net: Im confused as to how to convert word to html while preserving all the textboxes and images – Mathew Kurian Jan 19 '12 at 04:31
  • 1
    Well, doc and especially docx are markup based (though also binary). POI does well enough job converting that to HTML. There are other numerous projects that do the same (not necessarily Java) including commercial. One thing I would not try is to attempt this type of conversion on the phone. And that's how most of the app of the similar nature operate - they send PDF or DOC or whatever to server and get XML or HTML back. – Bostone Jan 19 '12 at 04:36
  • @Droidln.net: im really confused about something. lets say i have a textbox with some text in it and is aligned in the center of a paragraph with the paragraph wrapping around the textbox. With this sort of complexity in layout, how can I get it to show this data on an html file and put it in an editable format? I know this is a very large question. So I am just looking for a general direction. – Mathew Kurian Jan 19 '12 at 04:41
  • 1
    You can't do it out of the box, or so I believe. For example TextView does not support text floating around the image. You can probably develop something like that by extending TextView or you can feed markup into WebView but that sort of defeats idea of the native app – Bostone Jan 19 '12 at 04:52
  • Im guessing that will get really complicated? Lets say, the user gives us a document that looks something like this http://www.poweredtemplates.com/_src_word/05071/word_template_s.jpg how would i go about converting that to a document that is both viewable and editable and then saveable to doc/docx. Just looking for a direction, not an exact way to do it. – Mathew Kurian Jan 19 '12 at 05:05
  • 1
    That link is not accessible and looking at the extension it is an image. As I said whatever the source and destination this realistically cannot be done on the phone. So collect the doc, send it to server, process and send back the result. As far as how to convert docs to text or HTML I already gave you some hints but I'm not an expert - you can ask separate question without tying it up to Android – Bostone Jan 19 '12 at 05:14