首页 > 解决方案 > TdxSpreadSheet -> SaveToFile 编码问题

问题描述

我正在尝试使用TdxSpreadSheet编写一个 .xlsx 文件。但结果是一个非 utf-8 文件,当我在 Excel 中打开文件时,它会正确显示我的字符串。另一方面,使用wofstream写入一个简单的文本文件是可行的。

wofstream Outfile;
Outfile.open("out.txt");
std:wstring part;
.
.
.
dxSpreadSheet1->ActiveSheetAsTable->Cells[nRow][nCol]->SetText(part.c_str(),true); //wrong format
Outfile << part.c_str();                                                           // works fine
.
.
.
Outfile.close();
dxSpreadSheet1->SaveToFile("test.xlsx");

任何人的想法???

问候

标签: c++spreadsheet

解决方案


推荐阅读