永发信息网

求一款android平台上的doc、docx阅读软件

答案:3  悬赏:80  手机版
解决时间 2021-03-19 02:32
  • 提问者网友:爱唱彩虹
  • 2021-03-18 09:52
不需要编辑,能阅读就行,最好能修改字体。wps除外。
最佳答案
  • 五星知识达人网友:酒者煙囻
  • 2021-03-18 11:11
目前就WPS好用,其他的都不行,是因为WPS占内存太多吧。你在网上找找金软office,最好能找到无广告的
全部回答
  • 1楼网友:一秋
  • 2021-03-18 12:27
解析doc,要tm-extractors-0.4.jar这个包解析xls,要jxl.jar这个包        解析xls 解析docx 01    public static string readdocx(string path) {     02                    string river = "";     03                    try {     04                            zipfile xlsxfile = new zipfile(new file(path));     05                            zipentry sharedstringxml = xlsxfile.getentry("word/document.xml");     06                            inputstream inputstream = xlsxfile.getinputstream(sharedstringxml);     07                            xmlpullparser xmlparser = xml.newpullparser();     08                            xmlparser.setinput(inputstream, "utf-8");     09                            int evttype = xmlparser.geteventtype();     10                            while (evttype != xmlpullparser.end_document) {     11                                    switch (evttype) {     12                                    case xmlpullparser.start_tag:     13                                            string tag = xmlparser.getname();     14                                            system.out.println(tag);     15                                            if (tag.equalsignorecase("t")) {     16                                                    river += xmlparser.nexttext() + "\n";     17                                            }     18                                            break;     19                                    case xmlpullparser.end_tag:     20                                            break;     21                                    default:     22                                            break;     23                                    }     24                                    evttype = xmlparser.next();     25                            }     26                    } catch (zipexception e) {     27                            e.printstacktrace();     28                    } catch (ioexception e) {     29                            e.printstacktrace();     30                    } catch (xmlpullparserexception e) {     31                            e.printstacktrace();     32                    }     33                    if (river == null) {     34                            river = "解析文件出现问题";     35                    }     36          37                    return river;     38            }             解析xlsx 01    public static string readxlsx(string path) {     02                    string str = "";     03                    string v = null;     04                    boolean flat = false;     05                    list ls = new arraylist();     06                    try {     07                            zipfile xlsxfile = new zipfile(new file(path));     08                            zipentry sharedstringxml = xlsxfile     09                                            .getentry("xl/sharedstrings.xml");     10                            inputstream inputstream = xlsxfile.getinputstream(sharedstringxml);     11                            xmlpullparser xmlparser = xml.newpullparser();     12                            xmlparser.setinput(inputstream, "utf-8");     13                            int evttype = xmlparser.geteventtype();     14                            while (evttype != xmlpullparser.end_document) {     15                                    switch (evttype) {     16                                    case xmlpullparser.start_tag:     17                                            string tag = xmlparser.getname();     18                                            if (tag.equalsignorecase("t")) {     19                                                    ls.add(xmlparser.nexttext());     20                                            }     21                                            break;     22                                    case xmlpullparser.end_tag:     23                                            break;     24                                    default:     25                                            break;     26                                    }     27                                    evttype = xmlparser.next();     28                            }     29                            zipentry sheetxml = xlsxfile.getentry("xl/worksheets/sheet1.xml");     30                            inputstream inputstreamsheet = xlsxfile.getinputstream(sheetxml);     31                            xmlpullparser xmlparsersheet = xml.newpullparser();     32                            xmlparsersheet.setinput(inputstreamsheet, "utf-8");     33                            int evttypesheet = xmlparsersheet.geteventtype();     34                            while (evttypesheet != xmlpullparser.end_document) {     35                                    switch (evttypesheet) {     36                                    case xmlpullparser.start_tag:     37                                            string tag = xmlparsersheet.getname();     38                                            if (tag.equalsignorecase("row")) {     39                                            } else if (tag.equalsignorecase("c")) {     40                                                    string t = xmlparsersheet.getattributevalue(null, "t");     41                                                    if (t != null) {     42                                                            flat = true;     43                                                            system.out.println(flat + "有");     44                                                    } else {     45                                                            system.out.println(flat + "没有");     46                                                            flat = false;     47                                                    }     48                                            } else if (tag.equalsignorecase("v")) {     49                                                    v = xmlparsersheet.nexttext();     50                                                    if (v != null) {     51                                                            if (flat) {     52                                                                    str += ls.get(integer.parseint(v)) + "  ";     53                                                            } else {     54                                                                    str += v + "  ";     55                                                            }     56                                                    }     57                                            }     58                                            break;     59                                    case xmlpullparser.end_tag:     60                                            if (xmlparsersheet.getname().equalsignorecase("row")     61                                                            && v != null) {     62                                                    str += "\n";     63                                            }     64                                            break;     65                                    }     66                                    evttypesheet = xmlparsersheet.next();     67                            }     68                            system.out.println(str);     69                    } catch (zipexception e) {     70                            e.printstacktrace();     71                    } catch (ioexception e) {     72                            e.printstacktrace();     73                    } catch (xmlpullparserexception e) {     74                            e.printstacktrace();     75                    }     76                    if (str == null) {     77                            str = "解析文件出现问题";     78                    }     79          80                    return str;     81            }
  • 2楼网友:不如潦草
  • 2021-03-18 11:55
openoffice libreoffice(开源的) Documents to go
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯