解决方案 »

  1.   

    我的资源:
    http://download.csdn.net/detail/leitianjun/3163954
    支持中文处理。BasicExcel类。
    好用不解释。
      

  2.   

    我现在能够读/存储中文,只是保存或者load的时候有些问题,你所说的我试过了,一样存在我上面说的这种问题。
      

  3.   

    有一个类的,可以直接使用,像定义表一样定义字段,指定COL值来对应EXCEL中列
      

  4.   

    用过,但是只是实现简单的读写功能,没有遇到楼主说的问题.
    不过楼主既然知道的问题,那为何不尝试的去修改呢?而且源代码也有呀!楼主可以看看CSpreadSheet这个类试试,看能不能达到楼主的要求,网上有.
      

  5.   

    我知道有这个类,但是有odbc来实现的,也就是说机器上必须要有相应的odbc驱动。
    basicexecl有源码,但是其中比较复杂,不是改一两个函数就行,所以这里讲出来,有没有好的解决方案的。当然,我也用替代的办法实现,如果没有更好的办法,就暂时这么用。
      

  6.   

    原因是这个类的作者使用wcstombs将宽字符转换成多字符,和wcslen获取含有中文字符的长度,造成中文不能正常转换,例如函数中创建表格文件的函数
    bool Block::Create(const wchar_t* filename)
    // PURPOSE: Create a new block file and open it.
    // PURPOSE: If file is present, truncate it and then open it.
    // PROMISE: Return true if file is successfully created and opened, false if otherwise.
    {
    // Create new file
    size_t filenameLength = wcslen(filename);
    char* name = new char[filenameLength+1];
    wcstombs(name, filename, filenameLength);
    name[filenameLength] = 0;
    // file_.open(name, ios_base::out | ios_base::trunc);
    file_.close();
    file_.clear(); // Open the file
    bool ret = this->Open(filename);
    delete[] name;
    return ret;
    }
    //可以将这个函数替换下
    bool Block::Create(const wchar_t* filename)
    // PURPOSE: Create a new block file and open it.
    // PURPOSE: If file is present, truncate it and then open it.
    // PROMISE: Return true if file is successfully created and opened, false if otherwise.
    {
    // Create new file
    // size_t filenameLength = wcslen(filename);
    // char* name = new char[filenameLength+1];
    // wcstombs(name, filename, filenameLength);
    // name[filenameLength] = 0;
      int filenameLength=WideCharToMultiByte(CP_ACP,0,filename,-1,NULL,0,NULL,NULL);
      char *name = new char[filenameLength+1];
      WideCharToMultiByte(CP_ACP,0,filename,-1,name,filenameLength,NULL,NULL);
      name[filenameLength] = 0;
    // file_.open(name, ios_base::out | ios_base::trunc);
    file_.close();
    file_.clear(); // Open the file
    bool ret = this->Open(filename);
    delete[] name;
    return ret;
    }
    或者仅仅将wcslen替换也可以,这样就能够创建包含中文路径的表格了,当然仅仅修改这一个函数是不行的,这里仅仅是创建表格。
    里边还有很多地方用到了wcstombs