j2se:
我当前需求是动态的关联chm的内容,即在不同的操作模块打开帮助文档后,可以自动关联到相关的章节。chm文件已经制作完毕。谢谢!!

解决方案 »

  1.   

    需求很怪异
    很怀疑是不是能这样.建议 java + javascript ,不要自己去解析chm,java负责得到模块对应chm的信息,javascript实现定位到哪一页,仅供参考...
      

  2.   

    j2se啊。软件打开本地的chm帮助文件。js咋整啊
      

  3.   

    建立个索引,打开文件的时候 直接把指针定位索引位置上 (普通文件)
    不知道打开chm和其他文件有啥区别
     靠 没做过
      

  4.   

    呵呵,这个需求有点难度。
    我提供另一种思路,可以实现类似功能。
    使用javahelp系统,它通过几个xml(.hs,.jhm,.xml)文件和一些html文件,实现类似chm的功能。
    用到jh.jar。可以从网上搜一下相关信息,不难。
      

  5.   

    首先问个问题,CHM能被编成方式操作吗?我是没有看见过类似的,哪怕是JS,谁能拿个例子?
      

  6.   

    focusforce。 感谢你的回复,请问有没有具体的javahelp的实例,看了点文档,理解不深。
      

  7.   

    CHM 有多少格式编译成的,有的用txt,有的是html格式编译成的,你得先把chm弄明白了再来找解决方案吧。
      

  8.   

    我在以前的公司写过,没有源代码了,给你从网上找了个样例。
    http://www.jspcn.net/htmlnews/11049400135621510.html
      

  9.   

    去sourceforg上找下JCHM和CHMPane,希望可以实现你的要求
      

  10.   

    你看java做的桌面软件的那些帮助文档,都是用JTextPane做的,我还没见过打开chm的
      

  11.   

    有类似提问
    http://bbs.preboss.org/forum.php?mod=viewthread&tid=127725&page=1
      

  12.   

    能不能直接操作最初始的html嘛?为什么一定要放到chm里面去了再弄呢?
      

  13.   

    我开发过这一块的。相当的麻烦,里面有CHM格式,LZX反解压的呵呵还是PGM等。呵呵
      

  14.   

    想要的。发邮件给我我给你一个例子可以根据实际情况修改。。[email protected]
      

  15.   

    LEInputStream in = new LEInputStream(createInputStream(0, CHM_HEADER_LENGTH));
    if ( ! in.readUTF8(4).equals("ITSF") ) 
    throw new DataFormatException("CHM file should start with \"ITSF\"");

    if ( (version = in.read32()) > 3)
    LogUtil.getInstance().e(CHMFileByChmFile.class, "CHM header version unexpected value " + version);

    int length = in.read32();
    in.read32(); // -1

    timestamp = in.read32(); // big-endian DWORD?
    // //log.info("CHM timestamp " + new Date(timestamp));
    lang = in.read32();
    //log.info("CHM ITSF language " + WindowsLanguageID.getLocale(lang));

    in.readGUID(); //.equals("7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC");
    in.readGUID(); //.equals("7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC");

    long off0 = in.read64();
    long len0 = in.read64();
    long off1 = in.read64();
    long len1 = in.read64(); // if the header length is really 0x60, read the final QWORD
    // or the content should be immediate after header section 1
    contentOffset = (length >= CHM_HEADER_LENGTH) ? in.read64() : (off1 + len1);
    //log.fine("CHM content offset " + contentOffset);

    /* Step 1.1 (Optional)  CHM header section 0 */
    in = new LEInputStream(createInputStream(off0, (int) len0)); // len0 can't exceed 32-bit
    in.read32(); // 0x01FE;
    in.read32(); // 0;
    if ( (fileLength = in.read64()) != fileAccess.length())
    LogUtil.getInstance().e(CHMFileByChmFile.class, "CHM file may be corrupted, expect file length " + fileLength);
    in.read32(); // 0;
    in.read32(); // 0;

    /* Step 1.2 CHM header section 1: directory index header */
    in = new LEInputStream(createInputStream(off1, CHM_DIRECTORY_HEADER_LENGTH));

    if (! in.readUTF8(4).equals("ITSP") ) 
    throw new DataFormatException("CHM directory header should start with \"ITSP\"");

    in.read32(); // version
    chunkOffset = off1 + in.read32(); // = 0x54
    in.read32(); // = 0x0a
    chunkSize = in.read32(); // 0x1000
    quickRef = 1 + (1 << in.read32()); // = 1 + (1 << quickRefDensity )
    for (int i = in.read32(); i > 1; i --) // depth of index tree, 1: no index, 2: one level of PMGI chunks
    indexTree.add(new TreeMap<String, Integer>());

    rootIndexChunkNo = in.read32(); // chunk number of root, -1: none
    firstPMGLChunkNo = in.read32();
    lastPMGLChunkNo = in.read32();
    in.read32(); // = -1
    totalChunks = in.read32();
    int lang2 = in.read32(); // language code
    //log.info("CHM ITSP language " + WindowsLanguageID.getLocale(lang2));

    in.readGUID(); //.equals("5D02926A-212E-11D0-9DF9-00A0-C922-E6EC"))
    in.read32(); // = x54
    in.read32(); // = -1
    in.read32(); // = -1
    in.read32(); // = -1 if (chunkSize * totalChunks + CHM_DIRECTORY_HEADER_LENGTH != len1)
    throw new DataFormatException("CHM directory list chunks size mismatch");

    /* Step 2. CHM name list: content sections */
    in = new LEInputStream(
    getResourceAsStream("::DataSpace/NameList"));
    if (in == null)
    throw new DataFormatException("Missing ::DataSpace/NameList entry");
    in.read16(); // length in 16-bit-word, = in.length() / 2
    sections = new Section[in.read16()];
    for (int i = 0; i < sections.length; i ++) {
    String name = in.readUTF16(in.read16() << 1);
    if ("Uncompressed".equals(name)) {
    sections[i] = new Section();
    } else if ("MSCompressed".equals(name)) {
    sections[i] = new LZXCSection();
    } else throw new DataFormatException("Unknown content section " + name);
    in.read16(); // = null
    }
      

  16.   

    chm里面都是一些静态页面即HTML你想怎么解析?像系统打开chm文档一样么   那个应该是用到了浏览器之类的东西了吧  或者你把chm分解成html吧  不过那样貌似没什么意义
      

  17.   

    一种思路:
    可以把CHM文件“反编译”为一系列的HTML文件,这样便可以方便地定位到某一个文件,然后很方便地读写。
      

  18.   


    为什么非要在CHM上吊死呢
    你可以把帮助内容存储成一个一个的文件,单独链接在每一个页面