MFC 创建HTML格式数据并显示

该博客介绍了如何在MFC中使用C++创建HTML格式的数据,并将其以表格形式显示。通过定义不同的数据结构,如`FileLines`、`HeadNameHtml`和`TableValueHtml`,来组织和处理数据。`OutputHtmlW`函数将数据输出到临时文件,而`CreateHtmlContext`函数将内容转换为HTML表格。最后,使用`ShellExecute`调用浏览器打开HTML文件进行显示。
摘要由CSDN通过智能技术生成

typedef vector<CStringW> FileLines;
typedef vector<CStringW> HeadNameHtml;
typedef vector<CStringW> RowValue;
typedef map<int, RowValue> TableValueHtml;

//输出数据到临时文件,返回文件全名

CStringW OutputHtmlW(FileLines lineInfo, CStringW wcsFileName)
{
    FileLines::iterator ite;
    wchar_t wcsPath[MAX_PATH];
    wchar_t wcsLogFileName[MAX_PATH];
    memset(wcsPath, 0, sizeof(wcsPath));
    memset(wcsLogFileName, 0, sizeof(wcsLogFileName));

    GetModuleFileNameW(NULL, wcsPath, sizeof(wcsPath));//取得exe全名称
    wchar_t* pwcsEnd = wcsrchr(wcsPath,'//');

    pwcsEnd++;
    *pwcsEnd = '/0';

    wcscat(wcsPath, wcsFileName);
    std::wofstream output(wcsPath, ios::trunc);
    output.imbue(locale("chs") ); //设定当前编码为中文
    for (ite = lineInfo.begin(); ite != lineInfo.end(); ite+

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值