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

XlsFormat - при конвертации файлов старого формата xls не создаются файлы....

XlsFormat - при конвертации файлов старого формата xls не создаются файлы. Фикс файлов с поврежденными данными информации о файле.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67795 954022d7-b5bf-4e40-9824-e11837661b57
parent 13166d1a
......@@ -119,7 +119,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
BOF* bof = dynamic_cast<BOF*>(elements_.back().get());
if (bof->vers != 0x0600) //testdoc01.xls
if (bof->vers < 0x0600) //testdoc01.xls
{
proc.getGlobalWorkbookInfo()->Version = bof->vers;
return false;
......
......@@ -8,86 +8,101 @@ namespace OLEPS
PropertyCodePage::PropertyCodePage(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_I2);
*stream >> code_page;
code_page = 0;
if (value_type == Property::VT_I2)
{
*stream >> code_page;
}
}
PropertyTitle::PropertyTitle(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_LPSTR);
_UINT32 size;
*stream >> size;
if (size > 0)
if (value_type == Property::VT_LPSTR)
{
char *s = new char[size];
stream->read(s,size);
title = STR::toStdWString(s, size, 0);
delete []s;
_UINT32 size;
*stream >> size;
if (size > 0)
{
char *s = new char[size];
stream->read(s,size);
title = STR::toStdWString(s, size, 0);
delete []s;
}
}
}
PropertySubject::PropertySubject(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_LPSTR);
_UINT32 size;
*stream >> size;
if (size > 0)
if (value_type == Property::VT_LPSTR)
{
char *s = new char[size];
stream->read(s,size);
subject = STR::toStdWString(s, size, 0);
delete []s;
_UINT32 size;
*stream >> size;
if (size > 0 )
{
char *s = new char[size];
stream->read(s,size);
subject = STR::toStdWString(s, size, 0);
delete []s;
}
}
}
PropertyAuthor::PropertyAuthor(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_LPSTR);
_UINT32 size;
*stream >> size;
if (size > 0)
if (value_type == Property::VT_LPSTR)
{
char *s = new char[size];
stream->read(s, size);
author = STR::toStdWString(std::string(s,size), 0);
delete []s;
_UINT32 size;
*stream >> size;
if (size > 0)
{
char *s = new char[size];
stream->read(s, size);
author = STR::toStdWString(std::string(s,size), 0);
delete []s;
}
}
}
PropertyKeywords::PropertyKeywords(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_LPSTR);
_UINT32 size;
*stream >> size;
if (size > 0)
if (value_type == Property::VT_LPSTR)
{
char *s = new char[size];
stream->read(s,size);
keywords = STR::toStdWString(std::string(s,size), 0);
delete []s;
_UINT32 size;
*stream >> size;
if (size > 0)
{
char *s = new char[size];
stream->read(s,size);
keywords = STR::toStdWString(std::string(s,size), 0);
delete []s;
}
}
}
PropertyComments::PropertyComments(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_LPSTR);
_UINT32 size;
*stream >> size;
if (size > 0)
if (value_type == Property::VT_LPSTR)
{
char *s = new char[size];
stream->read(s,size);
comments = STR::toStdWString(s, size, 0);
delete []s;
_UINT32 size;
*stream >> size;
if (size > 0)
{
char *s = new char[size];
stream->read(s,size);
comments = STR::toStdWString(s, size, 0);
delete []s;
}
}
}
PropertyDateCreate::PropertyDateCreate(const unsigned short value_type, XLS::CFStreamPtr stream)
{
//ASSERT(value_type == Property::VT_FILETIME);
_UINT32 dwLowDateTime, dwHighDateTime;
*stream >> dwLowDateTime >> dwHighDateTime;
_UINT32 dwLowDateTime = 0, dwHighDateTime = 0;
if (value_type == Property::VT_FILETIME)
{
*stream >> dwLowDateTime >> dwHighDateTime;
}
}
} // namespace OLEPS
......@@ -29,6 +29,8 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
code_page = PropertyCodePage::DefaultCodePage;
for(unsigned int i = 0; i < NumProperties; ++i)
{
if (stream->getStreamPointer() - property_set_offset > Size)
break;
PropertyPtr next_property = PropertyFactory::ReadProperty(prop_offsets[i].PropertyIdentifier, stream, property_set_offset + prop_offsets[i].Offset);
if(next_property) // Skip the property if the corresponding class is not implemented
{
......
......@@ -133,6 +133,13 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
}
if (UpdateProgress(400000))return;
if (xls_global_info->Version < 0x0600)
{
Log::error("Version xls is old !!!");
return;
}
output_document = new oox::package::xlsx_document();
xlsx_context = new oox::xlsx_conversion_context(output_document);
}
......
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