Operations on files such as Doc on Android platforms

Source: Internet
Author: User

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.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.