Commit c2272f93 authored by Sergey.Kirillov's avatar Sergey.Kirillov Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52235 954022d7-b5bf-4e40-9824-e11837661b57
parent 02c2564e

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AVSOfficeXlsFile", "AVSOfficeWSHtmlFile\AVSOfficeWSHtmlFile.vcproj", "{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}"
ProjectSection(ProjectDependencies) = postProject
{210CA046-BD12-4711-95E6-AF4F35AB3E61} = {210CA046-BD12-4711-95E6-AF4F35AB3E61}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HtmlConverter", "HtmlConverter\source\main\HtmlConverter.vcproj", "{210CA046-BD12-4711-95E6-AF4F35AB3E61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}.Debug|Win32.ActiveCfg = Debug|Win32
{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}.Debug|Win32.Build.0 = Debug|Win32
{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}.Release|Win32.ActiveCfg = Release|Win32
{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}.Release|Win32.Build.0 = Release|Win32
{210CA046-BD12-4711-95E6-AF4F35AB3E61}.Debug|Win32.ActiveCfg = Debug|Win32
{210CA046-BD12-4711-95E6-AF4F35AB3E61}.Debug|Win32.Build.0 = Debug|Win32
{210CA046-BD12-4711-95E6-AF4F35AB3E61}.Release|Win32.ActiveCfg = Release|Win32
{210CA046-BD12-4711-95E6-AF4F35AB3E61}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
// AVSXlsFile.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll, uuid = "{25B7D44B-94A1-4c94-9718-102CFA8F00D5}",
name = "AVSOfficeWSHtmlFile",
helpstring = "AVSOfficeWSHtmlFile 1.0 Type Library",
resource_name = "IDR_AVSWSHTMLFILE") ]
class CAVSWSHtmlFileModule
{
public:
// Override CAtlDllModuleT members
};
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define COMPONENT_NAME "OfficeWSHtmlFile"
#include "../../../../Common/FileInfo.h"
#include "version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_AVSWSHTMLFILE REGISTRY "AVSOfficeWSHtmlFile.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "AVSOfficeWSHtmlFile"
END
#endif // Russian resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'AVSOfficeXlsFile'
'AVSOfficeXlsFile.DLL'
{
val AppID = s '%APPID%'
}
}
}
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="AVSOfficeWSHtmlFile"
ProjectGUID="{E83B5FA5-ACDD-46F5-8E35-B19F398C806D}"
RootNamespace="AVSXlsFile"
Keyword="AtlProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ProjectName)_$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/AVSOfficeWSHtmlFile.tlb"
HeaderFileName="AVSOfficeWSHtmlFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AVSOfficeWSHtmlFile_i.c"
ProxyFileName="AVSOfficeWSHtmlFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\HtmlConverter\source\Document"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
AdditionalDependencies="uafxcwd.lib LIBCMTD.lib HtmlConverter.res"
OutputFile="$(OutDir)/$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../HtmlConverter/lib/$(ConfigurationName)&quot;"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
AddModuleNamesToAssembly=""
AssemblyLinkResource=""
MergedIDLBaseFileName="_AVSOfficeWSHtmlFile.idl"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(OutDir)/AVSOfficeWSHtmlFile.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ProjectName)_$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/AVSOfficeWSHtmlFile.tlb"
HeaderFileName="AVSOfficeWSHtmlFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AVSOfficeWSHtmlFile_i.c"
ProxyFileName="AVSOfficeWSHtmlFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\HtmlConverter\source\Document"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="uafxcw.lib LIBCMT.lib HtmlConverter.res"
OutputFile="../../../../Redist/AVSOfficeStudio/$(ProjectName).dll"
AdditionalLibraryDirectories="&quot;../HtmlConverter/lib/$(ConfigurationName)&quot;"
MidlCommandFile=""
IgnoreEmbeddedIDL="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</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=".\AVSOfficeWSHtmlFile.cpp"
>
</File>
<File
RelativePath=".\HtmlFile.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=".\HtmlFile.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\version.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}"
>
<File
RelativePath=".\AVSOfficeWSHtmlFile.rc"
>
</File>
<File
RelativePath=".\AVSOfficeWSHtmlFile.rgs"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="AVSOfficeWSHtmlFile"
ProjectGUID="{84A86D26-5F0F-431F-97DD-AA10E62973B4}"
RootNamespace="AVSXlsFile"
Keyword="AtlProj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ProjectName)_$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/AVSOfficeWSHtmlFile.tlb"
HeaderFileName="AVSOfficeWSHtmlFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AVSOfficeWSHtmlFile_i.c"
ProxyFileName="AVSOfficeWSHtmlFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\HtmlConverter\source\Document"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
AdditionalDependencies="uafxcwd.lib LIBCMTD.lib HtmlConverter.res"
OutputFile="$(OutDir)/$(ProjectName).dll"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../HtmlConverter/lib/$(ConfigurationName)&quot;"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
AddModuleNamesToAssembly=""
AssemblyLinkResource=""
MergedIDLBaseFileName="_AVSOfficeWSHtmlFile.idl"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(OutDir)/AVSOfficeWSHtmlFile.lib"
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"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ProjectName)_$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="..\..\..\..\Redist\VersionControl.exe version.h"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/AVSOfficeWSHtmlFile.tlb"
HeaderFileName="AVSOfficeWSHtmlFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AVSOfficeWSHtmlFile_i.c"
ProxyFileName="AVSOfficeWSHtmlFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\HtmlConverter\source\Document"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="uafxcw.lib LIBCMT.lib HtmlConverter.res"
OutputFile="../../../../Redist/AVSOfficeStudio/$(ProjectName).dll"
AdditionalLibraryDirectories="&quot;../HtmlConverter/lib/$(ConfigurationName)&quot;"
MidlCommandFile=""
IgnoreEmbeddedIDL="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</Configuration>
<Configuration
Name="ReleaseASC|Win32"
OutputDirectory="bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ProjectName)_$(ConfigurationName)"
ConfigurationType="2"
UseOfATL="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="..\..\..\..\Redist\VersionControl.exe version.h"
ExcludedFromBuild="true"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/AVSOfficeWSHtmlFile.tlb"
HeaderFileName="AVSOfficeWSHtmlFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="AVSOfficeWSHtmlFile_i.c"
ProxyFileName="AVSOfficeWSHtmlFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\HtmlConverter\source\Document"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
WarningLevel="3"
WarnAsError="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;ASCBUILD"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="uafxcw.lib LIBCMT.lib HtmlConverter.res"
OutputFile="../../../../..\ASC\Redist/ASCOfficeStudio/ASCOfficeWSHtmlFile.dll"
AdditionalLibraryDirectories="&quot;../HtmlConverter/lib/$(ConfigurationName)&quot;"
MidlCommandFile=""
IgnoreEmbeddedIDL="false"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</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=".\AVSOfficeWSHtmlFile.cpp"
>
</File>
<File
RelativePath=".\HtmlFile.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>
<FileConfiguration
Name="ReleaseASC|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=".\HtmlFile.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\version.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}"
>
<File
RelativePath=".\AVSOfficeWSHtmlFile.rc"
>
</File>
<File
RelativePath=".\AVSOfficeWSHtmlFile.rgs"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
// HtmlFile.cpp : Implementation of CWSHtmlFile
#include "stdafx.h"
#include "HtmlFile.h"
#include <EWSDocument.h>
// CWSHtmlFile
STDMETHODIMP CWSHtmlFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
// EWSCORE::EWSDocument doc;
// bool res = doc.loadFrom(sSrcFileName, ef_HTML) &&
// doc.saveTo(sDstPath, ef_XLSX);
//
// return res ? S_OK : S_FALSE;
return S_FALSE;
}
STDMETHODIMP CWSHtmlFile::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
EWSCORE::EWSDocument doc;
bool res = doc.loadFrom(sSrcPath, ef_XLSX) &&
doc.saveTo(sDstFileName, ef_HTML, _bstr_t(sXMLOptions));
return res ? S_OK : S_FALSE;
}
// HtmlFile.h : Declaration of the CWSHtmlFile
#pragma once
#include "resource.h" // main symbols
#include "..\..\Common\OfficeFileTemplate.h"
#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
// IWSHtmlFile
[
object,
uuid("CCF70ADF-EB35-4e11-A0BB-D039DC538BE6"),
dual, helpstring("IWSHtmlFile Interface"),
pointer_default(unique)
]
__interface IWSHtmlFile : IAVSOfficeFileTemplate
{
};
// _IWSHtmlFileEvents
[
dispinterface,
uuid("1BA617F0-31CA-4104-9F80-7B098155755F"),
helpstring("_IWSHtmlFileEvents Interface")
]
__interface _IWSHtmlFileEvents
{
[id(1), helpstring("method OnProgress")] HRESULT OnProgress([in] DOUBLE progress);
[id(2), helpstring("method OnComplete")] HRESULT OnComplete([in] LONG status);
};
// CWSHtmlFile
[
coclass,
default(IWSHtmlFile, _IWSHtmlFileEvents),
threading(apartment),
event_source(com),
vi_progid("AVSOfficeWSHtmlFile.WSHtmlFile"),
progid("AVSOfficeWSHtmlFile.WSHtmlFile.1"),
version(1.0),
uuid("4B835C27-09B7-49e8-B9C8-5F7A5E5048BF"),
helpstring("WSHtmlFile Class")
]
class ATL_NO_VTABLE CWSHtmlFile :
public IWSHtmlFile
{
public:
CWSHtmlFile()
{
}
__event __interface _IWSHtmlFileEvents;
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
};
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AVSOfficeWSHtmlFile.rc
//
#define IDS_PROJNAME 100
#define IDR_AVSWSHTMLFILE 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
// stdafx.cpp : source file that includes just the standard includes
// AVSXlsFile.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// 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 STRICT
#define STRICT
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off ATL's hiding of some common and often safely ignored warning messages
#define _ATL_ALL_WARNINGS
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <comutil.h> // _bstr_t
//#include <string>
using namespace ATL;
\ No newline at end of file
#pragma once
//1
//0
//0
//13
#define INTVER 1,0,0,13
#define STRVER "1,0,0,13\0"

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AVSOfficeWSHtmlFile", "AVSOfficeWSHtmlFile\AVSOfficeWSHtmlFile2005.vcproj", "{84A86D26-5F0F-431F-97DD-AA10E62973B4}"
ProjectSection(ProjectDependencies) = postProject
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94} = {88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HtmlConverter", "HtmlConverter\source\main\HtmlConverter2005.vcproj", "{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.Debug|Win32.ActiveCfg = Debug|Win32
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.Debug|Win32.Build.0 = Debug|Win32
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.Release|Win32.ActiveCfg = Release|Win32
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.Release|Win32.Build.0 = Release|Win32
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{84A86D26-5F0F-431F-97DD-AA10E62973B4}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.Debug|Win32.ActiveCfg = Debug|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.Debug|Win32.Build.0 = Debug|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.Release|Win32.ActiveCfg = Release|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.Release|Win32.Build.0 = Release|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{88B68BC0-9F1B-4E11-8DB3-4F96A6629D94}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#pragma once
namespace XLS
{;
class CellRangeRef;
}
namespace AUX
{;
const int normalizeColumn(const int column);
const int normalizeRow(const int row);
const std::wstring column2str(const int column);
const std::wstring row2str(const int row);
const std::wstring loc2str(const long row, const bool row_rel, const long column, const bool col_rel);
void str2loc(const std::wstring& str, long& row, bool& row_rel, long& column, bool& col_rel);
void str2loc(std::wstring::const_iterator& str_begin, std::wstring::const_iterator& str_end, long& row, bool& row_rel, long& column, bool& col_rel);
void str2refs(const std::wstring& str, std::vector<XLS::CellRangeRef>& vec);
}
namespace STR
{;
const std::string int2str(const int val, const int radix = 10);
const std::wstring int2wstr(const int val, const int radix = 10);
const std::wstring double2str(const double val);
const std::string bin2str(const char* buf, const size_t nbuf);
const _bstr_t guid2bstr(const GUID guid);
const std::string guid2str(const GUID guid);
const bool bstr2guid(const _bstr_t& guid_str, GUID& guid);
const std::string int2hex_str(const int val, const size_t size_of = 4);
const std::wstring escapeW(const std::wstring& str);
const std::string toARGB(const DWORD rgba);
const std::string toARGB(const BYTE red, const BYTE green, const BYTE blue, const BYTE alpha);
const bool fromARGB(const std::wstring& argb, BYTE& red, BYTE& green, BYTE& blue, BYTE& alpha);
const size_t hex_str2int(const std::wstring& hex);
const std::string hres2str(const HRESULT hres);
}
namespace XMLSTUFF
{;
MSXML2::IXMLDOMElementPtr findElementAmongParents(MSXML2::IXMLDOMElementPtr own_tag, const _bstr_t& tag_name, const bool checkSelf = false);
const bool isChildOf(MSXML2::IXMLDOMElementPtr own_tag, const _bstr_t& tag_name, const bool checkSelf = false);
const bool loadXSLTFromResources(MSXML2::IXMLDOMDocumentPtr xslt_doc, const std::vector<std::wstring>& resources);
// Makes a new XML tag and append it to parent (no attributes set)
MSXML2::IXMLDOMElementPtr makeXMLNode(const std::string& tag_name, MSXML2::IXMLDOMElementPtr parent);
const std::wstring make3dRef(const WORD ixti, const std::wstring cell_ref, MSXML2::IXMLDOMDocumentPtr doc);
const WORD sheetsnames2ixti(const std::wstring str, MSXML2::IXMLDOMDocumentPtr doc);
}
#include "stdafx.h"
#include "Converter.h"
#include <Document/Document.h>
const bool Converter::convert(Document& doc, MSXML2::IXMLDOMDocumentPtr xslt)
{
return VARIANT_TRUE == doc.getDoc()->loadXML(doc.getDoc()->transformNode(xslt));
}
#pragma once
class Document;
class Converter
{
public:
virtual const bool convertToX(Document& doc) = 0;
virtual const bool convertFromX(Document& doc, const _bstr_t& xml_options, const _bstr_t& file_name) = 0;
protected:
const bool convert(Document& doc, MSXML2::IXMLDOMDocumentPtr xslt);
};
#include "stdafx.h"
#include "HTMLConverter.h"
#include <Document/Document.h>
#include <fstream>
#include <iostream> // endl
#include "boost/filesystem.hpp"
namespace HTML
{;
// static const GUID CLSID_XSLTemplate = { 0x2933bf93, 0x7b36, 0x11d2, { 0xb2, 0x0e, 0x00, 0xc0, 0x4f, 0x98, 0x3e, 0x60 } };
HTMLConverter::HTMLConverter()
//: xslt_x2h(_T("Msxml2.XSLTemplate.6.0"))
{
// CoCreateInstance(CLSID_XSLTemplate, NULL, CLSCTX_SERVER,
// __uuidof(MSXML2::IXSLTemplate), (LPVOID*)(&xslt_x2h));
// MSXML2::IXMLDOMDocument3Ptr xslt_from_X = PrepareX2H_XSLT();
// xslt_x2h->PutRefstylesheet(xslt_from_X);
}
MSXML2::IXMLDOMDocument3Ptr HTMLConverter::PrepareX2H_XSLT()
{
MSXML2::IXMLDOMDocument3Ptr xslt_from_X(_T("Msxml2.FreeThreadedDOMDocument.6.0"));
xslt_from_X->Putasync(VARIANT_FALSE);
xslt_from_X->setProperty(L"SelectionNamespaces", L"xmlns:xsl='http://www.w3.org/1999/XSL/Transform'");
std::vector<std::wstring> resources;
wchar_t file_path[MAX_PATH];
GetModuleFileNameW(ATL::_AtlBaseModule.GetModuleInstance(), file_path, MAX_PATH);
std::wstring dll_file_name = boost::filesystem::wpath(file_path).filename();
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2016"); // x2htm.xml
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2017"); // x2htm_index.xml
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2018"); // x2htm_sheet.xml
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2019"); // x2htm_tabs.xml
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2020"); // x2htm_css.xml
resources.push_back(L"res://" + dll_file_name + L"/XSL/#2021"); // x2htm_tools.xml
if(!XMLSTUFF::loadXSLTFromResources(xslt_from_X, resources))
{
return MSXML2::IXMLDOMDocument3Ptr(NULL);
}
Log::event("XLSX to HTML XSLT table loaded from resources successfully");
#ifdef _DEBUG
// DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG
//xslt_from_X->save(L"../InFiles/convert.xsl");
// DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG
#endif
return xslt_from_X;
}
const bool HTMLConverter::convertFromX(Document& doc, const _bstr_t& xml_options, const _bstr_t& file_name)
{
MSXML2::IXSLTemplatePtr xslt_x2h(_T("Msxml2.XSLTemplate.6.0"));
MSXML2::IXMLDOMDocument3Ptr xslt_from_X = PrepareX2H_XSLT();
if(NULL == xslt_from_X)
{
return false;
}
xslt_x2h->PutRefstylesheet(xslt_from_X);
#pragma region Parse converter options
_bstr_t single_file = L"false";
_bstr_t print_file = L"false";
_bstr_t print_index = L"1";
MSXML2::IXMLDOMDocument3Ptr options(_T("Msxml2.DOMDocument.6.0"));
if(xml_options.length() != 0 && VARIANT_TRUE == options->loadXML(xml_options))
{
MSXML2::IXMLDOMElementPtr single_file_xml = options->selectSingleNode(L"Options/HTML/SingleFile");
if(NULL != single_file_xml)
{
single_file = single_file_xml->getAttribute(L"val");
}
MSXML2::IXMLDOMElementPtr print_file_xml = options->selectSingleNode(L"Options/HTML/Print");
if(NULL != print_file_xml)
{
print_file = print_file_xml->getAttribute(L"val");
print_index = print_file_xml->getAttribute(L"ind");
}
}
#pragma endregion
MSXML2::IXSLProcessorPtr processor = xslt_x2h->createProcessor();
processor->Putinput(_variant_t(doc.getDoc().GetInterfacePtr()));
processor->addParameter("workbook_filename", file_name, _bstr_t(L""));
processor->addParameter("charset", _bstr_t(L"UTF-8"), _bstr_t(L""));
processor->addParameter("single_file", single_file, _bstr_t(L""));
processor->addParameter("print_file", print_file, _bstr_t(L""));
processor->addParameter("print_index", print_index, _bstr_t(L""));
if(VARIANT_TRUE != processor->transform())
{
return false;
}
if(VARIANT_TRUE != doc.getDoc()->loadXML(_bstr_t(processor->Getoutput())))
{
return false;
}
Log::event("The internal XLSX XML converted to HTML XML successfully");
return true;
}
const bool HTMLConverter::convertToX(Document& doc)
{
return false;
}
} // namespace XLS
#pragma once
#include <Converter/Converter.h>
namespace HTML
{;
class HTMLConverter : public Converter
{
public:
HTMLConverter();
virtual const bool convertToX(Document& doc);
virtual const bool convertFromX(Document& doc, const _bstr_t& xml_options, const _bstr_t& file_name);
private:
MSXML2::IXMLDOMDocument3Ptr PrepareX2H_XSLT();
// private:
// MSXML2::IXSLTemplatePtr xslt_x2h;
};
} // namespace XLS
#include "stdafx.h"
#include "XLSXConverter.h"
namespace XLSX
{;
const bool XLSXConverter::convertToX(Document& doc)
{
return true; // Already the necessary format
}
const bool XLSXConverter::convertFromX(Document& doc, const _bstr_t& xml_options, const _bstr_t& file_name)
{
return true; // Already the necessary format
}
} // namespace XLS
#pragma once
#include <Converter/Converter.h>
namespace XLSX
{;
class XLSXConverter : public Converter
{
public:
virtual const bool convertToX(Document& doc);
virtual const bool convertFromX(Document& doc, const _bstr_t& xml_options, const _bstr_t& file_name);
};
} // namespace XLSX
// Base64_RC4.h : implementation of the Base64 and RC4 algorithm class
//
/*
* Base64_RC4.h - Copyright (C) 2006 Jerry Jiang
*
* Email :jerryJBL@gmail.com
**********************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* Version 1.0
* Date:April 2009
**********************************************************************
*
*/
#ifndef _BASE64_RC4_
#define _BASE64_RC4_
const unsigned char B64_offset[256] =
{
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
};
const char base64_map[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
class CBase64
{
public:
CBase64(){}
char *Encrypt(const char * srcp, int len, char * dstp)
{
register int i = 0;
char *dst = dstp;
for (i = 0; i < len - 2; i += 3)
{
*dstp++ = *(base64_map + ((*(srcp+i)>>2)&0x3f));
*dstp++ = *(base64_map + ((*(srcp+i)<< 4)&0x30 | (*(srcp+i+1)>>4)&0x0f ));
*dstp++ = *(base64_map + ((*(srcp+i+1)<<2)&0x3C | (*(srcp+i+2)>>6)&0x03));
*dstp++ = *(base64_map + (*(srcp+i+2)&0x3f));
}
srcp += i;
len -= i;
if(len & 0x02 ) /* (i==2) 2 bytes left,pad one byte of '=' */
{
*dstp++ = *(base64_map + ((*srcp>>2)&0x3f));
*dstp++ = *(base64_map + ((*srcp<< 4)&0x30 | (*(srcp+1)>>4)&0x0f ));
*dstp++ = *(base64_map + ((*(srcp+1)<<2)&0x3C) );
*dstp++ = '=';
}
else if(len & 0x01 ) /* (i==1) 1 byte left,pad two bytes of '=' */
{
*dstp++ = *(base64_map + ((*srcp>>2)&0x3f));
*dstp++ = *(base64_map + ((*srcp<< 4)&0x30));
*dstp++ = '=';
*dstp++ = '=';
}
*dstp = '\0';
return dst;
}
void *Decrypt(const char * srcp, int len, char * dstp)
{
register int i = 0;
void *dst = dstp;
while(i < len)
{
*dstp++ = (B64_offset[*(srcp+i)] <<2 | B64_offset[*(srcp+i+1)] >>4);
*dstp++ = (B64_offset[*(srcp+i+1)]<<4 | B64_offset[*(srcp+i+2)]>>2);
*dstp++ = (B64_offset[*(srcp+i+2)]<<6 | B64_offset[*(srcp+i+3)] );
i += 4;
}
srcp += i;
if(*(srcp-2) == '=') /* remove 2 bytes of '=' padded while encoding */
{
*(dstp--) = '\0';
*(dstp--) = '\0';
}
else if(*(srcp-1) == '=') /* remove 1 byte of '=' padded while encoding */
*(dstp--) = '\0';
*dstp = '\0';
return dst;
};
size_t B64_length(size_t len)
{
size_t npad = len%3;
size_t size = (npad > 0)? (len +3-npad ) : len; // padded for multiple of 3 bytes
return (size*8)/6;
}
size_t Ascii_length(size_t len)
{
return (len*6)/8;
}
};
#define SWAP(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
class CRC4
{
private:
unsigned char sbox[256]; /* Encryption array */
unsigned char key[256],k; /* Numeric key values */
int m, n, i, j, ilen; /* Ambiguously named counters */
public:
CRC4 ()
{
memset(sbox,0,256);
memset(key,0,256);
}
virtual ~CRC4 ()
{
memset(sbox,0,256); /* remove Key traces in memory */
memset(key,0,256);
}
char *Encrypt(char *pszText,const char *pszKey)
{
i=0, j=0,n = 0;
ilen = (int)strlen(pszKey);
for (m = 0; m < 256; m++) /* Initialize the key sequence */
{
*(key + m)= *(pszKey + (m % ilen));
*(sbox + m) = m;
}
for (m=0; m < 256; m++)
{
n = (n + *(sbox+m) + *(key + m)) &0xff;
SWAP(*(sbox + m),*(sbox + n));
}
ilen = (int)strlen(pszText);
for (m = 0; m < ilen; m++)
{
i = (i + 1) &0xff;
j = (j + *(sbox + i)) &0xff;
SWAP(*(sbox+i),*(sbox + j)); /* randomly Initialize the key sequence */
k = *(sbox + ((*(sbox + i) + *(sbox + j)) &0xff ));
if(k == *(pszText + m)) /* avoid '\0' beween the decoded text; */
k = 0;
*(pszText + m) ^= k;
}
return pszText;
}
char *Decrypt(char *pszText,const char *pszKey)
{
return Encrypt(pszText,pszKey) ; /* using the same function as encoding */
}
};
#endif
\ No newline at end of file
# Microsoft Developer Studio Project File - Name="MD5" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=MD5 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "MD5.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "MD5.mak" CFG="MD5 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MD5 - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "MD5 - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "MD5 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "MD5 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "MD5 - Win32 Release"
# Name "MD5 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\md5c.c
# End Source File
# Begin Source File
SOURCE=.\md5class.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\global.h
# End Source File
# Begin Source File
SOURCE=.\MD5.h
# End Source File
# Begin Source File
SOURCE=.\md5class.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "MD5"=.\MD5.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
/* MD5.H - header file for MD5C.C
*/
//See internet RFC 1321, "The MD5 Message-Digest Algorithm"
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* MD5 context. */
#ifndef _MD5CONTEXT_H
#define _MD5CONTEXT_H
#include "global.h"
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
#ifdef __cplusplus //added by Jim Howard so that these functions can be called from c++
extern "C"
{
#endif
void MD5Init PROTO_LIST ((MD5_CTX *));
void MD5Update PROTO_LIST
((MD5_CTX *, unsigned char *, unsigned int));
void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
#ifdef __cplusplus
}
#endif
#endif
\ No newline at end of file
//See internet RFC 1321, "The MD5 Message-Digest Algorithm"
/* GLOBAL.H - RSAREF types and constants
*/
#ifndef _MD5_GLOBAL_H
#define _MD5_GLOBAL_H
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 1
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
#endif
//Example program for the CMD5 class wrapper of the RFC 1321 Message Digest 5 code.
//Jim Howard
//jnhtx@jump.net
//http://www.jump.net/~jnhtx
//Use this code as you see fit. It is provided "as is"
//without express or implied warranty of any kind.
#ifdef _DEBUG
#pragma warning( disable : 4786) //This warning always occurs with the ms compiler when using <vector>, it's nothing to worry about
#endif
#include <stdio.h>
#include "md5class.h"
#include <vector>
#include <string>
using namespace std; //required to use STL with MS compiler
int main()
{
//This program calculates message digests for the test strings given
//in RFC 1321, "The MD5 Message-Digest Algorithm".
vector<string> v;
v.push_back(std::string(""));
v.push_back(std::string("a"));
v.push_back(std::string("abc"));
v.push_back(std::string("message digest"));
v.push_back(std::string("abcdefghijklmnopqrstuvwxyz"));
v.push_back(std::string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
v.push_back(std::string("12345678901234567890123456789012345678901234567890123456789012345678901234567890"));
CMD5 md5;
for(int i=0; i<v.size(); i++)
{
md5.setPlainText( v[i].c_str() );
printf("%s -> %s\n", v[i].c_str(),md5.getMD5Digest());
}
return 0;
}
\ No newline at end of file
// md5class.cpp: implementation of the CMD5 class.
//See internet RFC 1321, "The MD5 Message-Digest Algorithm"
//
//Use this code as you see fit. It is provided "as is"
//without express or implied warranty of any kind.
//////////////////////////////////////////////////////////////////////
#include "md5class.h"
#include "md5.h" //declarations from RFC 1321
#include <string.h>
#include <stdio.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMD5::CMD5()
{
m_digestValid = false; //we don't have a plaintext string yet
m_digestString[32]=0; //the digest string is always 32 characters, so put a null in position 32
}
CMD5::~CMD5()
{
}
CMD5::CMD5(const char* plainText)
{
m_plainText = const_cast<char*>(plainText); //get a pointer to the plain text. If casting away the const-ness worries you,
//you could make a local copy of the plain text string.
m_digestString[32]=0;
m_digestValid = calcDigest();
}
//////////////////////////////////////////////////////////////////////
// Implementation
//////////////////////////////////////////////////////////////////////
void CMD5::setPlainText(const char* plainText)
{
//set plaintext with a mutator, it's ok to
//to call this multiple times. If casting away the const-ness of plainText
//worries you, you could either make a local copy of the plain
//text string instead of just pointing at the user's string, or
//modify the RFC 1321 code to take 'const' plaintext, see example below.
m_plainText = const_cast<char*>(plainText);
m_digestValid = calcDigest();
}
/* Use a function of this type with your favorite string class
if casting away the const-ness of the user's text buffer violates you
coding standards.
void CMD5::setPlainText(CString& strPlainText)
{
static CString plaintext(strPlainText);
m_plainText = strPlainText.GetBuffer();
m_digestValid = calcDigest();
}
*/
const char* CMD5::getMD5Digest()
{ //access message digest (aka hash), return 0 if plaintext has not been set
if(m_digestValid)
{
return m_digestString;
} else return 0;
}
bool CMD5::calcDigest()
{
//See RFC 1321 for details on how MD5Init, MD5Update, and MD5Final
//calculate a digest for the plain text
MD5_CTX context;
MD5Init(&context);
//the alternative to these ugly casts is to go into the RFC code and change the declarations
MD5Update(&context, reinterpret_cast<unsigned char *>(m_plainText), ::strlen(m_plainText));
MD5Final(reinterpret_cast <unsigned char *>(m_digest),&context);
//make a string version of the numeric digest value
int p=0;
for (int i = 0; i<16; i++)
{
::sprintf(&m_digestString[p],"%02x", m_digest[i]);
p+=2;
}
return true;
}
// md5class.h: interface for the CMD5 class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MD51_H__2A1EA377_D065_11D4_A8C8_0050DAC6D85C__INCLUDED_)
#define AFX_MD51_H__2A1EA377_D065_11D4_A8C8_0050DAC6D85C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/***************************************************************************
This class is a utility wrapper for 'C' code contained in internet RFC 1321,
"The MD5 Message-Digest Algorithm".
It calculates a cryptological hash value, called a "digest" from a character
string. For every unique character string the MD5 hash is guaranteed to be
unique. The MD5 hash has the property that given the digest, it's
thought to be impossible to get back to the plain text string with existing
technology. In this implementation the digest is always a 32 digit hex number,
regardless of the length of the input plaintext.
This class is helpful for programs which store passwords. Rather than storing
the password directly, the programmer should store the MD5 digest of the password.
Then when the user enters a password, compute the MD5 digest of the input password.
If it is identical to the stored digest, then the user
has entered the correct password. It doesn't matter if an evil person sees the
digest, since he or she can't get from the digest to the password. At least not
unless the user enters a word out of the dictionary, since the evil person could
hash the whole dictionary. One way to defeat a dictionary attack is to append
a non-text character onto the password, so that even if the user enters a dumb
password like "password", you just append some non alpha character to the entered
password, i.e. password = "password" + "$". By always appending a nonalpha
character, your stored digest isn't in the attacker's dictionary. You can
then safely post the digest of the password on a highway billboard.
Example pseudocode:
{
std::string storedPasswordDigest = GetPasswordDigestFromStorage();
std::string passwordEnteredbyUser;
cout << "Enter password:" ;
cin >> passwordEnteredbyUser;
CMD5 md5(passwordEnteredbyUser.c_str()); //note c_str() returns a pointer to the std::string's character buffer, just like CString's "GetBuffer" member function.
if(md5.getMD5Digest != storedPasswordDigest)
{
//user has entered an invalid password
cout << "Incorrect password!";
exit(1);
}
//if we get here, then the user entered a valid password
}
**************************************************************************
Use this code as you see fit. It is provided "as is"
without express or implied warranty of any kind.
Jim Howard, jnhtx@jump.net
***************************************************************************/
class CMD5
{
public:
CMD5(); //default ctor
CMD5(const char* plainText); //set plaintext in ctor
void setPlainText(const char* plainText); //set plaintext with a mutator, it's ok to
//to call this multiple times, the digest is recalculated after each call.
const char* getMD5Digest(); //access message digest (aka hash), return 0 if plaintext has not been set
virtual ~CMD5();
private:
bool calcDigest(); //this function computes the digest by calling the RFC 1321 'C' code
bool m_digestValid; //false until the plaintext has been set and digest computed
unsigned char m_digest[16]; //the numerical value of the digest
char m_digestString[33]; //Null terminated string value of the digest expressed in hex digits
char* m_plainText; //a pointer to the plain text. If casting away the const-ness
//worries you, you could either make a local copy of the plain
//text string instead of just pointing at the user's string or
//modify the RFC 1321 code to take 'const' plaintext.
};
#endif // !defined(AFX_MD51_H__2A1EA377_D065_11D4_A8C8_0050DAC6D85C__INCLUDED_)
#include "stdafx.h"
#include "Document.h"
#include "boost/filesystem.hpp"
//#import <msxml6.dll>
std::map<_bstr_t, Document*> Document::all_documents;
Document::Document(const _bstr_t& root_name)
: xmlDoc(_T("Msxml2.DOMDocument.6.0"))
{
xmlDoc->setProperty(L"SelectionNamespaces", L"xmlns:xlsx='http://www.avs4you.ru/XLSXConverter/1.0/DirectoryStructure'");
newXMLDoc(L"root");
}
Document::~Document()
{
all_documents[guid_] = NULL;
}
MSXML2::IXMLDOMElementPtr Document::getRoot() const
{
return xmlDoc->GetdocumentElement(); // current root independent on its name
}
MSXML2::IXMLDOMDocument3Ptr Document::getDoc() const
{
return xmlDoc;
}
void Document::newXMLDoc(const _bstr_t& root_name)
{
if(!!guid_)
{
all_documents.erase(guid_);
}
GUID guid = {0};
CoCreateGuid(&guid);
guid_ = STR::guid2bstr(guid);
xmlDoc->loadXML(L"<?xml version=\"1.0\" encoding=\"utf-8\" ?> <" + root_name +
L" id=\"" + guid_ + L"\"/>"); // Initial tag;
all_documents[guid_] = this;
}
void Document::setDoc(MSXML2::IXMLDOMDocument3Ptr doc)
{
xmlDoc = doc;
}
const int Document::appendBinaryData(MSXML2::IXMLDOMElementPtr elem, const char * data, const size_t size)
{
boost::shared_array<char> buffer(new char[size]);
memcpy_s(buffer.get(), size, data, size);
return appendBinaryData(elem, buffer, size);
}
const int Document::appendBinaryData(MSXML2::IXMLDOMElementPtr elem, boost::shared_array<char>& pre_allocated_data, const size_t size)
{
Document* doc = findDocumentByXMLElement(elem);
if(!doc)
{
return -1;
}
doc->bin_data.push_back(std::pair<boost::shared_array<char>, size_t>(pre_allocated_data, size));
return doc->bin_data.size() - 1;
}
const std::pair<char*, size_t> Document::getBinaryData(const int index) const
{
if(index < 0 || static_cast<size_t>(index) > bin_data.size() - 1)
{
return std::pair<char*, size_t>(NULL, 0);
}
return std::pair<char*, size_t>(bin_data[index].first.get(), bin_data[index].second);
}
Document* Document::findDocumentByXMLElement(MSXML2::IXMLDOMElementPtr elem)
{
return all_documents[static_cast<_bstr_t>(elem->GetownerDocument()->GetdocumentElement()->getAttribute(L"id"))];
}
void Document::SetWorkbookNameFromFilename(_bstr_t file_path)
{
workbook_name = boost::filesystem::wpath(static_cast<wchar_t*>(file_path)).stem().c_str();
}
#pragma once
#include <boost/shared_array.hpp>
class Document;
typedef boost::shared_ptr<Document> DocumentPtr;
class Document
{
public:
Document(const _bstr_t& root_name);
~Document();
MSXML2::IXMLDOMElementPtr getRoot() const;
MSXML2::IXMLDOMDocument3Ptr getDoc() const;
void newXMLDoc(const _bstr_t& root_name);
void setDoc(MSXML2::IXMLDOMDocument3Ptr doc);
static const int appendBinaryData(MSXML2::IXMLDOMElementPtr elem, const char * data, const size_t size);
static const int appendBinaryData(MSXML2::IXMLDOMElementPtr elem, boost::shared_array<char>& pre_allocated_data, const size_t size);
static Document* findDocumentByXMLElement(MSXML2::IXMLDOMElementPtr elem);
const std::pair<char*, size_t> getBinaryData(const int index) const;
void SetWorkbookNameFromFilename(_bstr_t file_path);
_bstr_t GetWorkbookName() { return workbook_name; }
private:
MSXML2::IXMLDOMDocument3Ptr xmlDoc;
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
_bstr_t guid_;
_bstr_t workbook_name;
private:
static std::map<_bstr_t, Document*> all_documents;
};
#include "stdafx.h"
#include "EWSDocument.h"
#include "Document.h"
#include <FormatFactory/Producer.h>
#include <Serializer/Serializer.h>
#include <Converter/Converter.h>
#include <Exception/exceptions.h>
#include "boost/filesystem.hpp"
namespace EWSCORE
{;
EWSDocument::EWSDocument()
{
doc_ = new Document(L"root");
}
EWSDocument::~EWSDocument()
{
delete doc_;
}
bool EWSDocument::loadFrom(const _bstr_t& from_filename, const EWS_FORMAT format)
{
try
{
if(Producer::getSerializer(format).read(*doc_, from_filename))
{
doc_->SetWorkbookNameFromFilename(from_filename);
#ifdef _DEBUG
Producer::getSerializer(ef_XML).write(*doc_, from_filename + L"_in.xml");
#endif
if(Producer::getConverter(format).convertToX(*doc_))
{
return true;
}
}
return false;
}
catch(EXCEPT::LogicalException&)
{
return false;
}
catch(EXCEPT::RuntimeException&)
{
return false;
}
catch(_com_error error)
{
std::string additional_descr = error.Description().length() ? std::string("Description: ") + static_cast<char*>(error.Description()) : "";
Log::error(std::string("_com_error exception!!! HRESULT: ") + STR::int2hex_str(error.Error()) + "(" + static_cast<char*>(_bstr_t(error.ErrorMessage())) + ") "+ additional_descr);
return false;
}
}
bool EWSDocument::saveTo(const _bstr_t& to_file_path, const EWS_FORMAT format, _bstr_t xml_options)
{
try
{
doc_->SetWorkbookNameFromFilename(to_file_path);
boost::filesystem::wpath file_path(static_cast<wchar_t*>(to_file_path));
if(0 == file_path.extension().length())
{
file_path = boost::filesystem::wpath(to_file_path + L".html");
}
if(Producer::getConverter(format).convertFromX(*doc_, xml_options, _bstr_t(file_path.filename().c_str())))
{
#ifdef _DEBUG
Producer::getSerializer(ef_XML).write(*doc_, to_file_path + L"_out.xml");
#endif
if(Producer::getSerializer(format).write(*doc_, to_file_path))
{
return true;
}
}
return false;
}
catch(EXCEPT::LogicalException&)
{
return false;
}
catch(EXCEPT::RuntimeException&)
{
return false;
}
catch(_com_error error)
{
std::string additional_descr = error.Description().length() ? std::string("Description: ") + static_cast<char*>(error.Description()) : "";
Log::error(std::string("_com_error exception!!! HRESULT: ") + STR::int2hex_str(error.Error()) + "(" + static_cast<char*>(_bstr_t(error.ErrorMessage())) + ") "+ additional_descr);
return false;
}
}
}
\ No newline at end of file
#pragma once
typedef enum {
ef_HTML,
ef_XLSX,
ef_ODS,
ef_SXC,
ef_XML,
ef_AUTO_DETECT,
ef_END
} EWS_FORMAT;
class Document;
namespace EWSCORE
{;
class EWSDocument
{
public:
EWSDocument();
~EWSDocument();
public:
bool loadFrom(const _bstr_t& from_filename, const EWS_FORMAT format);
bool saveTo(const _bstr_t& to_file_path, const EWS_FORMAT format, _bstr_t xml_options);
private:
Document* doc_;
};
}
#include "stdafx.h"
#include "MSXMLErrHandler.h"
#include <Exception/MSXMLError.h>
namespace MSXML2
{;
MSXMLErrHandler::MSXMLErrHandler(const HRESULT hres, IXMLDOMNode* object, REFIID iid, const std::string& func_name)
: hres_(hres),
object_(object),
iid_(iid),
func_name_(func_name)
{
}
MSXMLErrHandler::~MSXMLErrHandler()
{
}
const std::string& MSXMLErrHandler::toString()
{
if(!message.empty())
{
return message;
}
if (S_OK == hres_)
{
return message; // I assume it is empty here always
}
IXMLDOMDocument3Ptr document = object_->GetownerDocument();
if(!document)
{
document = IXMLDOMDocument3Ptr(object_);
}
IXMLDOMParseErrorPtr error = document->GetparseError();
_bstr_t reason = error->Getreason();
if(!reason)
{
message = func_name_ + " failed! Unknown error! HRESULT = " + STR::int2hex_str(hres_);
}
else
{
message = func_name_ + " failed! Error code: 0x" + STR::int2hex_str(error->GeterrorCode()) +
" Line: " + STR::int2str(error->Getline()) + " Message: " + static_cast<char*>(error->Getreason());
}
return message;
}
void MSXMLErrHandler::logErrorAndThrow()
{
toString();
if (S_FALSE == hres_)
{
Log::warning(message);
}
if(FAILED(hres_))
{
Log::error(message);
_com_issue_errorex(hres_, object_, iid_);
}
}
} // namespace MSXML2
\ No newline at end of file
#pragma once
namespace MSXML2
{;
class MSXMLErrHandler
{
public:
MSXMLErrHandler(const HRESULT hres, IXMLDOMNode* object, REFIID iid, const std::string& func_name);
~MSXMLErrHandler();
const std::string& toString();
void logErrorAndThrow();
private:
HRESULT hres_;
IXMLDOMNodePtr object_;
IID iid_;
std::string func_name_;
std::string message;
};
} // namespace MSXML2
#include "stdafx.h"
#include "ChildNodeNotFound.h"
namespace EXCEPT
{;
namespace LE
{;
ChildNodeNotFound::ChildNodeNotFound(const std::string& tag_name, const std::string& parent_tag_name)
: WrongIntermediateXMLFormat("Child tag <" + tag_name + "> not found in <" + parent_tag_name + "> tag of the intermediate XML file.", "no matter")
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "WrongIntermediateXMLFormat.h"
namespace EXCEPT
{;
namespace LE
{;
class ChildNodeNotFound : public WrongIntermediateXMLFormat
{
public:
explicit ChildNodeNotFound(const std::string& tag_name, const std::string& parent_tag_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "MSXMLError.h"
namespace EXCEPT
{;
namespace RT
{;
MSXMLError::MSXMLError(const std::string& message)
: RuntimeException(message)
{
}
} // namespace RT
} // namespace EXCEPT
#pragma once
#include "exceptions.h"
namespace EXCEPT
{;
namespace RT
{;
class MSXMLError : public RuntimeException
{
public:
explicit MSXMLError(const std::string& message);
};
} // namespace RT
} // namespace EXCEPT
#include "stdafx.h"
#include "NotImplemented.h"
namespace EXCEPT
{;
namespace LE
{;
NotImplemented::NotImplemented(const std::string& function_name)
: UnexpectedProgramPath("The functionality is not implemented.", function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "UnexpectedProgramPath.h"
namespace EXCEPT
{;
namespace LE
{;
class NotImplemented: public UnexpectedProgramPath
{
public:
explicit NotImplemented(const std::string& function_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "StructureParameterNotSet.h"
namespace EXCEPT
{;
namespace LE
{;
StructureParameterNotSet::StructureParameterNotSet(const std::string& struct_name, const std::string& param_name, const std::string& function_name)
: WrongAPIUsage("Structure " + struct_name + " was used without mandatory parameter \"" +
param_name + "\" setting.", function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "WrongAPIUsage.h"
namespace EXCEPT
{;
namespace LE
{;
class StructureParameterNotSet : public WrongAPIUsage
{
public:
explicit StructureParameterNotSet(const std::string& struct_name, const std::string& param_name, const std::string& function_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "StructureSizeNotSet.h"
namespace EXCEPT
{;
namespace LE
{;
StructureSizeNotSet::StructureSizeNotSet(const std::string& struct_name, const std::string& function_name)
: StructureParameterNotSet(struct_name, "size", function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "StructureParameterNotSet.h"
namespace EXCEPT
{;
namespace LE
{;
class StructureSizeNotSet : public StructureParameterNotSet
{
public:
explicit StructureSizeNotSet(const std::string& struct_name, const std::string& function_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "UnexpectedProgramPath.h"
namespace EXCEPT
{;
namespace LE
{;
UnexpectedProgramPath::UnexpectedProgramPath(const std::string& message, const std::string& function_name)
: WrongAPIUsage(message, function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "WrongAPIUsage.h"
namespace EXCEPT
{;
namespace LE
{;
class UnexpectedProgramPath : public WrongAPIUsage
{
public:
explicit UnexpectedProgramPath(const std::string& message, const std::string& function_name);
};
typedef UnexpectedProgramPath WhatIsTheFuck;
typedef UnexpectedProgramPath HowCouldItHappen;
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "WrongAPIUsage.h"
namespace EXCEPT
{;
namespace LE
{;
WrongAPIUsage::WrongAPIUsage(const std::string& message, const std::string& function_name)
: LogicalException(message + " Function: " + function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "exceptions.h"
namespace EXCEPT
{;
namespace LE
{;
class WrongAPIUsage : public LogicalException
{
public:
explicit WrongAPIUsage(const std::string& message, const std::string& function_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "WrongIntermediateXMLFormat.h"
namespace EXCEPT
{;
namespace LE
{;
WrongIntermediateXMLFormat::WrongIntermediateXMLFormat(const std::string& message, const std::string& function_name)
: LogicalException(message + " Function: " + function_name)
{
}
} // namespace LE
} // namespace EXCEPT
#pragma once
#include "exceptions.h"
namespace EXCEPT
{;
namespace LE
{;
class WrongIntermediateXMLFormat : public LogicalException
{
public:
explicit WrongIntermediateXMLFormat(const std::string& message, const std::string& function_name);
};
} // namespace LE
} // namespace EXCEPT
#include "stdafx.h"
#include "exceptions.h"
namespace EXCEPT
{;
LogicalException::LogicalException(const std::string& message)
: logic_error(message)
{
Log::error("Logical exception!!! " + message);
}
RuntimeException::RuntimeException(const std::string& message)
: runtime_error(message)
{
Log::error("Run-time exception!!! " + message);
}
} // namespace EXCEPT
\ No newline at end of file
#pragma once
#include <stdexcept>
namespace EXCEPT
{;
class LogicalException : public std::logic_error
{
protected:
explicit LogicalException(const std::string& message);
};
class RuntimeException : public std::runtime_error
{
protected:
explicit RuntimeException(const std::string& message);
};
} // namespace EXCEPT
#include "stdafx.h"
#include "Producer.h"
#include <Serializer/HTMLSerializer.h>
#include <Serializer/XLSXSerializer.h>
#include <Serializer/XMLSerializer.h>
#include <Converter/HTMLConverter.h>
#include <Converter/XLSXConverter.h>
Producer::~Producer()
{
}
Serializer& Producer::getSerializer(const EWS_FORMAT format)
{
switch(format)
{
case ef_HTML:
{
static HTML::HTMLSerializer prod;
return prod;
}
case ef_XML:
{
static XLS::XMLSerializer prod;
return prod;
}
case ef_XLSX:
default:
{
static XLSX::XLSXSerializer prod;
return prod;
}
}
}
Converter& Producer::getConverter(const EWS_FORMAT format)
{
switch(format)
{
case ef_HTML:
{
static HTML::HTMLConverter prod;
return prod;
}
case ef_XLSX:
default:
{
static XLSX::XLSXConverter prod;
return prod;
}
}
}
#pragma once
#include <Document/EWSDocument.h> // EWS_FORMAT
class Serializer;
class Converter;
class Producer
{
~Producer();
public:
static Serializer& getSerializer(const EWS_FORMAT format);
static Converter& getConverter(const EWS_FORMAT format);
};
#include "stdafx.h"
#include "Log.h"
namespace Log
{
void info(const std::string& message)
{
#ifdef _DEBUG
Logger::getLogger().writeLine("Info", message);
#endif
}
void event(const std::string& message)
{
#ifdef _DEBUG
Logger::getLogger().writeLine("Event", message);
#endif
}
void message(const std::string& message)
{
#ifdef _DEBUG
Logger::getLogger().writeLine("Message", message);
#endif
}
void warning(const std::string& message)
{
#ifdef _DEBUG
Logger::getLogger().writeLine("WARNING", message);
#endif
}
void error(const std::string& message)
{
#ifdef _DEBUG
Logger::getLogger().writeLine("!!ERROR", message);
#endif
}
}; // namespace Log
#pragma once
#include "Logger.h"
namespace Log
{
void info(const std::string& message);
void event(const std::string& message);
void message(const std::string& message);
void warning(const std::string& message);
void error(const std::string& message);
}; // namespace Log
#include "stdafx.h"
#include "Logger.h"
Logger::Logger(const std::string& log_file)
: m_log(log_file.c_str())
{
}
Logger::~Logger()
{
}
void Logger::writeLine(const std::string& type, const std::string& str)
{
time_t now;
tm local;
time(&now);
localtime_s(&local, &now);
static char time_stamp[16];
sprintf_s(time_stamp, 15, "%02d:%02d:%02d ", local.tm_hour, local.tm_min, local.tm_sec);
m_log << time_stamp << type << ": " << str << std::endl;
std::cout << time_stamp << type << ": " << str << std::endl;
}
Logger& Logger::getLogger()
{
static Logger logger("AVSOfficeXlsFile.log");
return logger;
}
#pragma once
class Logger
{
private:
Logger(const std::string& log_file);
~Logger();
public:
static Logger& getLogger();
void writeLine(const std::string& type, const std::string& str);
private:
std::ofstream m_log;
};
#include "stdafx.h"
#include "HTMLSerializer.h"
#include <fstream>
#include <iostream> // endl
#include <direct.h>
#include "boost/filesystem.hpp"
namespace HTML
{;
const bool loadDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath& path);
const bool storeDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath& path_for_dir);
const bool HTMLSerializer::read(Document& doc, const _bstr_t& from)
{
if(!boost::filesystem::exists(static_cast<wchar_t*>(from)) || !boost::filesystem::is_directory(static_cast<wchar_t*>(from)))
{
return false;
}
doc.newXMLDoc(L"root");
MSXML2::IXMLDOMElementPtr cur_dir = doc.getRoot();
bool res = loadDir(doc, cur_dir, static_cast<wchar_t*>(from));
if(res)
{
Log::event("\"" + std::string(static_cast<char*>(from)) + "\" loaded successfully");
return true;
}
return false;
}
const bool loadDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath& path)
{
for(boost::filesystem::wdirectory_iterator it(path), itEnd; it != itEnd; ++it)
{
if(boost::filesystem::is_directory(it->status()))
{
MSXML2::IXMLDOMElementPtr dir_tag = cur_dir->GetownerDocument()->createElement(L"dir");
dir_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(dir_tag);
if(!loadDir(doc, dir_tag, path / it->filename()))
{
return false;
}
continue;
}
if(boost::filesystem::is_regular_file(it->status()))
{
if(L".xml" == it->path().extension() || L".rels" == it->path().extension())
{
MSXML2::IXMLDOMElementPtr file_tag = cur_dir->GetownerDocument()->createElement(L"file");
file_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(file_tag);
MSXML2::IXMLDOMDocument3Ptr file_xml(_T("Msxml2.DOMDocument.6.0"));
VARIANT_BOOL res = file_xml->load(static_cast<std::wstring>(it->string()).c_str());
if(VARIANT_TRUE != res)
{
Log::warning("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file is not a valid XML file.");
continue;
}
MSXML2::IXMLDOMNodePtr ins_elem = file_xml->removeChild(file_xml->GetdocumentElement());
file_tag->appendChild(ins_elem);
// Log::info("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file has been read.");
}
if(L".bin" == it->path().extension())
{
MSXML2::IXMLDOMElementPtr file_tag = cur_dir->GetownerDocument()->createElement(L"file");
file_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(file_tag);
size_t file_size = static_cast<size_t>(boost::filesystem::file_size(it->path()));
boost::shared_array<char> buffer(new char[file_size]);
std::ifstream bin_file(static_cast<char*>(_bstr_t(it->string().c_str())));
bin_file.read(buffer.get(), file_size);
file_tag->setAttribute(L"format", L"bin");
size_t bin_data_id = doc.appendBinaryData(file_tag, buffer, file_size);
MSXML2::IXMLDOMElementPtr bin_data_id_tag = cur_dir->GetownerDocument()->createElement(L"bin_data_id");
bin_data_id_tag->setAttribute(L"id", STR::int2str(bin_data_id).c_str());
file_tag->appendChild(bin_data_id_tag);
// Log::info("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file has been read.");
}
}
}
return true;
}
const bool HTMLSerializer::write(const Document& doc, const _bstr_t& file_path)
{
MSXML2::IXMLDOMElementPtr cur_dir = doc.getRoot();
return storeDir(doc, cur_dir, boost::filesystem::wpath(static_cast<wchar_t*>(file_path)).remove_filename());
}
const bool storeDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath& path_for_dir)
{
if(!cur_dir)
{
return false;
}
const _bstr_t node_type = cur_dir->GetnodeName();
_variant_t name_attrib = cur_dir->getAttribute(L"name");
const _bstr_t node_name = _bstr_t(VT_NULL != name_attrib.vt ? name_attrib : L"");
const boost::filesystem::wpath current_elem_path = path_for_dir / static_cast<wchar_t*>(node_name);
if(_bstr_t(L"dir") == node_type || _bstr_t(L"root") == node_type)
{
if(node_name.length())
{
_wmkdir(current_elem_path.string().c_str());
}
MSXML2::IXMLDOMNodeListPtr children = cur_dir->GetchildNodes();
MSXML2::IXMLDOMNodePtr item;
while((item = children->nextNode()))
{
storeDir(doc, item, current_elem_path);
}
}
if(_bstr_t(L"file") == node_type)
{
const _variant_t file_format = cur_dir->getAttribute(L"format");
if(VT_NULL == file_format.vt || _bstr_t(file_format) == _bstr_t(L"xml"))
{
MSXML2::IXMLDOMDocument3Ptr xml_doc(_T("Msxml2.DOMDocument.6.0"));
//xml_doc->PutpreserveWhiteSpace(VARIANT_TRUE); // Stores xml exactly as it was composed.
xml_doc->loadXML(L"<?xml version=\"1.0\" standalone=\"yes\" ?> <root/>");
xml_doc->PutRefdocumentElement(MSXML2::IXMLDOMElementPtr(cur_dir->removeChild(cur_dir->GetfirstChild())));
xml_doc->save(current_elem_path.string().c_str());
// std::wofstream text_file(current_elem_path.string().c_str());
// MSXML2::IXMLDOMNodePtr root_node = cur_dir->GetownerDocument();
// if(root_node)
// {
// _bstr_t text = root_node->Getxml();
// text_file.write(static_cast<wchar_t*>(text), text.length());
// }
// text_file.close();
//
//
}
else if(_bstr_t(file_format) == _bstr_t(L"bin"))
{
const _bstr_t bin_data_id_str = _bstr_t(cur_dir->getAttribute(L"bin_data_id"));
if(!!bin_data_id_str)
{
int bin_data_id = atoi(static_cast<char*>(bin_data_id_str));
std::ofstream bin_file(current_elem_path.string().c_str());
const std::pair<char*, size_t> bin_data = doc.getBinaryData(bin_data_id);
bin_file.write(bin_data.first, bin_data.second);
}
}
else if(_bstr_t(file_format) == _bstr_t(L"text"))
{
std::wofstream text_file(current_elem_path.string().c_str());
MSXML2::IXMLDOMNodePtr root_node = cur_dir->GetfirstChild();
if(root_node)
{
_bstr_t text = root_node->Gettext();
text_file.write(static_cast<wchar_t*>(text), text.length());
}
text_file.close();
}
}
return true;
}
} // namespace XLSX
#pragma once
#include "Serializer.h"
namespace HTML
{;
class HTMLSerializer : public Serializer
{
public:
virtual const bool read(Document& doc, const _bstr_t& from);
virtual const bool write(const Document& doc, const _bstr_t& file_path);
};
} // namespace XLSX
#include "stdafx.h"
#include "Serializer.h"
/*
namespace XLS
{;
} // namespace XLS
*/
#pragma once
#include <Document/Document.h>
//namespace XLS
//{;
class Document;
class Serializer
{
public:
virtual const bool read(Document& doc, const _bstr_t& from) = 0;
virtual const bool write(const Document& doc, const _bstr_t& to) = 0;
};
//} // namespace XLS
#include "stdafx.h"
#include "XLSXSerializer.h"
#include <fstream>
#include <iostream> // endl
#include <direct.h>
#include "boost/filesystem.hpp"
namespace XLSX
{;
const bool loadDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath path);
const bool storeDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const _bstr_t& path_for_dir);
const bool XLSXSerializer::read(Document& doc, const _bstr_t& from)
{
if(!boost::filesystem::exists(static_cast<wchar_t*>(from)) || !boost::filesystem::is_directory(static_cast<wchar_t*>(from)))
{
return false;
}
doc.newXMLDoc(L"root");
MSXML2::IXMLDOMElementPtr cur_dir = doc.getRoot();
bool res = loadDir(doc, cur_dir, static_cast<wchar_t*>(from));
if(res)
{
Log::event("\"" + std::string(static_cast<char*>(from)) + "\" loaded successfully");
return true;
}
return false;
}
const bool loadDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const boost::filesystem::wpath path)
{
for(boost::filesystem::wdirectory_iterator it(path), itEnd; it != itEnd; ++it)
{
if(boost::filesystem::is_directory(it->status()))
{
MSXML2::IXMLDOMElementPtr dir_tag = cur_dir->GetownerDocument()->createElement(L"dir");
dir_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(dir_tag);
if(!loadDir(doc, dir_tag, path / it->filename()))
{
return false;
}
continue;
}
if(boost::filesystem::is_regular_file(it->status()))
{
if(L".xml" == it->path().extension() || L".rels" == it->path().extension())
{
MSXML2::IXMLDOMElementPtr file_tag = cur_dir->GetownerDocument()->createElement(L"file");
file_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(file_tag);
MSXML2::IXMLDOMDocument3Ptr file_xml(_T("Msxml2.DOMDocument.6.0"));
VARIANT_BOOL res = file_xml->load(static_cast<std::wstring>(it->string()).c_str());
if(VARIANT_TRUE != res)
{
Log::warning("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file is not a valid XML file.");
continue;
}
MSXML2::IXMLDOMNodePtr ins_elem = file_xml->removeChild(file_xml->GetdocumentElement());
file_tag->appendChild(ins_elem);
// Log::info("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file has been read.");
}
if(L".bin" == it->path().extension())
{
MSXML2::IXMLDOMElementPtr file_tag = cur_dir->GetownerDocument()->createElement(L"file");
file_tag->setAttribute(L"name", it->filename().c_str());
cur_dir->appendChild(file_tag);
size_t file_size = static_cast<size_t>(boost::filesystem::file_size(it->path()));
boost::shared_array<char> buffer(new char[file_size]);
std::ifstream bin_file(static_cast<char*>(_bstr_t(it->string().c_str())));
bin_file.read(buffer.get(), file_size);
file_tag->setAttribute(L"format", L"bin");
size_t bin_data_id = doc.appendBinaryData(file_tag, buffer, file_size);
MSXML2::IXMLDOMElementPtr bin_data_id_tag = cur_dir->GetownerDocument()->createElement(L"bin_data_id");
bin_data_id_tag->setAttribute(L"id", STR::int2str(bin_data_id).c_str());
file_tag->appendChild(bin_data_id_tag);
// Log::info("\"" + std::string(static_cast<char*>(_bstr_t(it->string().c_str()))) + "\" file has been read.");
}
}
}
return true;
}
const bool XLSXSerializer::write(const Document& doc, const _bstr_t& folder_path)
{
////////////////////////////
//
// http://www.rsdn.ru/forum/Message.aspx?mid=70479
//
// solved with <xsl:output method="xml" encoding="utf-16" indent="yes"/>
/*
Log::info("Saving to \"" + static_cast<char*>(to) + "\"");
_bstr_t xml = doc.getDoc()->Getxml();
CString strXml((char*)xml);
strXml.Replace(_T("><"), _T(">\n<"));
xml = strXml;
HRESULT res;
res = doc.getDoc()->loadXML(xml);
*/
/////////////////
std::wstring folder_path_w = static_cast<wchar_t*>(folder_path);
size_t pos1 = folder_path_w.find_last_of(L"\\/");
pos1 = std::string::npos == pos1 ? 0 : pos1;
std::wstring folder_name = folder_path_w.substr(pos1 + 1, folder_path_w.size() - pos1 - 1);
std::wstring folder_parent_path = folder_path_w.substr(0, pos1);
MSXML2::IXMLDOMElementPtr cur_dir = doc.getRoot();
cur_dir->setAttribute("name", folder_name.c_str());
if(storeDir(doc, cur_dir, folder_parent_path.c_str()))
{
//SetCurrentDirectoryA((dir_for_root + "/" + root_name).c_str());
//system(("7z a -r -tzip ../" + root_name + ".xlsx ./*.*").c_str());
return true;
}
return false;
}
const bool storeDir(const Document& doc, MSXML2::IXMLDOMElementPtr cur_dir, const _bstr_t& path_for_dir)
{
if(!cur_dir)
{
return false;
}
const _bstr_t node_type = cur_dir->GetnodeName();
const _bstr_t node_name = _bstr_t(cur_dir->getAttribute(L"name"));
if(_bstr_t(L"xlsx:dir") == node_type || _bstr_t(L"xlsx:root") == node_type)
{
const _bstr_t dir_name = path_for_dir + "/" + node_name;
_mkdir(static_cast<char*>(dir_name));
MSXML2::IXMLDOMNodeListPtr children = cur_dir->GetchildNodes();
MSXML2::IXMLDOMNodePtr item;
while((item = children->nextNode()))
{
storeDir(doc, item, dir_name);
}
}
if(_bstr_t(L"xlsx:file") == node_type)
{
const _variant_t file_format = cur_dir->getAttribute(L"format");
if(VT_NULL != file_format.vt && _bstr_t(file_format) == _bstr_t(L"bin"))
{
const _bstr_t bin_data_id_str = _bstr_t(cur_dir->getAttribute(L"bin_data_id"));
if(!!bin_data_id_str)
{
int bin_data_id = atoi(static_cast<char*>(bin_data_id_str));
std::ofstream bin_file(static_cast<char*>(path_for_dir + "/" + node_name));
const std::pair<char*, size_t> bin_data = doc.getBinaryData(bin_data_id);
bin_file.write(bin_data.first, bin_data.second);
}
}
else
{
MSXML2::IXMLDOMDocument3Ptr xml_doc(_T("Msxml2.DOMDocument.6.0"));
xml_doc->loadXML(L"<?xml version=\"1.0\" standalone=\"yes\" ?> <root/>");
xml_doc->PutRefdocumentElement(MSXML2::IXMLDOMElementPtr(cur_dir->removeChild(cur_dir->GetfirstChild())));
xml_doc->save(path_for_dir + "/" + node_name);
}
}
return true;
}
} // namespace XLSX
#pragma once
#include "Serializer.h"
namespace XLSX
{;
class XLSXSerializer : public Serializer
{
public:
virtual const bool read(Document& doc, const _bstr_t& from);
virtual const bool write(const Document& doc, const _bstr_t& folder_path);
};
} // namespace XLSX
#include "stdafx.h"
#include "XMLSerializer.h"
namespace XLS
{;
const bool XMLSerializer::read(Document& doc, const _bstr_t& from)
{
return S_OK == doc.getDoc()->load(from);
}
const bool XMLSerializer::write(const Document& doc, const _bstr_t& to)
{
// Log::info("XMLSerializer::write started \\n transformation.");
_bstr_t xml = doc.getDoc()->Getxml();
std::wstring wstr(static_cast<wchar_t*>(xml));
boost::algorithm::replace_all(wstr, L"><", L">\n<");
MSXML2::IXMLDOMDocument3Ptr full_indented_doc(_T("Msxml2.DOMDocument.6.0"));
full_indented_doc->loadXML(wstr.c_str());
// Log::info("XMLSerializer::write finished \\n transformation.");
return S_OK == full_indented_doc->save(to);
}
} // namespace XLS
#pragma once
#include "Serializer.h"
namespace XLS
{;
class XMLSerializer : public Serializer
{
public:
virtual const bool read(Document& doc, const _bstr_t& from);
virtual const bool write(const Document& doc, const _bstr_t& to);
};
} // namespace XLS
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:r="http://schemas.openxmlformats.org/package/2006/relationships"
xmlns:mainr="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:main="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
extension-element-prefixes="msxsl">
<xsl:template name="index_file">
<file name="{$workbook_filename}">
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}"/>
<xsl:for-each select="$worksheets_info/sheet">
<link id="shLink">
<xsl:attribute name="href">
<xsl:value-of select="@file_path"/>
</xsl:attribute>
</link>
</xsl:for-each>
<link id="shLink"/>
</head>
<frameset rows="*,39" border="0" width="0" frameborder="no" framespacing="0">
<frame>
<xsl:attribute name="src">
<xsl:value-of select="$workbook_name"/>
<xsl:text>_files/sheet001.htm</xsl:text>
</xsl:attribute>
<xsl:attribute name="name">frSheet</xsl:attribute>
</frame>
<frame>
<xsl:attribute name="src">
<xsl:value-of select="$workbook_name"/>
<xsl:text>_files/tabs.htm</xsl:text>
</xsl:attribute>
<xsl:attribute name="name">frSheet_tabs</xsl:attribute>
<xsl:attribute name="marginwidth">0</xsl:attribute>
<xsl:attribute name="marginheight">0</xsl:attribute>
</frame>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
</file>
</xsl:template>
<xsl:template name="single_index_file">
<file name="{$workbook_filename}">
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}"/>
<style>
<xsl:comment>
<xsl:call-template name="css_content"/>
<xsl:text>
.noPrint {
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#F0F0F0 none repeat scroll 0 0;
border:4px solid #CCCCCC;
}
.header {
height:45px;
padding:0 8px;
vertical-align:center;
}
body {
margin:0;
padding:0;
}
.button {
vertical-align:middle;
}
h3 {
font-family:Arial,Helvetica,sans-serif;
font-size:12pt;
margin-top:10px;
}
@media print {
.noPrint {display:none;visibility:hidden;}
}
</xsl:text>
</xsl:comment>
</style>
<xsl:choose>
<xsl:when test="$print_file = 'true'">
<title>
<xsl:value-of select="$workbook_name"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="$worksheets_info/sheet[position() = $print_index]/@name"/>
</title>
<script type="text/javascript">window.print();</script>
</xsl:when>
</xsl:choose>
</head>
<body link="blue" vlink="purple" onload="OnLoad();">
<xsl:choose>
<xsl:when test="$print_file = 'true'">
<div style="width:100%;top:-60px;">
<table width="100%" cellspacing="0" cellpadding="0" class="noPrint">
<tr>
<td class="header">
<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<h3>
<xsl:value-of select="$workbook_name"/>
</h3>
</td>
<td align="right" class="button">
<input type="button" name="Print" value="Печать" onClick="print();"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div style="position: absolute; top: 60px; margin-left: 5px;">
<xsl:for-each select="$worksheets_files/main:worksheet[position() = $print_index]">
<xsl:variable name="ws_pos" select="$print_index"/>
<xsl:call-template name="sheet_body_content"/>
</xsl:for-each>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$worksheets_files/main:worksheet">
<xsl:variable name="ws_pos" select="position()"/>
<div>
<h2>
<xsl:text>Sheet: </xsl:text>
<xsl:value-of select="$worksheets_info/sheet[position() = $ws_pos]/@name"/>
</h2>
</div>
<div>
<xsl:call-template name="sheet_body_content"/>
</div>
<div>
<hr/>
</div>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</file>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:r="http://schemas.openxmlformats.org/package/2006/relationships"
xmlns:mainr="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:main="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
extension-element-prefixes="msxsl">
<xsl:template name="tabs_file">
<file name="tabs.htm">
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={$charset}"/>
<style>
<xsl:comment>
A {
text-decoration:none;
color:#000000;
font-size:9pt;
}
</xsl:comment>
</style>
</head>
<body topmargin="0" leftmargin="0" bgcolor="#808080">
<table border="0" cellspacing="1">
<tr>
<xsl:for-each select="$worksheets_info/sheet">
<td bgcolor="#FFFFFF" nowrap="" style="padding:0 1ex 0 1ex"><b><small><small>
<a href="{@file_name}" target="frSheet"><font face="Arial" color="#000000"><xsl:value-of select="@name"/></font></a></small></small></b></td>
</xsl:for-each>
</tr>
</table>
</body>
</html>
</file>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
//
// HtmlConverter.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by HtmlConverter.rc
//
#define IDR_XSL12 2016
#define IDR_XSL13 2017
#define IDR_XSL14 2018
#define IDR_XSL15 2019
#define IDR_XSL16 2020
#define IDR_XSL17 2021
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 2022
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2000
#define _APS_NEXT_SYMED_VALUE 2000
#endif
#endif
// stdafx.cpp : source file that includes just the standard includes
// EWSCore.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
This diff is collapsed.
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