MFC中使用BasicExcel外部类

来源:互联网 发布:淘宝出库单 编辑:程序博客网 时间:2024/06/05 20:18

移动自2016-2-18 01:06QQ空间日志

还是因为师兄的项目需要添加excel读写功能,因此四处寻找相关源码,去了著名开源资源网站codeproject,国外大神的早期资源都在,第一次接触这个网站,发现平时online人数真的不少,没想到网站这么多年了还这么受欢迎,以下记录了该开源库的使用步骤:

BasicExcel源码

1.Make it using in MFC
I'm a new user for BssicExcel.I meet the same problem of using it with MFC.And I found a way to solve the problem.

Step1:
Add BasicExcelVC6.CPP and BasicExcelVC6.hpp to your project.

Step2:
Add the folowing sentences to stdafx.h.
#include "BasicExcelVC6.hpp"
using namespace YExcel;

Step3:
Add the folowing sentence to BasicExcelVC6.cpp.
#include "stdafx.h"

2.How to type Chinese in sometext?

hi! I have solved this problem.

Test enviroment: WINXP SP3/VS2008/Office 2010

BasicExcel be;
be.New(1);
be.RenameWorksheet((size_t)0,L"中文");
BasicExcelWorksheet* pSheet = be.GetWorksheet((size_t)0);
pSheet->Cell(0,0)->SetWString(L"中华人名共和国");
if(!be.SaveAs("c:\\test.xls"))

    MessageBox(_T("save as failed."));
}
But, I find "SaveAs()" function don't support Chinese character path! Who has solved this problem?

So ,there is still existing a puzzle ,coming sooner or latter.保存的时候发现不支持中文路径,这明显不行嘛,后来想到可以通过添加gbk编码与utf-8编码转换来达到要求,还没试过,因为后来找到了更更合适的库。。。真的。

0 0