Commit 1e54cf26 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

DocFormatReader - странности при сохранении формул из docx в doc

parent 1a057290
......@@ -506,6 +506,7 @@ namespace DocFileFormat
std::wstring word ( _T( " Word" ) );
std::wstring equation ( _T( " Equation" ) ) ;
std::wstring mergeformat( _T( " MERGEFORMAT" ) );
std::wstring quote ( _T( " QUOTE" ) );
if ( search( f.begin(), f.end(), form.begin(), form.end() ) != f.end() )
{
......@@ -530,9 +531,15 @@ namespace DocFileFormat
this->_fldCharCounter++;
}
else if (( search(f.begin(), f.end(), mergeformat.begin(), mergeformat.end()) != f.end()) ||
(( search(f.begin(), f.end(), excel.begin(), excel.end()) != f.end() ||
search(f.begin(), f.end(), word.begin(), word.end()) != f.end())
else if (search( f.begin(), f.end(), quote.begin(), quote.end()) != f.end())
{
//todooo сохранить docx с формулой мс офис в doc.
//todooo формула там где то храниться !! найти
this->_skipRuns = 3;
}
else if (( search( f.begin(), f.end(), mergeformat.begin(), mergeformat.end()) != f.end()) ||
(( search( f.begin(), f.end(), excel.begin(), excel.end()) != f.end() ||
search( f.begin(), f.end(), word.begin(), word.end()) != f.end())
&&
( search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end() ||
search( f.begin(), f.end(), link.begin(), link.end() ) != f.end()) ))
......@@ -549,8 +556,8 @@ namespace DocFileFormat
this->_fldCharCounter++;
}
else if ( search(f.begin(), f.end(), embed.begin(), embed.end()) != f.end()
|| search( f.begin(), f.end(), link.begin(), link.end() ) != f.end())
else if ( search( f.begin(), f.end(), embed.begin(), embed.end()) != f.end()
|| search( f.begin(), f.end(), link.begin(), link.end() ) != f.end())
{
int cpPic = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::Picture);
int cpFieldSep = searchNextTextMark(m_document->Text, cpFieldStart, TextMark::FieldSeparator);
......
......@@ -16,31 +16,12 @@ class COfficeDocFile
public:
COfficeDocFile()
{
m_strTempDirectory = L"";
}
virtual ~COfficeDocFile()
{
}
private:
std::wstring m_strTempDirectory;
public:
HRESULT put_TempDirectory(std::wstring sDir)
{
m_strTempDirectory = sDir;
return S_OK;
}
std::wstring get_TempDirectory()
{
return m_strTempDirectory;
}
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstFileName, ProgressCallback *ffCallBack = NULL);
HRESULT SaveToFile(std::wstring sDstFileName, std::wstring sSrcFileName, ProgressCallback *ffCallBack = NULL);
......
// DocFormatTest.cpp : Defines the entry point for the console application.
//
#include "../../../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
#include "../DocFormatLib/DocFormatLib.h"
#include "../../../../ASCOfficeDocFile/win32/ASCOfficeCriticalSection.h"
#include "../win32/ASCOfficeCriticalSection.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include <string>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
std::wstring sSrcDoc = _T("d:\\test\\_doc\\PZ.doc");
std::wstring sResBackDocx = _T("d:\\test\\_doc\\PZ.doc-my.docx");
std::wstring sSrcDoc = argv[1];
std::wstring sDstDocx = argv[2];
std::wstring sTemp = _T("d:\\home/lena/Documents/temp");
std::wstring sXMLOptions = _T("");
std::wstring outputDir = FileSystem::Directory::GetFolderPath(sDstDocx);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
// doc->docx
COfficeDocFile docFile;
docFile.put_TempDirectory(sTemp);
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, sResBackDocx, NULL);
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, NULL);
if (hRes != S_OK)return 2;
COfficeUtils oCOfficeUtils(NULL);
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1))
return 1;
FileSystem::Directory::DeleteDirectory(dstTempPath);
return 0;
}
......
......@@ -6,10 +6,6 @@
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/lexical_cast.hpp>
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../src/ConvertOO2OOX.h"
......
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