mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-19 07:07:15 +08:00
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user