diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStreamCacheReader.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStreamCacheReader.cpp index 7ed8713d61..c14ce132b3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStreamCacheReader.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStreamCacheReader.cpp @@ -291,7 +291,7 @@ CFRecordPtr FileStreamCacheReader::getNextRecord(const CFRecordType::TypeId desi { CFRecordType::TypeString rec_name = records_cache.front()->getTypeString(); - Log::warning(rec_name); + //Log::warning(rec_name); if (desirable_type == rt_MsoDrawingGroup) // объединяем rt_MsoDrawingGroup + rt_Continue в один блок { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BOF.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BOF.cpp index 613a2d4fd2..ee247d89de 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BOF.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BOF.cpp @@ -102,6 +102,11 @@ void BOF::readFields(CFRecord& record) stream_ptr = record.getStreamPointer(); record.skipNunBytes(2); // reserved } + else + { //ts_2500_06_gruzi 05 06 вып.xls + record.getGlobalWorkbookInfo()->Version = 0x601; + record.getGlobalWorkbookInfo()->CodePage = 0; + } } else { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp index 9b07ca2586..e48e689db9 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.cpp @@ -57,7 +57,7 @@ void Label::readFields(CFRecord& record) record >> cell; - if (global_info_->Version < 0x0600) + if (global_info_->Version < 0x0600 || global_info_->Version == 0x601) { LPAnsiString name; record >> name; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp index b930df7526..41f2e63f70 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp @@ -168,6 +168,8 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring if (workbook) { workbook->m_arWorksheetSubstream.push_back(worksheet); + + workbook->m_GlobalsSubstream = XLS::BaseObjectPtr(new XLS::GlobalsSubstream(0)); } } else diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp index 13a85b9b78..dcc0ac277c 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp @@ -379,11 +379,15 @@ void xlsx_conversion_context::end_document() CP_XML_STREAM() << xlsx_workbookProtection_.str(); - CP_XML_NODE(L"bookViews") - { - CP_XML_STREAM() << xlsx_workbook_views_.str(); - } + std::wstring str_bookViews = xlsx_workbook_views_.str(); + if (false == str_bookViews.empty()) + { + CP_XML_NODE(L"bookViews") + { + CP_XML_STREAM() << str_bookViews; + } + } CP_XML_NODE(L"sheets") { CP_XML_STREAM() << workbook_content.str(); diff --git a/Common/OfficeFileFormatChecker.h b/Common/OfficeFileFormatChecker.h index 3ff848a95d..766f619d05 100644 --- a/Common/OfficeFileFormatChecker.h +++ b/Common/OfficeFileFormatChecker.h @@ -79,6 +79,8 @@ public: bool isOOXFlatFormatFile(unsigned char* pBuffer,int dwBytes); bool isDocFlatFormatFile(unsigned char* pBuffer,int dwBytes); + + bool isXlsFlatFormatFile(unsigned char* pBuffer, int dwBytes); bool isRtfFormatFile (unsigned char* pBuffer,int dwBytes); bool isHtmlFormatFile (unsigned char* pBuffer,int dwBytes, bool testCloseTag); diff --git a/Common/OfficeFileFormatChecker2.cpp b/Common/OfficeFileFormatChecker2.cpp index 2213b775eb..aceed22fd0 100644 --- a/Common/OfficeFileFormatChecker2.cpp +++ b/Common/OfficeFileFormatChecker2.cpp @@ -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;