add format xls sheet
This commit is contained in:
Elena.Subbotina
2021-09-28 20:20:32 +03:00
parent e310954222
commit 3fd3940119
7 changed files with 35 additions and 8 deletions

View File

@ -231,7 +231,18 @@ bool COfficeFileFormatChecker::isDocFlatFormatFile (unsigned char* pBuffer, int
return false;
}
bool COfficeFileFormatChecker::isXlsFlatFormatFile(unsigned char* pBuffer, int dwBytes)
{
if (pBuffer == NULL || dwBytes < 2) return false;
// BOF started
if ((pBuffer[1] == 0x08 && pBuffer[0] == 0x09) ||
(pBuffer[1] == 0x04 && pBuffer[0] == 0x09) ||
(pBuffer[1] == 0x02 && pBuffer[0] == 0x09))
return true;
return false;
}
bool COfficeFileFormatChecker::isPptFormatFile (POLE::Storage * storage)
{
if (storage == NULL) return false;
@ -467,7 +478,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT; // without compaund container
}
else if (isXlsFlatFormatFile(buffer, sizeRead))// min size - 2
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS; // without compaund container
}
//------------------------------------------------------------------------------------------------
file.CloseFile();
@ -506,7 +520,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
}
else if (0 == sExt.compare(L".mht"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xls"))
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xlsx"))
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;