Commit d371c284 authored by Ilya Kirillov's avatar Ilya Kirillov

Исправлен баг с компиляцией стиля ячейки у первого столбца таблицы.

parent 68c68375
...@@ -6961,6 +6961,24 @@ CTableCellPr.prototype = ...@@ -6961,6 +6961,24 @@ CTableCellPr.prototype =
this.NoWrap = Reader.GetBool(); this.NoWrap = Reader.GetBool();
} }
}; };
CTableCellPr.prototype.Is_Empty = function()
{
if (undefined !== this.GridSpan
|| undefined !== this.Shd
|| undefined !== this.TableCellMar
|| undefined !== this.TableCellBorders.Bottom
|| undefined !== this.TableCellBorders.Left
|| undefined !== this.TableCellBorders.Right
|| undefined !== this.TableCellBorders.Top
|| undefined !== this.TableCellW
|| undefined !== this.VAlign
|| undefined !== this.VMerge
|| undefined !== this.TextDirection
|| undefined !== this.NoWrap)
return false;
return true;
};
function CRFonts() function CRFonts()
{ {
...@@ -7232,6 +7250,17 @@ CRFonts.prototype = ...@@ -7232,6 +7250,17 @@ CRFonts.prototype =
return true; return true;
} }
}; };
CRFonts.prototype.Is_Empty = function()
{
if (undefined !== this.Ascii
|| undefined !== this.EastAsia
|| undefined !== this.HAnsi
|| undefined !== this.CS
|| undefined !== this.Hint)
return false;
return true;
};
function CLang() function CLang()
{ {
...@@ -7349,6 +7378,15 @@ CLang.prototype = ...@@ -7349,6 +7378,15 @@ CLang.prototype =
return true; return true;
} }
}; };
CLang.prototype.Is_Empty = function()
{
if (undefined !== this.Bidi
|| undefined !== this.EastAsia
|| undefined !== this.Val)
return false;
return true;
};
function CTextPr() function CTextPr()
{ {
...@@ -8747,6 +8785,40 @@ CTextPr.prototype = ...@@ -8747,6 +8785,40 @@ CTextPr.prototype =
return Description; return Description;
} }
}; };
CTextPr.prototype.Is_Empty = function()
{
if (undefined !== this.Bold
|| undefined !== this.Italic
|| undefined !== this.Strikeout
|| undefined !== this.Underline
|| undefined !== this.FontFamily
|| undefined !== this.FontSize
|| undefined !== this.Color
|| undefined !== this.VertAlign
|| undefined !== this.HighLight
|| undefined !== this.RStyle
|| undefined !== this.Spacing
|| undefined !== this.DStrikeout
|| undefined !== this.Caps
|| undefined !== this.SmallCaps
|| undefined !== this.Position
|| true !== this.RFonts.Is_Empty()
|| undefined !== this.BoldCS
|| undefined !== this.ItalicCS
|| undefined !== this.FontSizeCS
|| undefined !== this.CS
|| undefined !== this.RTL
|| true !== this.Lang.Is_Empty()
|| undefined !== this.Unifill
|| undefined !== this.FontRef
|| undefined !== this.Shd
|| undefined !== this.Vanish
|| undefined !== this.TextOutline
|| undefined !== this.TextFill)
return false;
return true;
};
CTextPr.prototype.Get_Bold = function() CTextPr.prototype.Get_Bold = function()
{ {
return this.Bold; return this.Bold;
...@@ -9120,6 +9192,15 @@ CParaInd.prototype = ...@@ -9120,6 +9192,15 @@ CParaInd.prototype =
this.FirstLine = Reader.GetDouble(); this.FirstLine = Reader.GetDouble();
} }
}; };
CParaInd.prototype.Is_Empty = function()
{
if (undefined !== this.Left
|| undefined !== this.Right
|| undefined !== this.FirstLine)
return false;
return true;
};
CParaInd.prototype.Get_Diff = function(Ind) CParaInd.prototype.Get_Diff = function(Ind)
{ {
var DiffInd = new CParaInd(); var DiffInd = new CParaInd();
...@@ -9299,6 +9380,18 @@ CParaSpacing.prototype.Get_Diff = function(Spacing) ...@@ -9299,6 +9380,18 @@ CParaSpacing.prototype.Get_Diff = function(Spacing)
return DiffSpacing; return DiffSpacing;
}; };
CParaSpacing.prototype.Is_Empty = function()
{
if (undefined !== this.Line
|| undefined !== this.LineRule
|| undefined !== this.Before
|| undefined !== this.BeforeAutoSpacing
|| undefined !== this.After
|| undefined !== this.AfterAutoSpacing)
return false;
return true;
};
function CNumPr() function CNumPr()
{ {
...@@ -10497,6 +10590,31 @@ CParaPr.prototype = ...@@ -10497,6 +10590,31 @@ CParaPr.prototype =
delete this.ReviewInfo; delete this.ReviewInfo;
} }
}; };
CParaPr.prototype.Is_Empty = function()
{
if (undefined !== this.ContextualSpacing
|| true !== this.Ind.Is_Empty()
|| undefined !== this.Jc
|| undefined !== this.KeepLines
|| undefined !== this.KeepNext
|| undefined !== this.PageBreakBefore
|| true !== this.Spacing.Is_Empty()
|| undefined !== this.Shd
|| undefined !== this.Brd.First
|| undefined !== this.Brd.Last
|| undefined !== this.Brd.Between
|| undefined !== this.Brd.Bottom
|| undefined !== this.Brd.Left
|| undefined !== this.Brd.Right
|| undefined !== this.Brd.Top
|| undefined !== this.WidowControl
|| undefined !== this.Tabs
|| undefined !== this.NumPr
|| undefined !== this.PStyle)
return false;
return true;
};
CParaPr.prototype.Get_DiffPrChange = function() CParaPr.prototype.Get_DiffPrChange = function()
{ {
var ParaPr = new CParaPr(); var ParaPr = new CParaPr();
......
...@@ -277,7 +277,7 @@ CTableCell.prototype = ...@@ -277,7 +277,7 @@ CTableCell.prototype =
if ( true === TableLook.Is_BandHor() ) if ( true === TableLook.Is_BandHor() )
{ {
var RowBandSize = TablePr.TablePr.TableStyleRowBandSize; var RowBandSize = TablePr.TablePr.TableStyleRowBandSize;
var __RowIndex = ( true != TableLook.Is_FirstRow() ? RowIndex : RowIndex - 1 ) var __RowIndex = ( true != TableLook.Is_FirstRow() ? RowIndex : RowIndex - 1 );
var _RowIndex = ( 1 != RowBandSize ? Math.floor( __RowIndex / RowBandSize ) : __RowIndex ); var _RowIndex = ( 1 != RowBandSize ? Math.floor( __RowIndex / RowBandSize ) : __RowIndex );
var TableBandStyle = null; var TableBandStyle = null;
if ( 0 === _RowIndex % 2 ) if ( 0 === _RowIndex % 2 )
...@@ -290,24 +290,40 @@ CTableCell.prototype = ...@@ -290,24 +290,40 @@ CTableCell.prototype =
ParaPr.Merge( TableBandStyle.ParaPr ); ParaPr.Merge( TableBandStyle.ParaPr );
} }
// Совместим с настройками для групп колонок // Совместим с настройками для групп колонок
// Согласно спецификации DOCX, совмещать надо всегда, но для первой и последней колонок Word // Согласно спецификации DOCX, совмещать надо всегда. Word проверяет наличие первой колонки не только
// не совмещает, поэтому делаем также. // через флаг TableLook.Is_FirstCol(), но и самим наличием непустого стиля для первой колонки.
if ( true === TableLook.Is_BandVer() && !( (true === TableLook.Is_LastCol() && this.Row.Get_CellsCount() - 1 === CellIndex) || (true === TableLook.Is_FirstCol() && 0 === CellIndex) ) ) if (true === TableLook.Is_BandVer())
{ {
var ColBandSize = TablePr.TablePr.TableStyleColBandSize; var bFirstCol = false;
var _ColIndex = ( true != TableLook.Is_FirstCol() ? CellIndex : CellIndex - 1 ) if (true === TableLook.Is_FirstCol())
var ColIndex = ( 1 != ColBandSize ? Math.floor( _ColIndex / ColBandSize ) : _ColIndex ); {
var TableBandStyle = null; var oTableStyle = this.Get_Styles().Get(this.Row.Table.Get_TableStyle());
if ( 0 === ColIndex % 2 ) if (oTableStyle && styletype_Table === oTableStyle.Get_Type() && oTableStyle.TableFirstCol)
TableBandStyle = TablePr.TableBand1Vert; {
else var oCondStyle = oTableStyle.TableFirstCol;
TableBandStyle = TablePr.TableBand2Vert; if (true !== oCondStyle.TableCellPr.Is_Empty()
|| true !== oCondStyle.ParaPr.Is_Empty()
CellPr.Merge( TableBandStyle.TableCellPr ); || true !== oCondStyle.TextPr.Is_Empty())
TextPr.Merge( TableBandStyle.TextPr ); {
ParaPr.Merge( TableBandStyle.ParaPr ); bFirstCol = true;
} }
}
}
var ColBandSize = TablePr.TablePr.TableStyleColBandSize;
var _ColIndex = ( true != bFirstCol ? CellIndex : CellIndex - 1 );
var ColIndex = ( 1 != ColBandSize ? Math.floor(_ColIndex / ColBandSize) : _ColIndex );
var TableBandStyle = null;
if (0 === ColIndex % 2)
TableBandStyle = TablePr.TableBand1Vert;
else
TableBandStyle = TablePr.TableBand2Vert;
CellPr.Merge(TableBandStyle.TableCellPr);
TextPr.Merge(TableBandStyle.TextPr);
ParaPr.Merge(TableBandStyle.ParaPr);
}
// Совместим настройки с настройками для последней колонки // Совместим настройки с настройками для последней колонки
......
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