Commit 63ca87a5 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

X2t вывод ошибки о старой версии

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67946 954022d7-b5bf-4e40-9824-e11837661b57
parent 6e04ec28
...@@ -169,11 +169,11 @@ namespace DocFileFormat ...@@ -169,11 +169,11 @@ namespace DocFileFormat
result = doc.LoadDocument(progress); result = doc.LoadDocument(progress);
if (result != S_FALSE) if (result == S_OK)
{ {
result = Convert(&doc, &docx, progress); result = Convert(&doc, &docx, progress);
if (result != S_FALSE) if (result == S_OK)
{ {
docx.SaveDocument(); docx.SaveDocument();
......
#include "WordDocument.h" #include "WordDocument.h"
#include "../../../Common/OfficeFileErrorDescription.h"
namespace DocFileFormat namespace DocFileFormat
{ {
...@@ -128,13 +129,13 @@ namespace DocFileFormat ...@@ -128,13 +129,13 @@ namespace DocFileFormat
if (m_pStorage->SetFile (m_sFileName.GetBuffer()) == false) if (m_pStorage->SetFile (m_sFileName.GetBuffer()) == false)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false) if (m_pStorage->GetStream ("WordDocument", &WordDocumentStream) == false)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
// Parse FIB // Parse FIB
...@@ -165,7 +166,7 @@ namespace DocFileFormat ...@@ -165,7 +166,7 @@ namespace DocFileFormat
if (FIB->m_FibBase.nFib < Fib1997) if (FIB->m_FibBase.nFib < Fib1997)
{ {
Clear(); Clear();
return S_FALSE; return AVS_MSFILE_ERROR_OLDER;
} }
} }
else else
...@@ -173,7 +174,7 @@ namespace DocFileFormat ...@@ -173,7 +174,7 @@ namespace DocFileFormat
if (FIB->m_FibNew.nFibNew < Fib1997) if (FIB->m_FibNew.nFibNew < Fib1997)
{ {
Clear(); Clear();
return S_FALSE; return AVS_MSFILE_ERROR_OLDER;
} }
} }
...@@ -190,7 +191,7 @@ namespace DocFileFormat ...@@ -190,7 +191,7 @@ namespace DocFileFormat
if (res == false) if (res == false)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
try try
...@@ -218,7 +219,7 @@ namespace DocFileFormat ...@@ -218,7 +219,7 @@ namespace DocFileFormat
if (bCancel) if (bCancel)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
...@@ -286,7 +287,7 @@ namespace DocFileFormat ...@@ -286,7 +287,7 @@ namespace DocFileFormat
if (bCancel) if (bCancel)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
...@@ -321,7 +322,7 @@ namespace DocFileFormat ...@@ -321,7 +322,7 @@ namespace DocFileFormat
if (bCancel) if (bCancel)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
...@@ -385,7 +386,7 @@ namespace DocFileFormat ...@@ -385,7 +386,7 @@ namespace DocFileFormat
if (bCancel) if (bCancel)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
...@@ -423,11 +424,11 @@ namespace DocFileFormat ...@@ -423,11 +424,11 @@ namespace DocFileFormat
if (bCancel) if (bCancel)
{ {
Clear(); Clear();
return S_FALSE; return AVS_ERROR_FILEFORMAT;
} }
} }
return S_OK; return 0;
} }
// Returns a list of all CHPX which are valid for the given FCs. // Returns a list of all CHPX which are valid for the given FCs.
......
...@@ -9,6 +9,13 @@ long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, ...@@ -9,6 +9,13 @@ long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath,
{ {
XlsConverter converter(srcFile, dstPath, pCallBack); XlsConverter converter(srcFile, dstPath, pCallBack);
if (converter.isError())
{
if (converter.is_older_version)
return AVS_MSFILE_ERROR_OLDER;
else return AVS_ERROR_FILEFORMAT;
}
converter.convertDocument(); converter.convertDocument();
converter.write(); converter.write();
......
...@@ -77,6 +77,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -77,6 +77,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
pCallBack = CallBack; pCallBack = CallBack;
bUserStopConvert = false; bUserStopConvert = false;
is_older_version = false;
try{ try{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode); XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
...@@ -137,6 +138,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -137,6 +138,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
if (xls_global_info->Version < 0x0600) if (xls_global_info->Version < 0x0600)
{ {
Log::error("Version xls is old !!!"); Log::error("Version xls is old !!!");
is_older_version = true;
return; return;
} }
...@@ -151,6 +153,14 @@ XlsConverter::~XlsConverter() ...@@ -151,6 +153,14 @@ XlsConverter::~XlsConverter()
if (output_document) delete output_document; if (output_document) delete output_document;
} }
XlsConverter::isError()
{
if (!xlsx_context) return true;
if (!output_document) return true;
return false;
}
#define PROGRESSEVENT_ID 0 #define PROGRESSEVENT_ID 0
bool XlsConverter::UpdateProgress(long nComplete) bool XlsConverter::UpdateProgress(long nComplete)
......
...@@ -88,6 +88,9 @@ public: ...@@ -88,6 +88,9 @@ public:
std::wstring GetTargetMoniker(XLS::BiffStructure *moniker); std::wstring GetTargetMoniker(XLS::BiffStructure *moniker);
bool isError();
bool is_older_version;
private: private:
void convert_chart_sheet (XLS::ChartSheetSubstream * chart); void convert_chart_sheet (XLS::ChartSheetSubstream * chart);
......
...@@ -35,8 +35,11 @@ ...@@ -35,8 +35,11 @@
#define AVS_OFFICEFILE_ERROR_SAVE_EMPTY (AVS_OFFICEFILE_ERROR_FIRST + 0x0004) //Формат файла не поддерживается #define AVS_OFFICEFILE_ERROR_SAVE_EMPTY (AVS_OFFICEFILE_ERROR_FIRST + 0x0004) //Формат файла не поддерживается
#define AVS_OFFICEFILE_ERROR_PRINT_OUT_OF_AREA (AVS_OFFICEFILE_ERROR_FIRST + 0x0005) //печать за границами области печати #define AVS_OFFICEFILE_ERROR_PRINT_OUT_OF_AREA (AVS_OFFICEFILE_ERROR_FIRST + 0x0005) //печать за границами области печати
//AVSOfficeMsFile
#define AVS_MSFILE_ERROR_OLDER (AVS_ERROR_FIRST + 0x0090)
// AVSOdtFile 0x0100 - 0x0200
// AVSOdfFile 0x0100 - 0x0200
#define AVS_ODTFILE_ERROR_INPUT_FILE (AVS_ERROR_FIRST + 0x0100) // Ошибка в входном файле #define AVS_ODTFILE_ERROR_INPUT_FILE (AVS_ERROR_FIRST + 0x0100) // Ошибка в входном файле
#define AVS_ODTFILE_ERROR_ORIGIN_FILE (AVS_ERROR_FIRST + 0x0101) // Ошибка в шаблоном файле #define AVS_ODTFILE_ERROR_ORIGIN_FILE (AVS_ERROR_FIRST + 0x0101) // Ошибка в шаблоном файле
#define AVS_ODTFILE_ERROR_CONVERT (AVS_ERROR_FIRST + 0x0102) // Ошибка при конвертации #define AVS_ODTFILE_ERROR_CONVERT (AVS_ERROR_FIRST + 0x0102) // Ошибка при конвертации
......
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