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

XLSfile

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58988 954022d7-b5bf-4e40-9824-e11837661b57
parent 8522b758
......@@ -346,6 +346,8 @@ ASCOfficeXlsFile/ASCWorksheetConverter/source/Streams_binaries/DocumentSummaryIn
ASCOfficeXlsFile/ASCWorksheetConverter/source/Streams_binaries/SummaryInformation.bin svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/source/XLS_logic/Biff_structures/ODRAW svnc_bugtraq_003anumber=true
/ASCOfficeXlsFile2 svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile2/ASCOfficeXlsFileTest svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile2/ASCOfficeXlsFileTest/Guideline.docx svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile2/source svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile2/source/Converter svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile2/source/Serializer svnc_tsvn_003alogminsize=5
......
......@@ -8,6 +8,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeXlsFile2", "ASCOff
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormat", "source\XlsFormat.vcproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeXlsFileTest", "ASCOfficeXlsFileTest\ASCOfficeXlsFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{4260FEDF-E1DA-447F-991B-62F17DF5533E} = {4260FEDF-E1DA-447F-991B-62F17DF5533E}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
......@@ -22,6 +27,10 @@ Global
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Debug|Win32.Build.0 = Debug|Win32
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Release|Win32.ActiveCfg = Release|Win32
{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}.Release|Win32.Build.0 = Release|Win32
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Debug|Win32.ActiveCfg = Debug|Win32
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Debug|Win32.Build.0 = Debug|Win32
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Release|Win32.ActiveCfg = Release|Win32
{C2882DDD-07E6-4314-AD4B-48F43F38D722}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -51,7 +51,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
AdditionalIncludeDirectories="XlsFormat; source/XlsFormat"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;STANDALONE_USE=1"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -144,7 +145,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;STANDALONE_USE=0"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
......@@ -213,6 +214,10 @@
RelativePath=".\ASCOfficeXlsFile2.cpp"
>
</File>
<File
RelativePath=".\source\ConvertXls2Xlsx.cpp"
>
</File>
<File
RelativePath=".\OfficeXlsFile.cpp"
>
......
// ASCOfficeXlsFileTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/timer.hpp>
#include <iostream>
#include <string>
#import "../../../Redist/ASCOfficeXlsFile2.dll" rename_namespace("ASCOfficeXlsFile"), raw_interfaces_only
#define HR_RET(HR) if FAILED(hr = (HR)) { _ASSERTE(false); return -1; }
class CCallback : public ASCOfficeXlsFile::_IAVSOfficeFileTemplateEvents
{
public:
CCallback(){m_cnt=0;}
virtual ~CCallback(){}
STDMETHOD(GetTypeInfoCount)(UINT*) { return E_NOTIMPL; }
STDMETHOD(GetTypeInfo)(UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
STDMETHOD(GetIDsOfNames)(REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
STDMETHOD(Invoke)(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
switch(dispIdMember)
{
case 1:
std::cout << "\nPercent : " << pDispParams->rgvarg[0].lVal / 10000. << "%\n";
return(S_OK);
break;
default:
return(E_NOTIMPL);
}
}
STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppv)
{
if ((iid == __uuidof(ASCOfficeXlsFile::_IAVSOfficeFileTemplateEvents)) ||
(iid == __uuidof(IDispatch)) ||
(iid == __uuidof(IUnknown)))
*ppv = this;
else {
*ppv = 0;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
STDMETHOD_(ULONG,AddRef)() {
return InterlockedIncrement(&m_cnt);
}
STDMETHOD_(ULONG,Release)() {
InterlockedDecrement(&m_cnt);
if (m_cnt!=0) return m_cnt;
delete this;
return 0;
}
protected:
LONG m_cnt;
private:
};
int ConvertSingle(int argc, _TCHAR* argv[])
{
ATL::CComPtr<ASCOfficeXlsFile::IAVSOfficeFileTemplate> officeXlsFile;
HRESULT hr;
HR_RET(officeXlsFile.CoCreateInstance(__uuidof(ASCOfficeXlsFile::COfficeXlsFile)));
//_______________________________________________________________________________________________________
IUnknown *pUnk;
IConnectionPointContainer* pContainer;
IConnectionPoint* pCP;
CCallback *pEvents = NULL;
DWORD dwAdvise=0;
pEvents = new CCallback;
pEvents->AddRef();
HR_RET(officeXlsFile->QueryInterface(IID_IConnectionPointContainer, (void**)&pContainer));
HR_RET(pContainer->FindConnectionPoint(__uuidof(ASCOfficeXlsFile::_IAVSOfficeFileTemplateEvents),&pCP));
HR_RET(pEvents->QueryInterface(IID_IUnknown,(VOID **)&pUnk));
HR_RET(pCP->Advise(pUnk,&dwAdvise));
pContainer->Release();pContainer=NULL;
pUnk->Release(); pUnk=NULL;
//____________
boost::timer t1;
officeXlsFile->LoadFromFile(ATL::CComBSTR(argv[1]), ATL::CComBSTR(argv[2]), NULL);
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
return ConvertSingle(argc, argv);
return 0;
}
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="ASCOfficeXlsFileTest"
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
RootNamespace="ASCOfficeOdfFileTest"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)Debug"
IntermediateDirectory="$(SolutionDir)$(ConfigurationName)/$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin/Release"
IntermediateDirectory="$(SolutionDir)output/$(ConfigurationName)/$(ProjectName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ASCOfficeXlsFileTest.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
// stdafx.cpp : source file that includes just the standard includes
// ASCOfficeOdfFileTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <windef.h>
#include <wingdi.h>
using namespace ATL;
// TODO: reference additional headers your program requires here
// OfficeXlsFile.cpp : Implementation of COfficeXlsFile
#include "stdafx.h"
#include <string>
#include <iostream>
#include <boost/uuid/uuid.hpp>
#pragma warning(push)
#pragma warning(disable : 4244)
#include <boost/uuid/random_generator.hpp>
#pragma warning(pop)
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
#include <boost_filesystem_version.h>
//#include "ConvertOO2OOX.h"
#include "..\Common\XmlUtils.h"
#include "..\Common\ASCATLError.h"
#include "OfficeXlsFile.h"
// : 1 , xlsx docx
// 0 , package
#ifndef STANDALONE_USE
#define STANDALONE_USE 0// : (1) (0)
#endif
// - uuid
boost::filesystem::wpath MakeTempDirectoryName(const std::wstring & Dst)
{
boost::uuids::random_generator gen;
boost::uuids::uuid u = gen();
boost::filesystem::wpath path = boost::filesystem::wpath(Dst) / boost::lexical_cast<std::wstring>(u);
return path;
}
std::wstring bstr2wstring(BSTR str)
{
return str ? std::wstring(&str[0], &str[::SysStringLen(str)]) : L"";
}
boost::filesystem::wpath MakeTempDirectoryName(BSTR Dst)
{
return MakeTempDirectoryName(bstr2wstring(Dst));
}
///------------------------------------------------------------------------------------
// COfficeXlsFile
COfficeXlsFile::COfficeXlsFile()
{
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
office_utils_.CoCreateInstance(__uuidof(ASCOfficeUtils::COfficeUtils));
#endif
}
HRESULT COfficeXlsFile::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
return E_NOTIMPL;
}
HRESULT COfficeXlsFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
return E_NOTIMPL;
HRESULT hr;
if (!initialized())
return E_FAIL;
if (!sDstPath)
{
_ASSERTE(!!sDstPath);
return E_FAIL;
}
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath outputDir = boost::filesystem::wpath(bstr2wstring(sDstPath)).parent_path();
#else
boost::filesystem::wpath outputDir = boost::filesystem::wpath(bstr2wstring(sDstPath));
#endif
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath dstTempPath = MakeTempDirectoryName(BOOST_STRING_PATH(outputDir));
#else
boost::filesystem::wpath dstTempPath = outputDir.string();
#endif
try
{
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
//
boost::filesystem::create_directory(dstTempPath);
#endif
hr = LoadFromFileImpl(bstr2wstring(sSrcFileName), BOOST_STRING_PATH(dstTempPath), bstr2wstring(sDstPath));
}
catch(...)
{
hr = E_FAIL;
}
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
// ( )
try
{
boost::filesystem::remove_all(dstTempPath);
}
catch(...)
{
}
#endif
return hr;
}
HRESULT COfficeXlsFile::LoadFromFileImpl(const std::wstring & srcFileName,
const std::wstring & dstTempPath,
const std::wstring & dstPath)
{
HRESULT hr = AVS_ERROR_UNEXPECTED;
#ifdef BOOST_FILESYSTEM_LEGACY
const std::wstring ext = boost::algorithm::to_lower_copy(boost::filesystem::wpath(srcFileName).extension());
#else
const std::wstring ext = boost::algorithm::to_lower_copy(boost::filesystem::wpath(srcFileName).extension().string<std::wstring>());
#endif
ProgressCallback ffCallBack;
ffCallBack.OnProgress = OnProgressFunc;
ffCallBack.OnProgressEx = OnProgressExFunc;
ffCallBack.caller = this;
//hr = ConvertXls2Xlsx(ext,srcFileName, dstTempPath, &ffCallBack);
if (hr != S_OK) return hr;
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
if FAILED(hr = office_utils_->CompressFileOrDirectory(ATL::CComBSTR(dstTempPath.c_str()), ATL::CComBSTR(dstPath.c_str()), (-1)))
return hr;
#endif
return S_OK;
}
bool COfficeXlsFile::initialized()
{
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
return (!!office_utils_);
#endif
return true;
}
void COfficeXlsFile::OnProgressFunc (LPVOID lpParam, long nID, long nPercent)
{
//g_oCriticalSection.Enter();
COfficeXlsFile* pXlsFile = reinterpret_cast<COfficeXlsFile*>(lpParam);
if (pXlsFile != NULL)
{
pXlsFile->OnProgress(nID, nPercent);
}
//g_oCriticalSection.Leave();
}
void COfficeXlsFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercent, short* pStop)
{
//g_oCriticalSection.Enter();
COfficeXlsFile* pXlsFile = reinterpret_cast<COfficeXlsFile*>(lpParam);
if (pXlsFile != NULL)
{
pXlsFile->OnProgressEx(nID, nPercent, pStop);
}
//g_oCriticalSection.Leave();
}
......@@ -5,6 +5,10 @@
#include "../Common/OfficeFileTemplate.h"
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
#import "../Redist/ASCOfficeUtils.dll" rename_namespace("ASCOfficeUtils"), raw_interfaces_only
#endif
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
......@@ -30,8 +34,6 @@ __interface IOfficeXlsFile : IAVSOfficeFileTemplate
]
__interface _IOfficeXlsFileEvents
{
[id(1), helpstring("method OnProgress")] HRESULT OnProgress([in] DOUBLE progress);
[id(2), helpstring("method OnComplete")] HRESULT OnComplete([in] LONG status);
};
......@@ -39,7 +41,7 @@ __interface _IOfficeXlsFileEvents
[
coclass,
default(IOfficeXlsFile, _IOfficeXlsFileEvents),
default(IOfficeXlsFile, _IAVSOfficeFileTemplateEvents),
threading(apartment),
event_source(com),
vi_progid("ASCOfficeXlsFile2.OfficeXlsFile"),
......@@ -52,11 +54,10 @@ class ATL_NO_VTABLE COfficeXlsFile :
public IOfficeXlsFile
{
public:
COfficeXlsFile()
{
}
COfficeXlsFile();
__event __interface _IOfficeXlsFileEvents;
__event __interface _IAVSOfficeFileTemplateEvents;
__event __interface _IAVSOfficeFileTemplateEvents2;
DECLARE_PROTECT_FINAL_CONSTRUCT()
......@@ -73,6 +74,20 @@ public:
public:
STDMETHOD(LoadFromFile) (BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
STDMETHOD(SaveToFile) (BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
ATL::CComPtr< ASCOfficeUtils::IOfficeUtils > office_utils_;
#endif
bool initialized();
HRESULT LoadFromFileImpl(const std::wstring & srcFileName,
const std::wstring & dstTempPath,
const std::wstring & dstPath);
protected:
static void OnProgressFunc (LPVOID lpParam, long nID, long nPercent);
static void OnProgressExFunc (LPVOID lpParam, long nID, long nPercent, short* pStop);
};
#include "stdafx.h"
#include "ConvertXls2Xlsx.h"
#include "..\..\Common\OfficeFileErrorDescription.h"
#include "XlsFormat\Document\Document.h"
#include "XlsFormat\Binary\CompoundFile.h"
#include "XlsFormat\Binary\BinSmartPointers.h"
#include "XlsFormat\Binary\CFStreamCacheReader.h"
#include "XlsFormat\Binary\CFStreamCacheWriter.h"
#include "XlsFormat\Logic\GlobalWorkbookInfo.h"
#include "XlsFormat\Logic\WorkbookStreamObject.h"
#include "XlsFormat\Logic\BinProcessor.h"
#include "XlsFormat\Logic\SummaryInformationStream\SummaryInformation.h"
#include "XlsFormat\Auxiliary\HelpersTagsGenerator.h"
HRESULT ConvertXls2Xlsx(const std::wstring &ext, const std::wstring & srcFile, const std::wstring & dstPath, bool bOnlyPresentation, const ProgressCallback* CallBack)
{
HRESULT hr = S_OK;
try
{
XLS::CompoundFile cfile(srcFile, CompoundFile::cf_ReadMode);
Document doc;
XLS::CFStreamPtr summary;
XLS::CFStreamPtr doc_summary;
try
{
summary = cfile.getSummaryInformationStream();
}
catch (...)
{
return AVS_ERROR_UNEXPECTED;
}
try
{
doc_summary = cfile.getDocumentSummaryInformationStream();
}
catch (...)
{
return AVS_ERROR_UNEXPECTED;
}
WORD workbook_code_page = WorkbookStreamObject::DefaultCodePage;
if(summary)
{
XLS::OLEPS::SummaryInformation summary_info(summary);
workbook_code_page = summary_info.GetCodePage();
}
else if(doc_summary)
{
XLS::OLEPS::SummaryInformation doc_summary_info(doc_summary);
workbook_code_page = doc_summary_info.GetCodePage();
}
if(1200/* UTF-16 */ == workbook_code_page || 0/*error*/ == workbook_code_page)
{
workbook_code_page = WorkbookStreamObject::DefaultCodePage;
}
XLS::GlobalWorkbookInfoPtr global_info(new GlobalWorkbookInfo(workbook_code_page));
XLS::CFStreamCacheReader stream_reader(cfile.getWorkbookStream(), global_info);
XLS::BinReaderProcessor proc(stream_reader, doc.getRoot(), true);
return proc.mandatory(WorkbookStreamObject(workbook_code_page)) &&
XLS::AUX::HelpersTagsGenerator(doc.getRoot()).GenHelpers();
}
catch(...)
{
return AVS_ERROR_UNEXPECTED;
}
return hr;
}
\ No newline at end of file
#include <windows.h>
#include <string>
struct ProgressCallback;
HRESULT ConvertXls2Xlsx(const std::wstring &ext, const std::wstring & srcFile, const std::wstring & dstPath, bool bOnlyPresentation, const ProgressCallback* CallBack);
\ No newline at end of file
......@@ -40,7 +40,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="XlsFormat"
AdditionalIncludeDirectories="XlsFormat; source\XlsFormat"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
......
......@@ -224,7 +224,7 @@ const std::string guid2str(const GUID guid)
const bool bstr2guid(const std::wstring & guid_str, GUID& guid)
{
HRESULT res = IIDFromString(static_cast<LPCOLESTR>(guid_str.c_str()), &guid);
HRESULT res = IIDFromString((LPWSTR)(guid_str.c_str()), &guid);
if(S_OK != res)
{
switch(res)
......
......@@ -2,8 +2,8 @@
#include "CFRecordType.h"
#include "BinSmartPointers.h"
#include "Logic\GlobalWorkbookInfo.h"
#include "Logic/Biff_structures/ODRAW/OfficeArtRecordHeader.h"
#include "../Logic/GlobalWorkbookInfo.h"
#include "../Logic/Biff_structures/ODRAW/OfficeArtRecordHeader.h"
namespace XLS
{;
......
#pragma once
#include "BinSmartPointers.h"
#include "Logic\GlobalWorkbookInfo.h"
#include "..\Logic\GlobalWorkbookInfo.h"
namespace XLS
{;
......
......@@ -2,7 +2,9 @@
#include <string>
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/shared_array.hpp>
class Document;
typedef boost::shared_ptr<Document> DocumentPtr;
......
......@@ -5,7 +5,7 @@
#include <boost/shared_ptr.hpp>
#include <Auxiliary/BetterVariantT.h>
#include "../../Auxiliary/BetterVariantT.h"
//#include <Logic/Biff_structures/BitMarkedStructs.h>
class Document;
......
#pragma once
#include <Logic/BaseObject.h>
#include <Logic/Biff_structures/BiffAttribute.h>
#include <Logic/Biff_structures/BiffStructure.h>
#include <Logic/Biff_structures/BiffStructure.h>
#include <Logic/GlobalWorkbookInfo.h>
#include "BaseObject.h"
#include "Biff_structures/BiffAttribute.h"
#include "Biff_structures/BiffStructure.h"
#include "Biff_structures/BiffStructure.h"
#include "GlobalWorkbookInfo.h"
namespace XLS
{;
......
#pragma once
#include "BaseObject.h"
#include "Logic\BinProcessor.h"
#include "BinProcessor.h"
namespace XLS
{;
......
#pragma once
#include <Crypt/Decryptor.h>
#include <Logic/Biff_structures/BorderFillInfo.h>
#include "../Crypt/Decryptor.h"
#include "Biff_structures/BorderFillInfo.h"
namespace XLS
......
......@@ -39,4 +39,14 @@
#include <atlhost.h>
using namespace ATL;
\ No newline at end of file
using namespace ATL;
typedef void (*OnProgressCallback)( LPVOID lpParam, long nID, long nPercent );
typedef void (*OnProgressExCallback)( LPVOID lpParam, long nID, long nPercent, short* Cancel );
struct ProgressCallback
{
OnProgressCallback OnProgress;
OnProgressExCallback OnProgressEx;
LPVOID caller;
};
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