VGLD#84825 SLNKXLSX 1.02 betere datums voor 1970
svn path=/Slnkxlsx/trunk/; revision=66421
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "stdafx.h"
|
||||
#include "SLNKWorksheet.h"
|
||||
#include "SLNKWorkbook.h"
|
||||
|
||||
#include<ATLComTime.h>
|
||||
|
||||
// CWorksheet
|
||||
|
||||
STDMETHODIMP CWorksheet::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
@@ -122,29 +125,39 @@ STDMETHODIMP CWorksheet::write_unixtime(ULONG row, USHORT col, LONG64 unixtime,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
unsigned int unix_stamp_of_DATE(DATE date)
|
||||
{
|
||||
//convert DATE to SYSTEMTIME
|
||||
SYSTEMTIME st;
|
||||
VariantTimeToSystemTime(date, &st);
|
||||
|
||||
//convert SYSTEMTIME to FILETIME
|
||||
FILETIME ft;
|
||||
SystemTimeToFileTime(&st, &ft);
|
||||
|
||||
//convert FILETIME to ULARGE_INTEGER
|
||||
//then QuadPart is 64bit timestamp
|
||||
ULARGE_INTEGER ul{ ft.dwLowDateTime, ft.dwHighDateTime };
|
||||
return (unsigned int)((ul.QuadPart - 116444736000000000ULL) / 10000000);
|
||||
}
|
||||
|
||||
// In JavaScript gebruik je new Date().getVarDate();
|
||||
STDMETHODIMP CWorksheet::write_vardate(ULONG row, USHORT col, DATE date, ULONG format)
|
||||
{
|
||||
if (!m_worksheet)
|
||||
return invalid();
|
||||
|
||||
write_unixtime(row, col, unix_stamp_of_DATE(date), format);
|
||||
COleDateTime odt(date);
|
||||
lxw_datetime ldt = { odt.GetYear(), odt.GetMonth(), odt.GetDay() , odt.GetHour(), odt.GetMinute(), (double) odt.GetSecond()};
|
||||
|
||||
lxw_format* fmt = NULL;
|
||||
switch (format)
|
||||
{
|
||||
case 0:
|
||||
fmt = my_workbook->m_format_date;
|
||||
ldt.hour = 0;
|
||||
ldt.min = 0;
|
||||
ldt.sec = 0.0;
|
||||
worksheet_set_column(m_worksheet, col, col, 10.0, NULL);
|
||||
break;
|
||||
case 1:
|
||||
fmt = my_workbook->m_format_datetime;
|
||||
worksheet_set_column(m_worksheet, col, col, 15.0, NULL);
|
||||
break;
|
||||
case 2:
|
||||
ldt.year = 0;
|
||||
ldt.month = 0;
|
||||
ldt.day = 0;
|
||||
fmt = my_workbook->m_format_time;
|
||||
worksheet_set_column(m_worksheet, col, col, 5.0, NULL);
|
||||
break;
|
||||
}
|
||||
::worksheet_write_datetime(m_worksheet, row, col, &ldt, fmt);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,20 +12,20 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A3B53DEB-39D4-4C35-A066-A48073FE92D9}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<Keyword>AtlProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Zorg dat versies alfabetisch altijd op elkaar volgen!
|
||||
#define SLNK_MAJOR_VERSION 1
|
||||
#define SLNK_MINOR_VERSION 01
|
||||
#define SLNK_MINOR_VERSION 02
|
||||
#define SLNK_BUILD_VERSION 0
|
||||
|
||||
// Define resource strings
|
||||
|
||||
Reference in New Issue
Block a user