Commit e5f9ea50 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

DocFormat - правка багов (файлы com-сервера)

parent 9db24f8e
...@@ -256,7 +256,8 @@ namespace DocFileFormat ...@@ -256,7 +256,8 @@ namespace DocFileFormat
if( nIndex < _doc->FontTable->cData ) if( nIndex < _doc->FontTable->cData )
{ {
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
this->m_sDefaultFont = ffn->xszFtn; if (ffn)
this->m_sDefaultFont = ffn->xszFtn;
} }
}break; }break;
case sprmCHpsBi : case sprmCHpsBi :
......
...@@ -61,6 +61,7 @@ namespace DocFileFormat ...@@ -61,6 +61,7 @@ namespace DocFileFormat
while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr ) < (*m_document->IndividualCommentsPlex)[index + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr ) < (*m_document->IndividualCommentsPlex)[index + 1] )
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx(fc); ParagraphPropertyExceptions* papx = findValidPapx(fc);
TableInfo tai(papx); TableInfo tai(papx);
......
...@@ -126,6 +126,9 @@ namespace DocFileFormat ...@@ -126,6 +126,9 @@ namespace DocFileFormat
int cp = initialCp; int cp = initialCp;
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
int fcEnd = m_document->FindFileCharPos(cpEnd); int fcEnd = m_document->FindFileCharPos(cpEnd);
if (fc < 0 || fcEnd < 0)
return 0;
ParagraphPropertyExceptions* papx = findValidPapx(fc); ParagraphPropertyExceptions* papx = findValidPapx(fc);
...@@ -515,6 +518,7 @@ namespace DocFileFormat ...@@ -515,6 +518,7 @@ namespace DocFileFormat
std::wstring mergeformat( _T( " MERGEFORMAT" ) ); std::wstring mergeformat( _T( " MERGEFORMAT" ) );
std::wstring quote ( _T( " QUOTE" ) ); std::wstring quote ( _T( " QUOTE" ) );
std::wstring chart ( _T( "Chart" ) ); std::wstring chart ( _T( "Chart" ) );
std::wstring PBrush ( _T( " PBrush" ) );
if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() ) if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() )
{ {
...@@ -1039,6 +1043,7 @@ namespace DocFileFormat ...@@ -1039,6 +1043,7 @@ namespace DocFileFormat
TableInfo tai( papx ); TableInfo tai( papx );
int fcRowEnd = findRowEndFc( cp, cp, nestingLevel ); int fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
ParagraphPropertyExceptions* papx_prev = NULL;
while ( tai.fInTable ) while ( tai.fInTable )
{ {
...@@ -1073,6 +1078,10 @@ namespace DocFileFormat ...@@ -1073,6 +1078,10 @@ namespace DocFileFormat
papx = findValidPapx( fcRowEnd ); papx = findValidPapx( fcRowEnd );
tai = TableInfo( papx ); tai = TableInfo( papx );
fcRowEnd = findRowEndFc( cp, cp, nestingLevel ); fcRowEnd = findRowEndFc( cp, cp, nestingLevel );
if (papx_prev && papx_prev == papx )
break;//file(12).doc
papx_prev = papx;
} }
//build the grid based on the boundaries //build the grid based on the boundaries
...@@ -1123,8 +1132,12 @@ namespace DocFileFormat ...@@ -1123,8 +1132,12 @@ namespace DocFileFormat
//Search the "table trailer paragraph" //Search the "table trailer paragraph"
while ( ( tai.fTtp == false ) && ( tai.fInTable == true ) ) while ( ( tai.fTtp == false ) && ( tai.fInTable == true ) )
{ {
while ( m_document->Text->at( cp ) != TextMark::CellOrRowMark ) while ( true )
{ {
if (cp >= m_document->Text->size())
break;
if (m_document->Text->at( cp ) == TextMark::CellOrRowMark)
break;
cp++; cp++;
} }
......
...@@ -45,6 +45,7 @@ namespace DocFileFormat ...@@ -45,6 +45,7 @@ namespace DocFileFormat
while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr - m_document->FIB->m_RgLw97.ccpAtn ) < (*m_document->IndividualEndnotesPlex)[id + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr - m_document->FIB->m_RgLw97.ccpAtn ) < (*m_document->IndividualEndnotesPlex)[id + 1] )
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
......
...@@ -37,6 +37,8 @@ namespace DocFileFormat ...@@ -37,6 +37,8 @@ namespace DocFileFormat
while ( cp < cpMax ) while ( cp < cpMax )
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
......
...@@ -45,6 +45,8 @@ namespace DocFileFormat ...@@ -45,6 +45,8 @@ namespace DocFileFormat
while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] )
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
......
...@@ -37,6 +37,8 @@ namespace DocFileFormat ...@@ -37,6 +37,8 @@ namespace DocFileFormat
while ( cp < cpMax ) while ( cp < cpMax )
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
......
...@@ -63,9 +63,12 @@ namespace DocFileFormat ...@@ -63,9 +63,12 @@ namespace DocFileFormat
//read the number text //read the number text
short strLen = reader->ReadInt16(); short strLen = reader->ReadInt16();
bytes = reader->ReadBytes( ( strLen * 2 ), true ); if (strLen > 0)//file(14).doc
FormatUtils::GetSTLCollectionFromBytes<wstring>( &(this->xst), bytes, ( strLen * 2 ), ENCODING_UNICODE ); {
RELEASEARRAYOBJECTS( bytes ); bytes = reader->ReadBytes( ( strLen * 2 ), true );
FormatUtils::GetSTLCollectionFromBytes<wstring>( &(this->xst), bytes, ( strLen * 2 ), ENCODING_UNICODE );
RELEASEARRAYOBJECTS( bytes );
}
long endPos = reader->GetPosition(); long endPos = reader->GetPosition();
reader->Seek( startPos, 0/*STREAM_SEEK_SET*/ ); reader->Seek( startPos, 0/*STREAM_SEEK_SET*/ );
......
...@@ -65,6 +65,7 @@ namespace DocFileFormat ...@@ -65,6 +65,7 @@ namespace DocFileFormat
while (cp < countText) while (cp < countText)
{ {
fc = m_document->FindFileCharPos(cp); fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
papx = findValidPapx(fc); papx = findValidPapx(fc);
...@@ -96,6 +97,8 @@ namespace DocFileFormat ...@@ -96,6 +97,8 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos(0); int fc = m_document->FindFileCharPos(0);
int fcEnd = m_document->FindFileCharPos(countTextRel); int fcEnd = m_document->FindFileCharPos(countTextRel);
if (fc < 0 || fcEnd < 0) break;
// Read the chars // Read the chars
vector<wchar_t>* chpxChars = m_document->m_PieceTable->GetEncodingChars (fc, fcEnd, m_document->WordDocumentStream); //<! NEED OPTIMIZE vector<wchar_t>* chpxChars = m_document->m_PieceTable->GetEncodingChars (fc, fcEnd, m_document->WordDocumentStream); //<! NEED OPTIMIZE
......
...@@ -443,6 +443,8 @@ namespace DocFileFormat ...@@ -443,6 +443,8 @@ namespace DocFileFormat
int fc = m_document->FindFileCharPos(iter->second); int fc = m_document->FindFileCharPos(iter->second);
int fcEnd = m_document->FindFileCharPos(iter->second + 1); int fcEnd = m_document->FindFileCharPos(iter->second + 1);
if (fc < 0 || fcEnd < 0 ) break;
list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd); list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd);
if ((chpxs != NULL) && (!chpxs->empty())) if ((chpxs != NULL) && (!chpxs->empty()))
......
...@@ -123,7 +123,7 @@ namespace DocFileFormat ...@@ -123,7 +123,7 @@ namespace DocFileFormat
} }
//Parse the OfficeDrawing Stuff //Parse the OfficeDrawing Stuff
shapeContainer = static_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0)); shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0));
long pos = reader.GetPosition(); long pos = reader.GetPosition();
......
...@@ -43,7 +43,7 @@ namespace DocFileFormat ...@@ -43,7 +43,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "w:docDefaults" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:docDefaults" ) );
//write the default styles //write the default styles
if ( sheet->Styles->at( 11 ) == NULL ) if ( (sheet->Styles->size() < 12) || (sheet->Styles->at( 11 ) == NULL ))
{ {
//NormalTable //NormalTable
writeNormalTableStyle(); writeNormalTableStyle();
...@@ -210,16 +210,20 @@ namespace DocFileFormat ...@@ -210,16 +210,20 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeBegin( _T( "w:rFonts" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:rFonts" ), TRUE );
FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) ); FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) );
m_pXmlWriter->WriteAttribute( _T( "w:ascii" ), FormatUtils::XmlEncode(ffnAscii->xszFtn).c_str() ); if (ffnAscii)
m_pXmlWriter->WriteAttribute( _T( "w:ascii" ), FormatUtils::XmlEncode(ffnAscii->xszFtn).c_str() );
FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) ); FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) );
m_pXmlWriter->WriteAttribute( _T( "w:eastAsia" ), FormatUtils::XmlEncode(ffnAsia->xszFtn).c_str() ); if (ffnAsia)
m_pXmlWriter->WriteAttribute( _T( "w:eastAsia" ), FormatUtils::XmlEncode(ffnAsia->xszFtn).c_str() );
FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) ); FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) );
m_pXmlWriter->WriteAttribute( _T( "w:hAnsi" ), FormatUtils::XmlEncode(ffnAnsi->xszFtn).c_str() ); if (ffnAnsi)
m_pXmlWriter->WriteAttribute( _T( "w:hAnsi" ), FormatUtils::XmlEncode(ffnAnsi->xszFtn).c_str() );
FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) ); FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) );
m_pXmlWriter->WriteAttribute( _T( "w:cs" ), FormatUtils::XmlEncode(ffnComplex->xszFtn).c_str() ); if (ffnComplex)
m_pXmlWriter->WriteAttribute( _T( "w:cs" ), FormatUtils::XmlEncode(ffnComplex->xszFtn).c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:rFonts" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:rFonts" ) );
......
...@@ -264,6 +264,7 @@ namespace DocFileFormat ...@@ -264,6 +264,7 @@ namespace DocFileFormat
bool Table::IsCellMarker(int _cp) bool Table::IsCellMarker(int _cp)
{ {
int fc = documentMapping->m_document->FindFileCharPos(_cp); int fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) return false;
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
...@@ -280,6 +281,7 @@ namespace DocFileFormat ...@@ -280,6 +281,7 @@ namespace DocFileFormat
bool Table::IsRowMarker( int _cp ) bool Table::IsRowMarker( int _cp )
{ {
int fc = documentMapping->m_document->FindFileCharPos(_cp); int fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) return false;
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
...@@ -296,6 +298,7 @@ namespace DocFileFormat ...@@ -296,6 +298,7 @@ namespace DocFileFormat
bool Table::IsParagraphMarker( int _cp ) bool Table::IsParagraphMarker( int _cp )
{ {
int fc = documentMapping->m_document->FindFileCharPos(_cp); int fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) return false;
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
...@@ -318,6 +321,7 @@ namespace DocFileFormat ...@@ -318,6 +321,7 @@ namespace DocFileFormat
SectionPropertyExceptions* sepxBackup = this->documentMapping->_lastValidSepx; SectionPropertyExceptions* sepxBackup = this->documentMapping->_lastValidSepx;
int fc = documentMapping->m_document->FindFileCharPos(_cp); int fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) return;
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
...@@ -331,6 +335,7 @@ namespace DocFileFormat ...@@ -331,6 +335,7 @@ namespace DocFileFormat
do do
{ {
fc = documentMapping->m_document->FindFileCharPos(_cp); fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) break;
papx = this->documentMapping->findValidPapx( fc ); papx = this->documentMapping->findValidPapx( fc );
...@@ -345,6 +350,7 @@ namespace DocFileFormat ...@@ -345,6 +350,7 @@ namespace DocFileFormat
_cp = innerTable.GetCPEnd(); _cp = innerTable.GetCPEnd();
fc = documentMapping->m_document->FindFileCharPos(_cp); fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) break;
papx = this->documentMapping->findValidPapx( fc ); papx = this->documentMapping->findValidPapx( fc );
......
...@@ -83,10 +83,16 @@ namespace DocFileFormat ...@@ -83,10 +83,16 @@ namespace DocFileFormat
if (typeid(*_caller) == typeid(MainDocumentMapping)) if (typeid(*_caller) == typeid(MainDocumentMapping))
{ {
bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlex->Elements[m_nTBIndex]); if (m_nTBIndex < m_document->TextboxBreakPlex->Elements.size() )//file(21).doc
{
cp = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex]; bkd = static_cast<Tbkd*>(m_document->TextboxBreakPlex->Elements[m_nTBIndex]);
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex + 1]; }
if (m_nTBIndex < m_document->TextboxBreakPlex->CharacterPositions.size() - 1)
{
cp = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex];
cpEnd = txtbxSubdocStart + m_document->TextboxBreakPlex->CharacterPositions[m_nTBIndex + 1];
}
} }
else if ((typeid(*_caller) == typeid(HeaderMapping)) || (typeid(*_caller) == typeid(FooterMapping))) else if ((typeid(*_caller) == typeid(HeaderMapping)) || (typeid(*_caller) == typeid(FooterMapping)))
{ {
...@@ -101,11 +107,17 @@ namespace DocFileFormat ...@@ -101,11 +107,17 @@ namespace DocFileFormat
//convert the textbox text //convert the textbox text
_lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0]; _lastValidPapx = (*(m_document->AllPapxFkps->begin()))->grppapx[0];
ParagraphPropertyExceptions* papx_prev = NULL;
while (cp < cpEnd) while (cp < cpEnd)
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
if (fc < 0) break;
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx( fc );
if (papx_prev && papx_prev == papx)//file(21).doc
break;
papx_prev = papx;
TableInfo tai( papx ); TableInfo tai( papx );
if ( tai.fInTable ) if ( tai.fInTable )
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
{ {
unsigned short rdUShort = 0; unsigned short rdUShort = 0;
if ( stream != NULL ) if (( stream != NULL ) && (position + 2 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*)(&rdUShort), sizeof( rdUShort )); stream->read((unsigned char*)(&rdUShort), sizeof( rdUShort ));
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
{ {
short rdShort = 0; short rdShort = 0;
if ( stream != NULL ) if (( stream != NULL ) && (position + 2 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*)(&rdShort), sizeof( rdShort )); stream->read((unsigned char*)(&rdShort), sizeof( rdShort ));
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
{ {
int rdInt = 0; int rdInt = 0;
if ( stream != NULL ) if (( stream != NULL ) && (position + 4 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read( (unsigned char*) &rdInt, sizeof( rdInt ) ); stream->read( (unsigned char*) &rdInt, sizeof( rdInt ) );
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
{ {
int rdUInt = 0; int rdUInt = 0;
if ( stream != NULL ) if (( stream != NULL ) && (position + 4 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*) &rdUInt, sizeof( rdUInt ) ); stream->read((unsigned char*) &rdUInt, sizeof( rdUInt ) );
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
{ {
unsigned char rdByte = 0; unsigned char rdByte = 0;
if ( this->stream != NULL ) if (( stream != NULL ) && (position + 1 < stream->size()))
{ {
stream->seek( position); stream->seek( position);
stream->read( (unsigned char*)&rdByte, sizeof( rdByte ) ); stream->read( (unsigned char*)&rdByte, sizeof( rdByte ) );
...@@ -105,6 +105,11 @@ public: ...@@ -105,6 +105,11 @@ public:
if ( ( stream != NULL ) && ( count > 0 ) && isResultNeeded ) if ( ( stream != NULL ) && ( count > 0 ) && isResultNeeded )
{ {
if (position + count > stream->size())
{
if (position > stream->size()) count = 0;
else count = stream->size() - position;
}
rdBytes = new unsigned char[count]; rdBytes = new unsigned char[count];
if ( rdBytes != NULL ) if ( rdBytes != NULL )
......
...@@ -179,7 +179,10 @@ namespace DocFileFormat ...@@ -179,7 +179,10 @@ namespace DocFileFormat
} }
if (FIB->m_FibBase.fEncrypted) if (FIB->m_FibBase.fEncrypted)
{
Clear();
return AVS_ERROR_DRM; return AVS_ERROR_DRM;
}
// Get the streams // Get the streams
if (FIB->m_FibBase.fWhichTblStm) if (FIB->m_FibBase.fWhichTblStm)
......
...@@ -72,7 +72,8 @@ namespace DocFileFormat ...@@ -72,7 +72,8 @@ namespace DocFileFormat
inline int FindFileCharPos(int cp) inline int FindFileCharPos(int cp)
{ {
return m_PieceTable->FileCharacterPositions->find(cp)->second; std::map<int, int>::iterator it = m_PieceTable->FileCharacterPositions->find(cp);
return (it != m_PieceTable->FileCharacterPositions->end()) ? it->second : -1;
} }
private: private:
......
...@@ -24,14 +24,14 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -24,14 +24,14 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, NULL); HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, NULL);
if (hRes != S_OK)return 2; if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1)) hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1);
return 1; }
FileSystem::Directory::DeleteDirectory(dstTempPath); FileSystem::Directory::DeleteDirectory(dstTempPath);
return 0; return hRes;
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8,00"
Name="ASCOfficeDocFile" Name="ASCOfficeDocFile"
ProjectGUID="{da13d6d4-39b5-49db-b5d7-d1afdbb7c320}" ProjectGUID="{DA13D6D4-39B5-49DB-B5D7-D1AFDBB7C320}"
RootNamespace="ASCOfficeDocFile" RootNamespace="ASCOfficeDocFile"
Keyword="AtlProj" Keyword="AtlProj"
> >
......
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