You need to operate doc, xls, PPT, docx... 07 files, and PDF files on Android. After searching, there are still a lot of open-source projects, which are randomly listed as follows:
Two relatively large,
1. Apache poi
After using this operation, I don't know why the file cannot be opened. In addition, the 3.6 API is really messy, and you have to be patient.
Package com.ex.doc; import Java. io. file; import Java. io. fileinputstream; import Java. io. filenotfoundexception; import Java. io. ioexception; import Org. apache. poi. hwpf. hwpfdocument; import Org. apache. poi. hwpf. usermodel. range; import android. app. activity; import android. app. alertdialog; import android. content. intent; import android.net. uri; import android. OS. bundle; import android. view. menu; import android. view. VI EW; import android. view. view. onclicklistener; import android. widget. button; import android. widget. textview; public class Doc extends activity {private textview doc_text = NULL; private button btn_show = NULL; private string pathname = "/mnt/sdcard/test.doc "; private string content = "content"; @ override protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentvie W (R. layout. activity_doc); file F1 = new file (pathname); // openfile (F1); content = f1.tostring (); // convert file information into understandable paths such as hwpfdocument Doc = NULL; try {Doc = new hwpfdocument (New fileinputstream (pathname);} catch (filenotfoundexception E) {// Catch Block E automatically generated by todo. printstacktrace ();} catch (ioexception e) {// Catch Block E automatically generated by todo. printstacktrace ();} range R = Doc. getrange (); content = R. text (); Doc_text = new textview (this); btn_show = new button (this); this. btn_show = (button) super. findviewbyid (R. id. btn_show); // Add the super enhancement to convert this.doc _ text = (textview) super. findviewbyid (R. id. hello); // This. btn_show.setonclicklistener (New onclicklistener () {@ overridepublic void onclick (view v) {// method stub doc_text.settext ("help") automatically generated by todo "); // doc_text.settext ("hello !!! "); New alertdialog. Builder (Doc. This). settitle (" Tips "). setmessage (content). Show ();}});}
2. itext
It seems that some people say that it is very convenient to write word in itext, but it is not very convenient to read it. I don't know if it is. I read the oveview of the API, but I am afraid of reading a lot of content.
In addition, I saw an article on csdn Based on the android Word Document Reader. When it came down and ran it, it was also dead. I can study it again. The idea seems to be good, Doc
Convert to hxml for display.