Compare commits

..

18 Commits

Author SHA1 Message Date
e8c314e535 . 2019-03-21 13:54:38 +03:00
12c8cf112a . 2019-03-21 13:51:57 +03:00
c9fb5cbe4d x2t - ... 2019-03-21 13:09:52 +03:00
4e337b5ef1 XlsFormat - fix user file 2019-03-20 18:49:38 +03:00
7e0e30d00f [x2t] Fix xlsx->Editor.bin conversion with invalid cell refs
<x:c r="2:1" instead of "B1"
2019-03-20 14:00:05 +03:00
72c4727a1e XlsFormat - fix bug #40895 2019-03-20 12:54:00 +03:00
29c197f383 XlsFormat - fix bug #40879 2019-03-19 19:49:40 +03:00
c07bd58bda XlsFormat -... 2019-03-18 19:58:20 +03:00
ae9a7f7fad [zlib] Fix 7-zip Warning: Headers error
Problem in header field: "last mod file date".
tm_sec = tm_min = tm_hour = tm_mday = tm_mon = tm_year = 0; is considered as 0 Jan 1980 (0x00200000 in file)
default value of tm_mon should be -1 (zip64local_TmzDateToDosDate tm_mon+1)
2019-03-15 19:26:57 +03:00
1157d6f97f . 2019-03-15 17:27:25 +03:00
5483547ee7 . 2019-03-15 15:47:26 +03:00
b3d219ef58 . 2019-03-15 14:50:29 +03:00
46a6e35a35 . 2019-03-15 14:48:53 +03:00
ae45b240a3 XlsFormat - ... 2019-03-14 19:44:37 +03:00
4a3b56d0d5 OdfFormatReader - .. 2019-03-14 12:03:22 +03:00
8e8fd1096f . 2019-03-13 19:07:50 +03:00
9eb82fa85e DocFormatReader - fix bug #40841 2019-03-13 14:06:10 +03:00
9e0ff699aa . 2019-03-12 15:48:57 +03:00
67 changed files with 698 additions and 469 deletions

1
.gitignore vendored
View File

@ -64,3 +64,4 @@ X2tConverter/Common/DocxFormat/DocxFormatLib/Makefile
*.tar.gz
**/*.build/
*.log

View File

@ -85,7 +85,11 @@ namespace DocFileFormat
for (size_t index = 0; index < count; ++index)
{
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
AnnotationReferenceExDescriptor* atrdPost10 = m_document->AnnotationsReferenceExPlex ? static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]) : NULL;
AnnotationReferenceExDescriptor* atrdPost10 = NULL;
if ((m_document->AnnotationsReferenceExPlex) && (index < m_document->AnnotationsReferenceExPlex->Elements.size()))
{
atrdPost10 = static_cast<AnnotationReferenceExDescriptor*>(m_document->AnnotationsReferenceExPlex->Elements[index]);
}
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
if (atrdPre10->m_BookmarkId < 0)
@ -96,23 +100,16 @@ namespace DocFileFormat
{
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString( index + 1 ));
}
if (atrdPost10)
{
//!!!TODO!!!
/*//ATRDpost10 is optional and not saved in all files
if (doc.AnnotationReferenceExtraTable != null &&
doc.AnnotationReferenceExtraTable.Count > index)
{
AnnotationReferenceDescriptorExtra atrdPost10 = doc.AnnotationReferenceExtraTable[index];
atrdPost10.Date.Convert(new DateMapping(_writer));
}*/
}
//if (atrdPost10)
//{
// atrdPost10->Date.Convert(new DateMapping(_writer));
//}
if (atrdPre10->m_AuthorIndex < m_document->AnnotationOwners->size()) //conv_253l2H1CehgKwsxCtNk__docx.doc
{
m_pXmlWriter->WriteAttribute( L"w:author",
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->m_AuthorIndex ) ));
}
m_pXmlWriter->WriteAttribute( L"w:initials", atrdPre10->m_UserInitials);
m_pXmlWriter->WriteAttribute( L"w:initials", FormatUtils::XmlEncode(atrdPre10->m_UserInitials));

View File

@ -1431,8 +1431,7 @@ namespace DocFileFormat
{
//append size and position ...
//if (pSpa->fAnchorLock )
if (pSpa->bx == TEXT && pSpa->by == TEXT)
if (m_isInlineShape)
{
// appendStyleProperty( style, L"position", L"static" );
}
@ -1689,21 +1688,17 @@ namespace DocFileFormat
m_pSpa->bx = PAGE;
}
else
{
nRelH = m_pSpa->bx;
appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(m_pSpa->bx));
{//rel column
}
}
if (nRelV < 0 && m_pSpa)
{
if (m_pSpa->by == TEXT && bZIndex)
if (m_pSpa->by == TEXT && bZIndex)
{
m_pSpa->by = PAGE;
}
else
{
nRelV = m_pSpa->by;
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
{//rel paragraph
}
}
if (!m_isInlineShape && !bZIndex)
@ -1814,7 +1809,7 @@ namespace DocFileFormat
//append size and position ...
//if (m_pSpa->fAnchorLock)//это возможность смены привязки , а не ее тип
if (m_pSpa->bx == TEXT && m_pSpa->by == TEXT)
if (m_isInlineShape)/*m_pSpa->bx == TEXT && m_pSpa->by == TEXT*/
{
// appendStyleProperty( style, L"position", L"static" );
}

View File

@ -173,12 +173,16 @@ namespace DocFileFormat
//Lock ???
ODRAW::ProtectionBooleanProperties *prot = dynamic_cast<ODRAW::ProtectionBooleanProperties*>(pShape->Lock.get());
if ((prot) && (prot->fUsefLockAspectRatio && prot->fLockAspectRatio))
if ((prot) && (prot->fUsefLockAspectRatio))
{
appendValueAttribute( _lock, L"aspectratio", L"t" );
appendValueAttribute( _lock, L"aspectratio", prot->fLockAspectRatio ? L"t" : L"f" );
}
else
{
appendValueAttribute( _lock, L"aspectratio", L"t");
}
if ( _lock->GetAttributeCount() > 1 )
if ( _lock->GetAttributeCount() > 0 )
{
m_pXmlWriter->WriteString( _lock->GetXMLString() );
}

View File

@ -210,25 +210,41 @@ namespace formulasconvert {
bool odf2oox_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last)
{
std::wstring workstr = expr;
workstr = boost::regex_replace(
workstr,
boost::wregex(L"('.*?')|(\".*?\")"),
&convert_scobci, boost::match_default | boost::format_all);
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
boost::algorithm::split(splitted, workstr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
bool res = false;
if (splitted.size() == 2)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[1];
res = true;
}
if (splitted.size() == 3)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[2];
return true;
res = true;
}
if (splitted.size() == 4)
{
table = splitted[0];
ref_first = splitted[1];
ref_last = splitted[3];
return true;
res = true;
}
return false;
replace_tmp_back( table );
return res;
}
bool odf2oox_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)

View File

@ -150,12 +150,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
odf_reader::GetProperty(content_.properties_,L"maximum", doubleVal);
if (doubleVal)
{
CP_XML_ATTR(L"c:max", *doubleVal);
CP_XML_NODE(L"c:max")
{
CP_XML_ATTR(L"val", *doubleVal);
}
}
odf_reader::GetProperty(content_.properties_,L"minimum", doubleVal);
if (doubleVal)
{
CP_XML_ATTR(L"c:min", *doubleVal);
CP_XML_NODE(L"c:min")
{
CP_XML_ATTR(L"val", *doubleVal);
}
}
odf_reader::GetProperty(content_.properties_,L"logarithmic", boolVal);
if ((boolVal == true) && (boolVal.get()==true))

View File

@ -59,12 +59,19 @@ oox_chart_series::oox_chart_series()
bLocalTable_ = false;
labelPosEnabled_ = true;
}
void oox_chart_series::setName(std::wstring &value)
void oox_chart_series::setName(const std::wstring &value)
{
name_=value;
name_ = value;
}
void oox_chart_series::setLabels(const std::wstring &formula, std::vector<std::wstring> & cash)
{
formulasconvert::odf2oox_converter converter;
void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & formatCode, bool link_to_source)
label_.present = true;
label_.formula = converter.convert_chart_distance(formula);
label_.str_cache = cash;
}
void oox_chart_series::setFormula(int ind, const std::wstring &value, const std::wstring & formatCode, bool link_to_source)
{
formulasconvert::odf2oox_converter converter;
@ -137,6 +144,7 @@ void oox_chart_series::parse_properties()
data_labels_->set_position(*intVal);
}
}
void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{
values_[ind].present = true;
@ -215,6 +223,44 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
shape.set(content_.graphic_properties_, content_.fill_);
shape.oox_serialize(_Wostream);
if (label_.present)
{
CP_XML_NODE(L"c:tx")
{
CP_XML_NODE(L"c:strRef")
{
if (!label_.formula.empty())
{
CP_XML_NODE(L"c:f")
{
CP_XML_STREAM() << label_.formula;
}
}
if (false == label_.str_cache.empty())
{
CP_XML_NODE(L"c:strCache")
{
CP_XML_NODE(L"c:ptCount")
{
CP_XML_ATTR(L"val", label_.str_cache.size());
}
for (size_t i = 0; i < label_.str_cache.size(); i++)
{
CP_XML_NODE(L"c:pt")
{
CP_XML_ATTR(L"idx", i);
CP_XML_NODE(L"c:v")
{
CP_XML_STREAM() << label_.str_cache[i];
}
}
}
}
}
}
}
}
for (int i = 0; i < 5; i++)
{
if (values_[i].present)

View File

@ -56,17 +56,20 @@ public:
virtual void oox_serialize(std::wostream & _Wostream) = 0;
bool labelPosEnabled_;
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
_oox_chart_values values_[5]; //cat, common, x, y, bubble,
_oox_strRef label_; //tx (Series Text) §21.2.2.215
int id_;
std::wstring name_; //tx (Series Text) §21.2.2.215
std::wstring name_;
int iSymbolMarkerType_;
bool bLocalTable_;
_CP_OPT(oox_data_labels) data_labels_;
void setName(std::wstring &value);
void setName(const std::wstring &value);
void setFormula (int ind, std::wstring & value, std::wstring & formatCode, bool link_to_source);
void setFormula (int ind, const std::wstring & value, const std::wstring & formatCode, bool link_to_source);
void setValues (int ind, std::vector<std::wstring> & values);
void setLabels (const std::wstring &formula, std::vector<std::wstring> & values);
void parse_properties();
void set_cache_only (bool val);

View File

@ -55,21 +55,21 @@ struct _oox_numLit
struct _oox_strRef
{
bool present;
bool present = false;
std::wstring formula;
int str_cache_count;
int str_cache_count = 0;
std::vector<std::wstring> str_cache;
};
struct _oox_numRef
{
bool present;
bool present = false;
std::wstring formula;
std::wstring formatCode;
bool link_to_source;
int num_cache_count;
bool link_to_source = false;
int num_cache_count = 0;
std::vector<std::wstring> num_cache;
};

View File

@ -46,13 +46,13 @@ void oox_chart::set_cache_only (bool val)
}
void oox_chart::set_formula_series(int ind, std::wstring val, std::wstring formatCode, bool link_to_source)
void oox_chart::set_formula_series(int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source)
{
oox_series_ptr & current_ptr = series_.back();
current_ptr->setFormula(ind, val, formatCode, link_to_source);
}
void oox_chart::set_name(std::wstring val)
void oox_chart::set_name(const std::wstring& val)
{
oox_series_ptr & current_ptr = series_.back();
current_ptr->setName(val);
@ -68,6 +68,13 @@ void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
oox_series_ptr & current_ptr = series_.back();
current_ptr->setValues (ind, val);
}
void oox_chart::set_label_series(const std::wstring& formula, std::vector<std::wstring> & cash)
{
if (formula.empty() && cash.empty()) return;
oox_series_ptr & current_ptr = series_.back();
current_ptr->setLabels (formula, cash);
}
void oox_chart::set_properties(std::vector<odf_reader::_property> g)
{
_CP_OPT(int) iVal;

View File

@ -78,9 +78,10 @@ public:
virtual void add_series(int id){}
void set_cache_only (bool val);
void set_formula_series (int ind, std::wstring val, std::wstring formatCode, bool link_to_source);
void set_formula_series (int ind, const std::wstring& val, const std::wstring& formatCode, bool link_to_source);
void set_values_series (int ind, std::vector<std::wstring> & val);
void set_name (std::wstring val);
void set_label_series (const std::wstring& formula, std::vector<std::wstring> & val);
void set_name (const std::wstring& val);
void set_content_series (odf_reader::chart::series & content);
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}

View File

@ -212,13 +212,13 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
oox_convert(chart_context);
if (embeddedData.empty())
if (false == embeddedData.empty())
{
chart_context.set_cache_only(true);
chart_context.set_externalData(embeddedData);
}
else
{
chart_context.set_externalData(embeddedData);
chart_context.set_cache_only(true);
}
Context.end_chart();
@ -416,11 +416,13 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
std::vector<std::wstring> domain_cash;
std::vector<std::wstring> cell_cash;
std::vector<std::wstring> cat_cash;
std::vector<std::wstring> label_cash;
calc_cache_series (domain_cell_range_adress_, domain_cash);
calc_cache_series (series_[i].cell_range_address_, cell_cash);
calc_cache_series (series_[i].label_cell_address_, label_cash);
if (categories_.size() >0)
if (false == categories_.empty())
calc_cache_series (categories_[0], cat_cash);
std::wstring formatCode = L"General";
@ -434,6 +436,11 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
{
formatCode = *strVal;
}
if (false == series_[i].label_cell_address_.empty())
{
current->set_label_series(series_[i].label_cell_address_, label_cash);//_oox_strRef
}
if (domain_cell_range_adress_.empty() == false ||
last_set_type == chart_scatter)
@ -450,14 +457,14 @@ void object_odf_context::oox_convert(oox::oox_chart_context & chart_context)
}
else
{ //x
if (false == domain_cash.empty())
if (false == domain_cash.empty() || false == cash_values.empty())
{
if (!bPivotChart_)
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash);
}
//y
if (false == cell_cash.empty())
if (false == cell_cash.empty() || false == cash_values.empty())
{
if (!bPivotChart_)
current->set_formula_series(3, series_[i].cell_range_address_, formatCode, boolVal.get_value_or(true));

View File

@ -2052,8 +2052,8 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
double x = x_pt ? *x_pt : 0;
double y = y_pt ? *y_pt : 0;
double cx = *impl_->current_drawing_state_.cx_;
double cy = *impl_->current_drawing_state_.cy_;
//double cx = *impl_->current_drawing_state_.cx_;
//double cy = *impl_->current_drawing_state_.cy_;
if (impl_->current_drawing_state_.in_group_)
{
@ -2067,8 +2067,8 @@ void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) &
x = (x + impl_->group_list_[i]->shift_x) * impl_->group_list_[i]->scale_cx ;
y = (y + impl_->group_list_[i]->shift_y) * impl_->group_list_[i]->scale_cy;
cx *= impl_->group_list_[i]->scale_cx;
cy *= impl_->group_list_[i]->scale_cy;
//cx *= impl_->group_list_[i]->scale_cx;
//cy *= impl_->group_list_[i]->scale_cy;
}
}

View File

@ -533,12 +533,13 @@ void odf_number_styles_context::create_percentage_style(number_format_state & st
create_numbers(state, elm, empty);
root_elm->add_child_element(elm);
create_element(L"number", L"text", elm, odf_context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
office_element_ptr elm_text;
create_element(L"number", L"text", elm_text, odf_context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm_text.get());
if (number_text_)number_text_->add_text(L"%");
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
root_elm->add_child_element(elm_text);
styles_elments.push_back(elm_text);
}
void odf_number_styles_context::create_currency_style(number_format_state & state, office_element_ptr & root_elm)
@ -568,7 +569,7 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
}
}
if (number_country.length()>0)
if (false == number_country.empty())
{
number_currency_symbol_->number_country_ = number_country;
}

View File

@ -92,22 +92,27 @@ void odf_page_layout_context::create_layer_sets()
create_element(L"draw", L"layer", elm, odf_context_); sets_elm->add_child_element(elm);
layer = dynamic_cast<draw_layer*>(elm.get());
if (layer) layer->draw_name_ = L"layout";
elm = office_element_ptr();
create_element(L"draw", L"layer", elm, odf_context_); sets_elm->add_child_element(elm);
layer = dynamic_cast<draw_layer*>(elm.get());
if (layer) layer->draw_name_ = L"background";
elm = office_element_ptr();
create_element(L"draw", L"layer", elm, odf_context_); sets_elm->add_child_element(elm);
layer = dynamic_cast<draw_layer*>(elm.get());
if (layer) layer->draw_name_ = L"backgroundobjects";
elm = office_element_ptr();
create_element(L"draw", L"layer", elm, odf_context_); sets_elm->add_child_element(elm);
layer = dynamic_cast<draw_layer*>(elm.get());
if (layer) layer->draw_name_ = L"controls";
elm = office_element_ptr();
create_element(L"draw", L"layer", elm, odf_context_); sets_elm->add_child_element(elm);
layer = dynamic_cast<draw_layer*>(elm.get());
if (layer) layer->draw_name_ = L"measurelines";
elm = office_element_ptr();
master_state_list_.push_back( odf_master_state(sets_elm) );
}

View File

@ -59,7 +59,17 @@ _UINT32 COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstr
POLE::Storage *pStgFrom = new POLE::Storage(sFileName.c_str());
if (pStgFrom == NULL) return AVS_ERROR_FILEFORMAT;
pStgFrom->open(false, false);
try
{
if (false == pStgFrom->open(false, false))
{
return AVS_ERROR_FILEACCESS; //file access error or not compound file
}
}
catch(...)
{
return AVS_ERROR_FILEACCESS;
}
m_pReader = new CPPTFileReader(pStgFrom, m_strTempDirectory);
CPPTFileReader* pptReader = (CPPTFileReader*)m_pReader;

View File

@ -121,8 +121,15 @@ public:
{
if (m_arUsers.empty()) return false;
m_arUsers[0]->ReadExtenalObjects(strFolderMem);
m_arUsers[0]->FromDocument();
try
{
m_arUsers[0]->ReadExtenalObjects(strFolderMem);
m_arUsers[0]->FromDocument();
}
catch(int) //error code
{
return false;
}
return true;
}

View File

@ -860,7 +860,12 @@ void CPPTUserInfo::LoadSlide(_UINT32 dwSlideID, CSlide* pSlide)
if (pPairTheme == m_mapMasterToTheme.end())
{
//????? слайду не присвоена тема !!!
pPairTheme = m_mapMasterToTheme.begin();
if (false == m_mapMasterToTheme.empty())
pPairTheme = m_mapMasterToTheme.begin();
else
{
throw 1; // file format error
}
}
//-----------------
pSlide->m_lThemeID = pPairTheme->second;
@ -1766,8 +1771,10 @@ void CPPTUserInfo::LoadMaster(_typeMaster type, CRecordSlide* pMaster, CSlideInf
//настройки текстовых стилей -----------------------------------------------
for (size_t i = 0; i < 9; ++i)
for (size_t i = 0; i < 9 && false == m_arMasterWrapper.empty(); ++i)
{
pMasterWrapper->m_pStyles[i] = m_arMasterWrapper[0].m_pStyles[i]; //main master
}
CLayout* pLayout = NULL; // ну нету тут разметок ...!!

View File

@ -349,6 +349,14 @@
RelativePath="..\..\ASCOfficePPTXFile\Editor\BinaryFileReaderWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>

View File

@ -359,6 +359,14 @@
<Filter
Name="Common"
>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\BinaryReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\BinaryWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>

View File

@ -35,16 +35,14 @@
namespace XLS
{
ContinueFrt::ContinueFrt()
ContinueFrt::ContinueFrt() : nData(0)
{
}
ContinueFrt::~ContinueFrt()
{
}
BaseObjectPtr ContinueFrt::clone()
{
return BaseObjectPtr(new ContinueFrt(*this));
@ -52,10 +50,15 @@ BaseObjectPtr ContinueFrt::clone()
void ContinueFrt::readFields(CFRecord& record)
{
#pragma message("####################### ContinueFrt record is not implemented")
Log::error("ContinueFrt record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
record >> frtHeaderOld;
nData = record.getDataSize() - 4;
pData = boost::shared_array<char>(new char[nData]);
memcpy(pData.get(), record.getCurData<char>(), nData);
record.skipNunBytes(nData);
}
} // namespace XLS

View File

@ -31,13 +31,12 @@
*/
#pragma once
#include "../Biff_structures/FrtHeaderOld.h"
#include "BiffRecord.h"
namespace XLS
{
// Logical representation of ContinueFrt record in BIFF8
class ContinueFrt: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ContinueFrt)
@ -47,11 +46,14 @@ public:
~ContinueFrt();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeContinueFrt;
static const ElementType type = typeContinueFrt;
FrtHeaderOld frtHeaderOld;
boost::shared_array<char> pData;
size_t nData;
};

View File

@ -35,16 +35,14 @@
namespace XLS
{
ContinueFrt11::ContinueFrt11()
ContinueFrt11::ContinueFrt11(): nData(0)
{
}
ContinueFrt11::~ContinueFrt11()
{
}
BaseObjectPtr ContinueFrt11::clone()
{
return BaseObjectPtr(new ContinueFrt11(*this));
@ -53,6 +51,15 @@ BaseObjectPtr ContinueFrt11::clone()
void ContinueFrt11::readFields(CFRecord& record)
{
record >> frtHeaderOld;
nData = record.getDataSize() - 4;
pData = boost::shared_array<char>(new char[nData]);
memcpy(pData.get(), record.getCurData<char>(), nData);
record.skipNunBytes(nData);
}
} // namespace XLS

View File

@ -31,13 +31,12 @@
*/
#pragma once
#include "../Biff_structures/FrtHeaderOld.h"
#include "BiffRecord.h"
namespace XLS
{
// Logical representation of ContinueFrt11 record in BIFF8
class ContinueFrt11: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(ContinueFrt11)
@ -47,12 +46,14 @@ public:
~ContinueFrt11();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeContinueFrt11;
FrtHeaderOld frtHeaderOld;
boost::shared_array<char> pData;
size_t nData;
};
} // namespace XLS

View File

@ -52,10 +52,13 @@ BaseObjectPtr CrtMlFrt::clone()
void CrtMlFrt::readFields(CFRecord& record)
{
#pragma message("####################### CrtMlFrt record is not implemented")
Log::error("CrtMlFrt record is not implemented.");
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
record >> frtHeader >> cbXmltkChain;
//xmltkChain.cb = cbXmltkChain;
//record >> xmltkChain;
record.skipNunBytes(cbXmltkChain);
record.skipNunBytes(4);
}
} // namespace XLS

View File

@ -31,13 +31,12 @@
*/
#pragma once
#include "../Biff_structures/FrtHeader.h"
#include "BiffRecord.h"
namespace XLS
{
// Logical representation of CrtMlFrt record in BIFF8
class CrtMlFrt: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(CrtMlFrt)
@ -47,12 +46,16 @@ public:
~CrtMlFrt();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeCrtMlFrt;
FrtHeader frtHeader;
_UINT32 cbXmltkChain;
//XmlTkChain xmltkChain;
//-----------------------------
_UINT32 cb;

View File

@ -58,12 +58,15 @@ void ExternSheet::readFields(CFRecord& record)
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
{
unsigned char type;
unsigned char size;
ShortXLAnsiString stName;
record >> type >> stName;
record >> size >> type;
LPAnsiStringNoCch stName(size);
record >> stName;
name = stName.value();
//int type = stName.value().substr(0, 1).c_str()[0];
//if (!name.empty())
// record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);

View File

@ -31,11 +31,12 @@
*/
#include "Feature11.h"
#include "ContinueFrt11.h"
namespace XLS
{
Feature11::Feature11()
Feature11::Feature11(bool bFeat12) : bFeature12(bFeat12)
{
}
@ -50,6 +51,18 @@ BaseObjectPtr Feature11::clone()
void Feature11::readFields(CFRecord& record)
{
size_t sz = continue_records.size();
std::list<CFRecordPtr>& recs = continue_records[rt_ContinueFrt11];
while (!recs.empty())
{
ContinueFrt11 continueFrt;
continueFrt.readFields(*recs.front());
record.appendRawData(continueFrt.pData.get(), continueFrt.nData);
recs.pop_front();
}
record >> frtRefHeaderU;
record >> isf;
@ -67,7 +80,13 @@ void Feature11::readFields(CFRecord& record)
refs2.push_back(BiffStructurePtr(new Ref8U(reff)));
sqref += reff.toString() + ((i == cref2 - 1) ? L"" : L" ");
}
if (cbFeatData == 0)
{
cbFeatData = record.getDataSize() - (cref2 * 8) - 27;
}
rgbFeat.bFeature12 = bFeature12;
rgbFeat.cbFeatData = cbFeatData;
record >> rgbFeat;
}

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include "BiffRecord.h"
#include "BiffRecordContinued.h"
#include "../Biff_structures/FrtRefHeaderU.h"
#include "../Biff_structures/CellRangeRef.h"
@ -40,12 +40,12 @@
namespace XLS
{
class Feature11: public BiffRecord
class Feature11 : public BiffRecordContinued //: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Feature11)
BASE_OBJECT_DEFINE_CLASS_NAME(Feature11)
public:
Feature11();
Feature11(bool bFeat12 = false);
~Feature11();
BaseObjectPtr clone();
@ -62,6 +62,8 @@ public:
std::wstring sqref;
TableFeatureType rgbFeat;
bool bFeature12;
};
} // namespace XLS

View File

@ -31,11 +31,12 @@
*/
#include "Feature12.h"
#include "ContinueFrt.h"
namespace XLS
{
Feature12::Feature12()
Feature12::Feature12() : feature11(true)
{
}
@ -51,6 +52,17 @@ BaseObjectPtr Feature12::clone()
void Feature12::readFields(CFRecord& record)
{
size_t sz = continue_records.size();
std::list<CFRecordPtr>& recs = continue_records[rt_ContinueFrt];
while (!recs.empty())
{
ContinueFrt continueFrt;
continueFrt.readFields(*recs.front());
record.appendRawData(continueFrt.pData.get(), continueFrt.nData);
recs.pop_front();
}
feature11.readFields(record);
}

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/LongRGB.h>
#include "../Biff_structures/LongRGB.h"
namespace XLS
{
// Logical representation of LineFormat record in BIFF8
class LineFormat: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(LineFormat)
@ -48,7 +46,6 @@ public:
~LineFormat();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -36,7 +36,6 @@
namespace XLS
{
class IXFCellMulBlankSpecial : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(IXFCellMulBlankSpecial)
@ -53,9 +52,6 @@ public:
std::vector<unsigned short> rgixfe;
};
// Logical representation of MulBlank record in BIFF8
class MulBlank: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(MulBlank)

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of Row record in BIFF8
class Row: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Row)
@ -47,13 +45,12 @@ public:
~Row();
BaseObjectPtr clone();
void readFields(CFRecord& record);
int serialize(std::wostream & stream);
static const ElementType type = typeRow;
static const ElementType type = typeRow;
GlobalWorkbookInfoPtr global_info_;

View File

@ -50,7 +50,10 @@ void CachedDiskHeader::load(CFRecord& record)
rgHdrDisk.size = cbdxfHdrDisk;
rgHdrDisk.load(record);
}
record >> strStyleName;
if (fSaveStyleName)
{
record >> strStyleName;
}
}
} // namespace XLS

View File

@ -52,6 +52,9 @@ public:
_UINT32 cbdxfHdrDisk;
DXFN12List rgHdrDisk;
XLUnicodeString strStyleName;
bool fSaveStyleName;
};
typedef boost::shared_ptr<CachedDiskHeader> CachedDiskHeaderPtr;

View File

@ -64,6 +64,7 @@ void DXFN12List::load(CFRecord& record)
bExist = true;
record >> dxfn;
size -= (record.getRdPtr() - pos_record);
pos_record = record.getRdPtr();
}
if (size > 0)
{

View File

@ -57,7 +57,7 @@ public:
XFExtNoFRT xfext;
//-----------------------------------------------------------------
bool bExist;
_UINT32 size;
_INT32 size;
};
typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr;

View File

@ -49,6 +49,7 @@ void Feat11FdaAutoFilter::load(CFRecord& record)
if (cbAutoFilter >= 0xffff0000)
{
//LCA BI - Financial Report Usage2010.xls
record.RollRdPtrBack(4);
return;
}
record.skipNunBytes(2);

View File

@ -36,7 +36,7 @@
namespace XLS
{
Feat11FieldDataItem::Feat11FieldDataItem(_UINT32 _lt, bool bDskHeaderCache) : lt(_lt), bDiskHdrCache(bDskHeaderCache)
Feat11FieldDataItem::Feat11FieldDataItem(_UINT32 _lt, bool bDskHeaderCache, bool bFeat12) : lt(_lt), bDiskHdrCache(bDskHeaderCache), bFeature12(bFeat12)
{
}
BiffStructurePtr Feat11FieldDataItem::clone()
@ -96,7 +96,7 @@ void Feat11FieldDataItem::load(CFRecord& record)
{
fmla.load(record);
}
if (fLoadTotalFmla)
if (fLoadTotalFmla && bFeature12)
{
if (fLoadTotalArray)
{
@ -107,7 +107,7 @@ void Feat11FieldDataItem::load(CFRecord& record)
totalFmla.load(record);
}
}
if (fLoadTotalStr)
if (fLoadTotalStr && bFeature12)
{
record >> strTotal;
}
@ -122,6 +122,7 @@ void Feat11FieldDataItem::load(CFRecord& record)
}
if (bDiskHdrCache)
{
dskHdrCache.fSaveStyleName = fSaveStyleName;
record >> dskHdrCache;
}
}

View File

@ -50,7 +50,7 @@ class Feat11FieldDataItem : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11FieldDataItem)
public:
Feat11FieldDataItem(_UINT32 lt, bool bDskHeaderCache);
Feat11FieldDataItem(_UINT32 lt, bool bDskHeaderCache, bool bFeat12);
BiffStructurePtr clone();
static const ElementType type = typeFeat11FieldDataItem;
@ -97,6 +97,7 @@ public:
//------------------------------------------------
_UINT32 lt;
bool bDiskHdrCache;
bool bFeature12;
};
typedef boost::shared_ptr<Feat11FieldDataItem> Feat11FieldDataItemPtr;

View File

@ -50,8 +50,6 @@ public:
BiffStructurePtr clone();
virtual void load(CFRecord& record);
static const ElementType type = typeFrtHeader;

View File

@ -131,7 +131,7 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
ptg_stack.push(strRange + range_ref);
}
}
if (ixti != 0xffff)
if (ixti & 0xfff0 != 0xfff0)
{
std::wstring link = global_info->arXti_External[ixti].link;
if (!link.empty() && !range_ref.empty())

View File

@ -87,6 +87,25 @@ void TableFeatureType::load(CFRecord& record)
fLoadCSPName = GETBIT(flags, 14);
fLoadPldwIdChanged = GETBIT(flags, 15);
if (bFeature12)
{
//crwHeader = 0;
//lt = 0x00000003;
//fSingleCell = false;
}
else
{
//lt != 0x00000003;
//crwHeader == 0 && fSingleCell == false -> lt = 0
}
if (fAutoFilter) crwHeader = 1;
if (fSingleCell)
{
crwHeader = 0;
crwTotals = 0;
}
record >> flags;
verXL = GETBITS(flags, 0, 4);
fLoadEntryId = GETBIT(flags, 4);
@ -105,7 +124,7 @@ void TableFeatureType::load(CFRecord& record)
record.skipNunBytes(16); // rgbHashParam
record >> rgbName;
record >> cFieldData; //from 1 to 100
record >> cFieldData; //from 1 to 0x100
if (fLoadCSPName)
record >> cSPName;
@ -118,7 +137,7 @@ void TableFeatureType::load(CFRecord& record)
if (record.getRdPtr() >= record.getDataSize())
return;
arFieldData.push_back(BiffStructurePtr(new Feat11FieldDataItem(lt, (crwHeader == 0x0000 && fSingleCell))));
arFieldData.push_back(BiffStructurePtr(new Feat11FieldDataItem(lt, (crwHeader == 0x0000 && fSingleCell == 0x0000), bFeature12)));
arFieldData.back()->load(record);
}
if (fLoadPldwIdDeleted)

View File

@ -93,6 +93,10 @@ public:
BiffStructurePtr idDeleted;
BiffStructurePtr idChanged;
BiffStructurePtr cellInvalid;
//-------
_UINT32 cbFeatData;
bool bFeature12;
};
typedef boost::shared_ptr<TableFeatureType> TableFeatureTypePtr;

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of AXISPARENT union of records
class AXISPARENT: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(AXISPARENT)

View File

@ -38,7 +38,6 @@ namespace XLS
class CellRef;
// Logical representation of CELL union of records
class CELL: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CELL)
@ -52,7 +51,7 @@ public:
int serialize(std::wostream & stream);
static const ElementType type = typeCELL;
static const ElementType type = typeCELL;
int RowNumber;
int ColumnNumber;

View File

@ -31,18 +31,19 @@
*/
#include "CELLTABLE.h"
#include <Logic/Biff_records/EntExU2.h>
#include <Logic/Biff_records/Row.h>
#include <Logic/Biff_unions/CELL.h>
#include <Logic/Biff_records/DBCell.h>
#include "CELL.h"
#include "../Biff_records/EntExU2.h"
#include "../Biff_records/Row.h"
#include "../Biff_records/DBCell.h"
#include "../Biff_records/MulBlank.h"
#include "../Biff_records/MulRk.h"
#include <simple_xml_writer.h>
namespace XLS
{
// This class is made a deriver of CompositeObject intentionally.
// This is an optimization step - to form a CELLTABLE that is divided into smaller groups
class CELL_GROUP : public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CELL_GROUP)
@ -59,11 +60,10 @@ public:
const bool loadContent(BinProcessor& proc)
{
global_info_ = proc.getGlobalWorkbookInfo();
global_info_ = proc.getGlobalWorkbookInfo();
int index_sheet_info_ = global_info_->current_sheet - 1;
XLS::GlobalWorkbookInfo::_sheet_info zero;
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->current_sheet >=0 ?
global_info_->sheets_info[global_info_->current_sheet - 1] : zero;
GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->sheets_info[index_sheet_info_];
int count, count_row = 0;
@ -81,7 +81,22 @@ public:
sheet_info.customRowsHeight.insert(std::make_pair(row->rw, row->miyRw / 20.));
}
}
m_rows.push_back(elements_.front());
std::map<int, GlobalWorkbookInfo::_row_info>::iterator pFindRow = sheet_info.mapRows.find(row->rw);
if (pFindRow == sheet_info.mapRows.end())
{
GlobalWorkbookInfo::_row_info row_info;
row_info.row_info = elements_.front();
sheet_info.mapRows.insert(std::make_pair(row->rw, row_info));
}
else
{
if (!pFindRow->second.row_info)
{
pFindRow->second.row_info = elements_.front();
}
}
elements_.pop_front();
count--;
}
@ -97,16 +112,25 @@ public:
CELL * cell = dynamic_cast<CELL *>(elements_.front().get());
if (cell)
{
std::map<int, std::list<BaseObjectPtr>>::iterator it = m_cells.find(cell->RowNumber);
if (it == m_cells.end())
std::map<int, GlobalWorkbookInfo::_row_info>::iterator pFindRow = sheet_info.mapRows.find(cell->RowNumber);
if (pFindRow == sheet_info.mapRows.end())
{
std::list<BaseObjectPtr> c;
c.push_back(elements_.front());
m_cells.insert(std::make_pair(cell->RowNumber, c));
GlobalWorkbookInfo::_row_info row_info;
sheet_info.mapRows.insert(std::make_pair(cell->RowNumber, row_info));
pFindRow = sheet_info.mapRows.find(cell->RowNumber);
}
std::map<int, BaseObjectPtr>::iterator pFindCell = pFindRow->second.mapCells.find(cell->ColumnNumber);
if (pFindCell != pFindRow->second.mapCells.end())
{
CELL* cell_prev = dynamic_cast<CELL *>(pFindCell->second.get());
pFindCell->second = elements_.front();
}
else
{
it->second.push_back(elements_.front());
pFindRow->second.mapCells.insert(std::make_pair(cell->ColumnNumber, elements_.front()));
}
}
elements_.pop_front();
@ -124,158 +148,19 @@ public:
else return false;
}
int serialize(std::wostream & stream);
static const ElementType type = typeCELL_GROUP;
static const ElementType type = typeCELL_GROUP;
//---------------------------------------------------------------------------
std::map<int, std::list<BaseObjectPtr>> m_cells;
std::list<BaseObjectPtr> m_rows;
std::list<BaseObjectPtr> m_DBCells;
std::list<BaseObjectPtr> m_DBCells;
private:
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
GlobalWorkbookInfoPtr global_info_;
};
struct _CompareRowCell
{
bool operator()(XLS::BaseObjectPtr & first, XLS::BaseObjectPtr & second)
{
CELL * cell_1 = dynamic_cast<CELL *>(first.get());
CELL * cell_2 = dynamic_cast<CELL *>(second.get());
if (!cell_1 || !cell_2)
return true;
if (cell_1->RowNumber < cell_2->RowNumber)
return true;
else
return false;
}
}CompareRowCell;
struct _CompareColumnCell
{
bool operator()(XLS::BaseObjectPtr & first, XLS::BaseObjectPtr & second)
{
CELL * cell_1 = dynamic_cast<CELL *>(first.get());
CELL * cell_2 = dynamic_cast<CELL *>(second.get());
if (!cell_1 || !cell_2)
return true;
if (cell_1->ColumnNumber < cell_2->ColumnNumber)
return true;
else
return false;
}
}CompareColumnCell;
int CELL_GROUP::serialize(std::wostream & stream)
{
XLS::GlobalWorkbookInfo::_sheet_info zero;
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->current_sheet >=0 ?
global_info_->sheets_info[global_info_->current_sheet - 1] : zero;
CP_XML_WRITER(stream)
{
std::list<XLS::BaseObjectPtr>::iterator current_row = m_rows.begin();
for (std::map<int, std::list<BaseObjectPtr>>::iterator it_row = m_cells.begin(); it_row != m_cells.end(); it_row++)
{
it_row->second.sort(CompareColumnCell);
Row * row = NULL;
if (current_row != m_rows.end())
{
row = dynamic_cast<Row *>(current_row->get());
while ((row) && (row->rw < it_row->first))
{//skip cells
row->serialize(stream);
current_row++;
if (current_row == m_rows.end())
break;
row = dynamic_cast<Row *>(current_row->get());
}
}
CP_XML_NODE(L"row")
{
CP_XML_ATTR(L"r", it_row->first + 1);
if ((row) && (row->rw == it_row->first))
{
bool xf_set = true;
if (row->fGhostDirty == false) xf_set = false;
if (xf_set)
{
int xf = row->ixfe_val >= global_info_->cellStyleXfs_count ? row->ixfe_val - global_info_->cellStyleXfs_count : -1/*row->ixfe_val*/;
if (xf < global_info_->cellXfs_count && xf >= 0)
{
CP_XML_ATTR(L"s", xf);
CP_XML_ATTR(L"customFormat", true);
}
}
if (row->miyRw > 0 && row->miyRw < 0x8000) //v8_14A_1b13.xls
{
CP_XML_ATTR(L"ht", row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
if (row->iOutLevel > 0)
{
CP_XML_ATTR(L"outlineLevel", row->iOutLevel);
}
if (row->fCollapsed)
{
CP_XML_ATTR(L"collapsed", row->fCollapsed);
}
if (row->fExAsc)
{
CP_XML_ATTR(L"thickTop", true);
}
if (row->fExDes)
{
CP_XML_ATTR(L"thickBot", true);
}
if (row->fDyZero)
{
CP_XML_ATTR(L"hidden", true);
}
row = NULL;
current_row++;
if (current_row != m_rows.end())
row = dynamic_cast<Row *>(current_row->get());
}
for ( std::list<BaseObjectPtr>::iterator it_cell = it_row->second.begin(); it_cell != it_row->second.end(); it_cell++)
{
(*it_cell)->serialize(CP_XML_STREAM());
}
}
}
while (current_row != m_rows.end())
{//skip cells ... last rows
(*current_row)->serialize(stream);
current_row++;
}
}
return 0;
}
//-----------------------------------------------------------------------------------------------------------------
CELLTABLE::CELLTABLE(std::vector<CellRangeRef>& shared_formulas_locations_ref) :
m_count_CELL_GROUP(0)
,shared_formulas_locations_ref_(shared_formulas_locations_ref)
isConcatinate_(false), shared_formulas_locations_ref_(shared_formulas_locations_ref)
{
}
@ -293,16 +178,31 @@ BaseObjectPtr CELLTABLE::clone()
// CELLTABLE = 1*(1*Row *CELL 1*DBCell) *EntExU2
const bool CELLTABLE::loadContent(BinProcessor& proc)
{
CELL_GROUP cell_group1(shared_formulas_locations_ref_);
if(!proc.mandatory(cell_group1))
global_info_ = proc.getGlobalWorkbookInfo();
index_sheet_info_ = global_info_->current_sheet - 1;
GlobalWorkbookInfo::_sheet_info zero;
while (index_sheet_info_ >= global_info_->sheets_info.size())
{
global_info_->sheets_info.push_back(zero);
}
CELL_GROUP cell_group(shared_formulas_locations_ref_);
if(!proc.mandatory(cell_group))
{
return false;
}
int count = 1 + proc.repeated(cell_group, 0, 0);
CELL_GROUP cell_group2(shared_formulas_locations_ref_);
m_count_CELL_GROUP = proc.repeated(cell_group2, 0, 0);
int count = proc.repeated<EntExU2>(0, 0);
while(!elements_.empty())
{
//m_arCELLGROUP.insert(m_arCELLGROUP.begin(), elements_.back());
elements_.pop_back();
count--;
}
count = proc.repeated<EntExU2>(0, 0);
while(count > 0)
{
m_arEntExU2.insert(m_arEntExU2.begin(), elements_.back());
@ -311,12 +211,95 @@ const bool CELLTABLE::loadContent(BinProcessor& proc)
}
return true;
}
int CELLTABLE::serialize(std::wostream & stream)
{
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); ++it)
{
it->get()->serialize(stream);
GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->sheets_info[index_sheet_info_];
CP_XML_WRITER(stream)
{
for (std::map<int, GlobalWorkbookInfo::_row_info>::iterator it_row = sheet_info.mapRows.begin(); it_row != sheet_info.mapRows.end(); it_row++)
{
Row* row = dynamic_cast<Row*>(it_row->second.row_info.get());
if (row && it_row->second.mapCells.empty())
{
it_row->second.row_info->serialize(stream);
}
else
{
CP_XML_NODE(L"row")
{
CP_XML_ATTR(L"r", it_row->first + 1);
if (row)
{
bool xf_set = true;
if (row->fGhostDirty == false) xf_set = false;
if (xf_set)
{
int xf = row->ixfe_val >= global_info_->cellStyleXfs_count ? row->ixfe_val - global_info_->cellStyleXfs_count : -1/*row->ixfe_val*/;
if (xf < global_info_->cellXfs_count && xf >= 0)
{
CP_XML_ATTR(L"s", xf);
CP_XML_ATTR(L"customFormat", true);
}
}
if (row->miyRw > 0 && row->miyRw < 0x8000) //v8_14A_1b13.xls
{
CP_XML_ATTR(L"ht", row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
if (row->iOutLevel > 0)
{
CP_XML_ATTR(L"outlineLevel", row->iOutLevel);
}
if (row->fCollapsed)
{
CP_XML_ATTR(L"collapsed", row->fCollapsed);
}
if (row->fExAsc)
{
CP_XML_ATTR(L"thickTop", true);
}
if (row->fExDes)
{
CP_XML_ATTR(L"thickBot", true);
}
if (row->fDyZero)
{
CP_XML_ATTR(L"hidden", true);
}
}
for ( std::map<int, BaseObjectPtr>::iterator it_cell = it_row->second.mapCells.begin(); it_cell != it_row->second.mapCells.end(); it_cell++)
{
if (isConcatinate_)
{
CELL* cell = dynamic_cast<CELL*>((it_cell->second).get());
MulBlank *mulblank = dynamic_cast<MulBlank*>(cell->elements_.begin()->get());
MulRk *mulrk = dynamic_cast<MulRk*>(cell->elements_.begin()->get());
if (mulblank || mulrk)
{
std::map<int, BaseObjectPtr>::iterator it_next_cell = it_cell; it_next_cell++;
if (it_next_cell != it_row->second.mapCells.end())
{
CELL* cell_next = dynamic_cast<CELL*>((it_next_cell->second).get());
if (mulblank) mulblank->colLast = (std::min)((int)mulblank->colLast, cell_next->ColumnNumber - 1);
if (mulrk) mulrk->colLast = (std::min)((int)mulrk->colLast, cell_next->ColumnNumber - 1);
}
}
}
(it_cell->second)->serialize(CP_XML_STREAM());
}
}
}
}
}
return 0;
}

View File

@ -54,8 +54,12 @@ public:
int serialize(std::wostream & stream);
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
int m_count_CELL_GROUP;
std::vector<BaseObjectPtr> m_arEntExU2;
GlobalWorkbookInfoPtr global_info_;
int index_sheet_info_;
bool isConcatinate_;
};
} // namespace XLS

View File

@ -35,8 +35,8 @@
#include "../Biff_records/Blank.h"
#include "../Biff_records/MulBlank.h"
#include "../Biff_records/RK.h"
#include "../Biff_records/MulRk.h"
#include "../Biff_records/RK.h"
#include "../Biff_records/BoolErr.h"
#include "../Biff_records/Number.h"
#include "../Biff_records/LabelSst.h"

View File

@ -31,9 +31,12 @@
*/
#include "CHART.h"
#include <Logic/Biff_records/BOF.h>
#include <Logic/ChartSheetSubstream.h>
#include <Logic/Biff_records/Continue.h>
#include "../ChartSheetSubstream.h"
#include "../Biff_records/BOF.h"
#include "../Biff_records/Continue.h"
#include "../Biff_unions/CELLTABLE.h"
#include "../Biff_structures/CellRangeRef.h"
#include "../Biff_records/EOF.h"
namespace XLS
{
@ -51,12 +54,17 @@ BaseObjectPtr CHART::clone()
const bool CHART::loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
unsigned short ss_type;
if(!proc.getNextSubstreamType(ss_type) || BOF::st_Chart != ss_type)
{
return false;
}
ChartSheetSubstream chart_sheet(-1);
size_t tmp_index_table = global_info->sheets_info.size(); //if present table
ChartSheetSubstream chart_sheet(tmp_index_table);
if(!proc.mandatory(chart_sheet))
{
return false;
@ -82,6 +90,20 @@ const bool CHART::loadContent(BinProcessor& proc)
elements_.pop_back();
count--;
}
//chart_sourcedata_missing_import_biff5.xls
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
std::vector<CellRangeRef> shared_formulas_locations;
CELLTABLE cell_table_temlate(shared_formulas_locations);
if (proc.optional(cell_table_temlate))
{
//cash table
}
if (proc.optional<EOF_T>())
{//???
}
}
return true;
}

View File

@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of CRT union of records
class CRT: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CRT)

View File

@ -31,24 +31,24 @@
*/
#include "CUSTOMVIEW.h"
#include <Logic/Biff_records/UserSViewBegin.h>
#include <Logic/Biff_records/Selection.h>
#include <Logic/Biff_records/HorizontalPageBreaks.h>
#include <Logic/Biff_records/VerticalPageBreaks.h>
#include <Logic/Biff_records/Header.h>
#include <Logic/Biff_records/Footer.h>
#include <Logic/Biff_records/HCenter.h>
#include <Logic/Biff_records/VCenter.h>
#include <Logic/Biff_records/LeftMargin.h>
#include <Logic/Biff_records/RightMargin.h>
#include <Logic/Biff_records/TopMargin.h>
#include <Logic/Biff_records/BottomMargin.h>
#include <Logic/Biff_records/Pls.h>
#include <Logic/Biff_records/Setup.h>
#include <Logic/Biff_records/PrintSize.h>
#include <Logic/Biff_records/HeaderFooter.h>
#include <Logic/Biff_records/UserSViewEnd.h>
#include <Logic/Biff_unions/AUTOFILTER.h>
#include "AUTOFILTER.h"
#include "../Biff_records/UserSViewBegin.h"
#include "../Biff_records/Selection.h"
#include "../Biff_records/HorizontalPageBreaks.h"
#include "../Biff_records/VerticalPageBreaks.h"
#include "../Biff_records/Header.h"
#include "../Biff_records/Footer.h"
#include "../Biff_records/HCenter.h"
#include "../Biff_records/VCenter.h"
#include "../Biff_records/LeftMargin.h"
#include "../Biff_records/RightMargin.h"
#include "../Biff_records/TopMargin.h"
#include "../Biff_records/BottomMargin.h"
#include "../Biff_records/Pls.h"
#include "../Biff_records/Setup.h"
#include "../Biff_records/PrintSize.h"
#include "../Biff_records/HeaderFooter.h"
#include "../Biff_records/UserSViewEnd.h"
namespace XLS
{
@ -105,7 +105,7 @@ const bool CUSTOMVIEW::loadContent(BinProcessor& proc)
proc.optional<TopMargin>();
proc.optional<BottomMargin>();
if (proc.optional<Pls>())
if (proc.optional<Pls>())
{
m_pls = elements_.back();
elements_.pop_back();

View File

@ -80,9 +80,7 @@ public:
return false;
}
}
int count = 0;
count = proc.repeated<ContinueFrt11>(0, 0);
count = proc.repeated<List12>(0, 0);
int count = proc.repeated<List12>(0, 0);
while (proc.optional<AutoFilter12>())
{
@ -199,10 +197,14 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
{
if (display.empty()) display = feature11->rgbFeat.rgbName.value();
CP_XML_ATTR(L"id", feature11->rgbFeat.idList);
CP_XML_ATTR(L"name", feature11->rgbFeat.rgbName.value());
CP_XML_ATTR(L"displayName", display);
CP_XML_ATTR(L"ref", feature11->sqref);
CP_XML_ATTR(L"id", feature11->rgbFeat.idList);
CP_XML_ATTR(L"name", feature11->rgbFeat.rgbName.value());
CP_XML_ATTR(L"displayName", display);
CP_XML_ATTR(L"ref", feature11->sqref);
CP_XML_ATTR(L"headerRowCount", feature11->rgbFeat.crwHeader);
CP_XML_ATTR(L"totalsRowCount", feature11->rgbFeat.crwTotals);
//CP_XML_ATTR(L"totalsRowShown", feature11->rgbFeat.fShownTotalRow);
if (!comment.empty())
CP_XML_ATTR(L"comment", comment);
@ -289,7 +291,23 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
//if (!field->stData.value().empty())
// CP_XML_ATTR(L"dataDxfId", field->stData.value());
}
//totalsRowFunction
if (field->fmla.bFmlaExist)
{
CP_XML_NODE(L"calculatedColumnFormula")
{
CP_XML_STREAM() << field->fmla.fmla.getAssembledFormula();
}
}
if (field->fLoadTotalFmla)
{
CP_XML_NODE(L"totalsRowFormula")
{
if (field->fLoadTotalArray)
CP_XML_STREAM() << field->totalArrayFmla.getAssembledFormula();
else
CP_XML_STREAM() << field->totalFmla.getAssembledFormula();
}
}
}
}
}

View File

@ -31,9 +31,9 @@
*/
#include "INTERFACE.h"
#include <Logic/Biff_records/InterfaceHdr.h>
#include <Logic/Biff_records/Mms.h>
#include <Logic/Biff_records/InterfaceEnd.h>
#include "../Biff_records/InterfaceHdr.h"
#include "../Biff_records/Mms.h"
#include "../Biff_records/InterfaceEnd.h"
namespace XLS
{

View File

@ -95,7 +95,7 @@ const bool IVAXIS::loadContent(BinProcessor& proc)
elements_.pop_back();
}
if (proc.mandatory<AxcExt>()) // 4-th place
if (proc.optional<AxcExt>()) // 4-th place
{
m_AxcExt = elements_.back();
elements_.pop_back();
@ -109,7 +109,7 @@ const bool IVAXIS::loadContent(BinProcessor& proc)
m_CatLab = elements_.back();
elements_.pop_back();
}
if (proc.mandatory<AXS>())
if (proc.optional<AXS>())
{
m_AXS = elements_.back();
elements_.pop_back();

View File

@ -32,18 +32,20 @@
#include "PAGESETUP.h"
#include <Logic/Biff_records/Header.h>
#include <Logic/Biff_records/Footer.h>
#include <Logic/Biff_records/HCenter.h>
#include <Logic/Biff_records/VCenter.h>
#include <Logic/Biff_records/LeftMargin.h>
#include <Logic/Biff_records/RightMargin.h>
#include <Logic/Biff_records/TopMargin.h>
#include <Logic/Biff_records/BottomMargin.h>
#include <Logic/Biff_records/Pls.h>
#include <Logic/Biff_records/Continue.h>
#include <Logic/Biff_records/Setup.h>
#include <Logic/Biff_records/HeaderFooter.h>
#include "../Biff_records/Header.h"
#include "../Biff_records/Footer.h"
#include "../Biff_records/HCenter.h"
#include "../Biff_records/VCenter.h"
#include "../Biff_records/LeftMargin.h"
#include "../Biff_records/RightMargin.h"
#include "../Biff_records/TopMargin.h"
#include "../Biff_records/BottomMargin.h"
#include "../Biff_records/Pls.h"
#include "../Biff_records/Continue.h"
#include "../Biff_records/Setup.h"
#include "../Biff_records/HeaderFooter.h"
#include "../Biff_records/HorizontalPageBreaks.h"
#include "../Biff_records/VerticalPageBreaks.h"
namespace XLS
{
@ -135,10 +137,13 @@ const bool PAGESETUP::loadContent(BinProcessor& proc)
elements_.pop_back();
}
}break;
case rt_BottomMargin: proc.optional<BottomMargin>(); break;
case rt_BottomMargin: proc.optional<BottomMargin>(); break;
case rt_TopMargin: proc.optional<TopMargin>(); break;
case rt_LeftMargin: proc.optional<LeftMargin>(); break;
case rt_RightMargin: proc.optional<RightMargin>(); break;
case rt_HorizontalPageBreaks: proc.optional<HorizontalPageBreaks>(); break;
case rt_VerticalPageBreaks: proc.optional<VerticalPageBreaks>(); break;
case rt_Pls:
{
if (proc.optional<Pls>())
@ -238,32 +243,35 @@ int PAGESETUP::serialize(std::wostream & stream)
if (!r) CP_XML_ATTR(L"right" , 0.75);
}
if (setup->iFitHeight > 0 && setup->iFitWidth == 1 && setup->iScale == 100)
if (setup)
{
setup->iScale = 90;
}
if (false == setup->fNoPls)
{
CP_XML_NODE(L"pageSetup")// - для chartsheet аккуратнее
if (setup->iFitHeight > 0 && setup->iFitWidth == 1 && setup->iScale == 100)
{
CP_XML_ATTR(L"paperSize", setup->iPaperSize);
CP_XML_ATTR(L"firstPageNumber", setup->iPageStart);
CP_XML_ATTR(L"scale", setup->iScale);
setup->iScale = 90;
}
CP_XML_ATTR(L"orientation", setup->fPortrait ? L"portrait" : L"landscape");
CP_XML_ATTR(L"horizontalDpi", setup->iRes);
CP_XML_ATTR(L"verticalDpi", setup->iVRes);
if (false == setup->fNoPls)
{
CP_XML_NODE(L"pageSetup")// - для chartsheet аккуратнее
{
CP_XML_ATTR(L"paperSize", setup->iPaperSize);
CP_XML_ATTR(L"firstPageNumber", setup->iPageStart);
CP_XML_ATTR(L"scale", setup->iScale);
if (setup->fUsePage)
CP_XML_ATTR(L"useFirstPageNumber", true);
if (setup->iFitWidth > 0 && setup->iFitWidth < 32767)
CP_XML_ATTR(L"fitToWidth", setup->iFitWidth);
CP_XML_ATTR(L"orientation", setup->fPortrait ? L"portrait" : L"landscape");
CP_XML_ATTR(L"horizontalDpi", setup->iRes);
CP_XML_ATTR(L"verticalDpi", setup->iVRes);
if (setup->iFitHeight > 0 && setup->iFitHeight < 32767)
CP_XML_ATTR(L"fitToHeight", setup->iFitHeight);
if (setup->fUsePage)
CP_XML_ATTR(L"useFirstPageNumber", true);
if (setup->iFitWidth > 0 && setup->iFitWidth < 32767)
CP_XML_ATTR(L"fitToWidth", setup->iFitWidth);
if (setup->iFitHeight > 0 && setup->iFitHeight < 32767)
CP_XML_ATTR(L"fitToHeight", setup->iFitHeight);
}
}
}

View File

@ -134,7 +134,14 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
m_Series = elements_.back();
elements_.pop_back();
proc.mandatory<Begin>(); elements_.pop_back(); //skip
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
if (proc.optional<Begin>()) elements_.pop_back(); //skip
}
else
{
if (proc.mandatory<Begin>()) elements_.pop_back(); //skip
}
count = proc.repeated<AI>(4, 4);
while(count > 0 && elements_.size() > 0)
@ -174,7 +181,7 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
count = elements_.size();
while(count > 0)
{
if ("SerParent" == elements_.front()->getClassName())
if ("SerParent" == elements_.front()->getClassName())
m_SerParent = elements_.front();
else if ("SerToCrt" == elements_.front()->getClassName())
m_SerToCrt = elements_.front();
@ -224,7 +231,14 @@ const bool SERIESFORMAT::loadContent(BinProcessor& proc)
m_SeriesEx.push_back(ex);
}
if (proc.mandatory<End>()) elements_.pop_back(); //skip
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
if (proc.optional<End>()) elements_.pop_back(); //skip
}
else
{
if (proc.mandatory<End>()) elements_.pop_back(); //skip
}
return true;
}

View File

@ -113,9 +113,18 @@ const bool SS::loadContent(BinProcessor& proc)
m_DataFormat = elements_.back();
elements_.pop_back();
if (proc.mandatory<Begin>())
bool bRead = false;
if (proc.getGlobalWorkbookInfo()->Version < 0x0600)
{
bRead = true;
}
if (proc.optional<Begin>()) //при biff5 может быть или нет, biff8 - обязано быть
{
bRead = true;
elements_.pop_back();
}
if (bRead)
{
while (true)
{
CFRecordType::TypeId type = proc.getNextRecordType();

View File

@ -70,6 +70,7 @@
#include "Biff_records/Chart.h"
#include "Biff_records/ExternSheet.h"
#include "Biff_records/FrtFontList.h"
#include "Biff_records/ChartFrtInfo.h"
#include "Biff_unions/FONTLIST.h"
#include "Biff_unions/PAGESETUP.h"
@ -142,7 +143,7 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{
CFRecordType::TypeId type = proc.getNextRecordType();
//Log::warning(CFRecordType::getStringById(type));
Log::warning(CFRecordType::getStringById(type));
if (type == rt_NONE || type == rt_BOF ) break;
if (type == rt_EOF)
@ -385,7 +386,11 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
count--;
}
}break;
case rt_ChartFrtInfo:
{
//skipped record
count = proc.repeated<ChartFrtInfo>(0, 0);
}break;
default://unknown .... skip
{
proc.SkipRecord();

View File

@ -150,6 +150,12 @@ public:
unsigned int startAddedSharedStrings;
std::vector<std::wstring> arAddedSharedStrings;
struct _row_info
{
BaseObjectPtr row_info;
std::map<int, BaseObjectPtr> mapCells;
};
struct _sheet_info
{
@ -161,6 +167,8 @@ public:
double defaultColumnWidth = 8.0;
double defaultRowHeight = 14.4;
std::map<int, _row_info> mapRows;
};
std::vector<_sheet_info> sheets_info;
std::vector<std::wstring> external_sheets_info; //current

View File

@ -187,6 +187,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
case rt_TopMargin:
case rt_LeftMargin:
case rt_RightMargin:
case rt_Setup:
{
if (proc.mandatory<PAGESETUP>())
{
@ -238,10 +239,15 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
case rt_Label://file(6).xls
case rt_Row:
{
CELLTABLE cell_table(shared_formulas_locations);
if (proc.optional(cell_table))
CELLTABLE cell_table_temlate(shared_formulas_locations);
if (proc.optional(cell_table_temlate))
{
m_CELLTABLE = elements_.back();
if (m_CELLTABLE)
{//Daily Flash Report - Demand_Store_427.xls
CELLTABLE *cell_table = dynamic_cast<CELLTABLE*>(elements_.back().get());
cell_table->isConcatinate_ = true;
}
m_CELLTABLE = elements_.back(); //пофиг какой тут элемент - данные вынесены во вне
elements_.pop_back();
}
if(0 != shared_formulas_locations.size())
@ -258,13 +264,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
case rt_Obj:
case rt_MsoDrawing:
{
OBJECTS objects(false);
if (proc.optional(objects))
OBJECTS objects_template(false);
if (proc.optional(objects_template))
{
if (!m_OBJECTS) m_OBJECTS = elements_.back();
else
{
Log::warning(L"Double set OBJECTS!!!");
OBJECTS *objects = dynamic_cast<OBJECTS*>(elements_.back().get());
OBJECTS *prev_objects = dynamic_cast<OBJECTS*>(m_OBJECTS.get());
prev_objects->elements_.insert(prev_objects->elements_.end(), objects->elements_.begin(), objects->elements_.end());
}
elements_.pop_back();
}

View File

@ -2794,14 +2794,14 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case Formula: return _T("formula"); break;
case Maximum: return _T("min"); break;
case Minimum: return _T("max"); break;
case Number: return _T("num"); break;
case Percent: return _T("percent"); break;
case Percentile:return _T("percentile"); break;
case autoMin: return _T("autoMin"); break;
case autoMax: return _T("autoMax"); break;
case Formula: return _T("formula");
case Maximum: return _T("max");
case Minimum: return _T("min");
case Number: return _T("num");
case Percent: return _T("percent");
case Percentile:return _T("percentile");
case autoMin: return _T("autoMin");
case autoMax: return _T("autoMax");
default : return _T("num");
}
}

View File

@ -94,7 +94,15 @@ void CConditionalFormatValueObject::toXML2(NSStringUtils::CStringBuilder& writer
}
if (!bExtendedWrite)
{
WritingStringNullableAttrEncodeXmlString(L"val", m_oVal, m_oVal.get());
if (m_oVal.IsInit())
{
WritingStringNullableAttrEncodeXmlString(L"val", m_oVal, m_oVal.get());
}
else if (m_oFormula.IsInit())
{
WritingStringAttrString(L"val", m_oFormula->m_sText);
}
}
writer.WriteString(L">");

View File

@ -199,32 +199,28 @@ namespace OOX
{
m_oRef = sRef;
}
void getRowCol(int& nRow, int& nCol) const
bool getRowCol(int& nRow, int& nCol) const
{
bool bRes = false;
nRow = 0;
nCol = 0;
if (m_oRef.IsInit())
{
if (parseRef(m_oRef.get(), nRow, nCol))
{
bRes = true;
nRow--;
nCol--;
}
else
{
nRow = 0;
nCol = 0;
}
}
else if (m_oRow.IsInit() && m_oCol.IsInit())
{
bRes = true;
nRow = m_oRow->GetValue();
nCol = m_oCol->GetValue();
}
else
{
nRow = 0;
nCol = 0;
}
return bRes;
}
void setRowCol(int nRow, int nCol)
{

View File

@ -506,7 +506,7 @@ namespace ZLibZipUtils
/*========================================================================================================*/
int oneZipFile(zipFile & zf, zip_fileinfo & zi, std::wstring & file_name, std::wstring & zip_file_name, int method, int compressionLevel)
int oneZipFile(zipFile & zf, zip_fileinfo* zi, std::wstring & file_name, std::wstring & zip_file_name, int method, int compressionLevel)
{
int err = -1;
@ -518,7 +518,7 @@ int oneZipFile(zipFile & zf, zip_fileinfo & zi, std::wstring & file_name, std::w
if(oFile.ReadFile(pData, oFile.GetFileSize(), dwSizeRead))
{
std::string zipFileNameA = codepage_issue_fixToOEM(zip_file_name);
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zi, NULL, 0, NULL, 0, NULL, method, compressionLevel );
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), zi, NULL, 0, NULL, 0, NULL, method, compressionLevel );
err = zipWriteInFileInZip( zf, pData, dwSizeRead );
err = zipCloseFileInZip( zf );
}
@ -541,27 +541,6 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
zipFile zf = zipOpenHelp(outputFile);
zip_fileinfo zi;
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
zi.dosDate = 0;
zi.internal_fa = 0;
zi.external_fa = 0;
#if defined(_WIN32) || defined (_WIN64)
SYSTEMTIME currTime;
GetLocalTime( &currTime );
zi.tmz_date.tm_sec = currTime.wSecond;
zi.tmz_date.tm_min = currTime.wMinute;
zi.tmz_date.tm_hour = currTime.wHour;
zi.tmz_date.tm_mday = currTime.wDay;
zi.tmz_date.tm_mon = currTime.wMonth;
zi.tmz_date.tm_year = currTime.wYear;
#endif
unsigned int filesCount = get_files_count( dir );
unsigned int currentFileIndex = 0;
@ -599,7 +578,7 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
file = NSSystemPath::Combine(szText, cFileName);
zipFileName = zipDir + cFileName;
oneZipFile(zf, zi, file, zipFileName, 0, compressionLevel);
oneZipFile(zf, NULL, file, zipFileName, 0, compressionLevel);
aCurFiles.erase(aCurFiles.begin() + i, aCurFiles.begin() + i + 1);
break;
@ -612,7 +591,7 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
file = NSSystemPath::Combine(szText, cFileName);
zipFileName = zipDir + cFileName;
oneZipFile(zf, zi, file, zipFileName, method, compressionLevel);
oneZipFile(zf, NULL, file, zipFileName, method, compressionLevel);
if ( progress != NULL )
{
@ -660,27 +639,6 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
{
zipFile zf = zipOpenHelp(outputFile);
zip_fileinfo zi;
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
zi.dosDate = 0;
zi.internal_fa = 0;
zi.external_fa = 0;
#if defined(_WIN32) || defined (_WIN64)
SYSTEMTIME currTime;
GetLocalTime( &currTime );
zi.tmz_date.tm_sec = currTime.wSecond;
zi.tmz_date.tm_min = currTime.wMinute;
zi.tmz_date.tm_hour = currTime.wHour;
zi.tmz_date.tm_mday = currTime.wDay;
zi.tmz_date.tm_mon = currTime.wMonth;
zi.tmz_date.tm_year = currTime.wYear;
#endif
wstring inputFileName( inputFile );
wstring::size_type pos = 0;
@ -699,7 +657,7 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
zipFileName = wstring( inputFileName.begin(), inputFileName.end() );
}
std::string zipFileNameA = codepage_issue_fixToOEM(zipFileName);
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zi, NULL, 0, NULL, 0, NULL, method, compressionLevel );
err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), NULL, NULL, 0, NULL, 0, NULL, method, compressionLevel );
err = zipWriteInFileInZip( zf, pData, dwSizeRead );
err = zipCloseFileInZip( zf );
err = zipClose( zf, NULL );
@ -929,25 +887,13 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
if(NULL != zip_file_handle)
{
zip_fileinfo zi = {0};
#if defined(_WIN32) || defined (_WIN64)
SYSTEMTIME currTime;
GetLocalTime( &currTime );
zi.tmz_date.tm_sec = currTime.wSecond;
zi.tmz_date.tm_min = currTime.wMinute;
zi.tmz_date.tm_hour = currTime.wHour;
zi.tmz_date.tm_mday = currTime.wDay;
zi.tmz_date.tm_mon = currTime.wMonth;
zi.tmz_date.tm_year = currTime.wYear;
#endif
BYTE* pData = NULL;
long nSize;
std::wstring in_zip_filename;
while(callback(in_zip_filename, pData, nSize, pParam))
{
std::string in_zip_filenameA = codepage_issue_fixToOEM(in_zip_filename);
if (ZIP_OK != zipOpenNewFileInZip( zip_file_handle, in_zip_filenameA.c_str(), &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, compression_level ) ||
if (ZIP_OK != zipOpenNewFileInZip( zip_file_handle, in_zip_filenameA.c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, compression_level ) ||
ZIP_OK != zipWriteInFileInZip(zip_file_handle, pData, nSize) ||
ZIP_OK != zipCloseFileInZip(zip_file_handle))
{

View File

@ -2963,12 +2963,10 @@ void BinaryWorksheetTableWriter::WriteCell(const OOX::Spreadsheet::CCell& oCell)
{
int nCurPos;
//Ref
if (oCell.isInitRef())
int nRow = 0;
int nCol = 0;
if (oCell.isInitRef() && oCell.getRowCol(nRow, nCol))
{
int nRow = 0;
int nCol = 0;
oCell.getRowCol(nRow, nCol);
// Пишем теперь не строку, а 2 числа (чтобы не парсить на JavaScript, т.к. на C++ быстрее парсинг). Ускорение открытия файла.
nCurPos = m_oBcw.WriteItemStart(c_oSerCellTypes::RefRowCol);
m_oBcw.m_oStream.WriteLONG(nRow);

View File

@ -234,9 +234,8 @@ namespace CSVWriter
INT nRowTmp = 0;
INT nCol = 0;
if (pCell->isInitRef())
if (pCell->isInitRef() && pCell->getRowCol(nRowTmp, nCol))
{
pCell->getRowCol(nRowTmp, nCol);
nRowTmp++;
nCol++;
}