Commit 7a5f3560 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander Trofimov

(1.0.0.106): XlsxSerializerCom

Поправил конвертацию в UTF8 (добавил шапку)
Не работала конвертация в unicode + добавил нужную шапку

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54633 954022d7-b5bf-4e40-9824-e11837661b57
parent 079b5910
#pragma once
#define CP_UTF16 1200
#define CP_unicodeFFFE 1201
namespace CSVWriter
{
......@@ -22,13 +24,19 @@ namespace CSVWriter
if (nCountChars + nCurrentIndex > c_nSize || bIsEnd)
{
// ,
INT nSize = WideCharToMultiByte(nCodePage, 0, *pWriteBuffer, nCurrentIndex, NULL, NULL, NULL, NULL);
CHAR *pString = new CHAR [nSize];
::ZeroMemory (pString, sizeof (CHAR) * nSize);
WideCharToMultiByte (CP_UTF8, 0, *pWriteBuffer, -1, pString, nSize, NULL, NULL);
pFile->WriteFile(pString, sizeof (CHAR) * nSize);
RELEASEARRAYOBJECTS(pString);
if (nCodePage == CP_UTF16)
{
pFile->WriteFile(*pWriteBuffer, sizeof (WCHAR) * nCurrentIndex);
}
else
{
INT nSize = WideCharToMultiByte(nCodePage, 0, *pWriteBuffer, nCurrentIndex, NULL, NULL, NULL, NULL);
CHAR *pString = new CHAR [nSize];
::ZeroMemory (pString, sizeof (CHAR) * nSize);
WideCharToMultiByte (CP_UTF8, 0, *pWriteBuffer, -1, pString, nSize, NULL, NULL);
pFile->WriteFile(pString, sizeof (CHAR) * nSize);
RELEASEARRAYOBJECTS(pString);
}
::ZeroMemory(*pWriteBuffer, nSizeWchar * c_nSize);
nCurrentIndex = 0;
......@@ -45,6 +53,23 @@ namespace CSVWriter
CFile oFile;
oFile.CreateFileW(sFileDst);
//
if (CP_UTF8 == nCodePage)
{
UCHAR arUTF8[3] = {0xEF, 0xBB, 0xBF};
oFile.WriteFile(arUTF8, 3);
}
else if (CP_UTF16 == nCodePage)
{
UCHAR arUTF16[2] = {0xFF, 0xFE};
oFile.WriteFile(arUTF16, 2);
}
else if (CP_unicodeFFFE == nCodePage)
{
UCHAR arBigEndian[2] = {0xFE, 0xFF};
oFile.WriteFile(arBigEndian, 2);
}
LONG lActiveSheet = 0;
CString sSheetRId = _T("Sheet1"); // rId,
OOX::Spreadsheet::CWorkbook *pWorkbook = oXlsx.GetWorkbook();
......
......@@ -2,6 +2,6 @@
//1
//0
//0
//106
#define INTVER 1,0,0,106
#define STRVER "1,0,0,106\0"
//107
#define INTVER 1,0,0,107
#define STRVER "1,0,0,107\0"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment