Commit 4f9419af authored by Ilya Kirillov's avatar Ilya Kirillov

Сделано, чтобы можно было получать и выставлять ширины ячеек.

parent 5ef1d92a
......@@ -288,6 +288,7 @@ CTable.prototype =
var Border_insideV = null;
var CellShd = null;
var CellWidth = undefined;
var Prev_row = -1;
var bFirstRow = true;
......@@ -304,6 +305,7 @@ CTable.prototype =
var Cell_borders = Cell.Get_Borders();
var Cell_margins = Cell.Get_Margins();
var Cell_shd = Cell.Get_Shd();
var Cell_w = Cell.Get_W();
if ( 0 === Index )
{
......@@ -333,6 +335,22 @@ CTable.prototype =
CellShd = null;
}
if (0 === Index)
{
if (tblwidth_Auto === Cell_w.Type)
CellWidth = null;
else if (tblwidth_Mm === Cell_w.Type)
CellWidth = Cell_w.W;
else// if (tblwidth_Pct === Cell_w.Type)
CellWidth = -Cell_w.W;
}
else
{
if ((tblwidth_Auto === Cell_w.Type && null !== CellWidth)
|| (undefined === CellWidth || null === CellWidth || Math.abs(CellWidth - Cell_w.W) > 0.001))
CellWidth = undefined;
}
// Крайняя левая ли данная ячейка в выделении?
if ( 0 === Index || this.Selection.Data[Index - 1].Row != Pos.Row )
{
......@@ -442,6 +460,7 @@ CTable.prototype =
Pr.CellsVAlign = VAlign;
Pr.CellsTextDirection = TextDirection;
Pr.CellsNoWrap = NoWrap;
Pr.CellsWidth = CellWidth;
Pr.CellBorders =
{
......@@ -489,6 +508,7 @@ CTable.prototype =
var CellMargins = Cell.Get_Margins();
var CellBorders = Cell.Get_Borders();
var CellShd = Cell.Get_Shd();
var CellW = Cell.Get_W();
if ( true === Cell.Is_TableMargins() )
{
......@@ -515,6 +535,12 @@ CTable.prototype =
Pr.CellsBackground = CellShd.Copy();
if (tblwidth_Auto === CellW.Type)
Pr.CellsWidth = null;
else if (tblwidth_Mm === CellW.Type)
Pr.CellsWidth = CellW.W;
else// if (tblwidth_Pct === CellW.Type)
Pr.CellsWidth = -CellW.W;
var Spacing = this.Content[0].Get_CellSpacing();
if ( null === Spacing )
......@@ -1935,6 +1961,36 @@ CTable.prototype =
}
}
// CellsWidth
if (undefined !== Props.CellsWidth)
{
if (this.Selection.Use === true && table_Selection_Cell === this.Selection.Type)
{
var Count = this.Selection.Data.length;
for (var Index = 0; Index < Count; ++Index)
{
var Pos = this.Selection.Data[Index];
var Cell = this.Content[Pos.Row].Get_Cell(Pos.Cell);
if (null === Props.CellsWidth)
Cell.Set_W(new CTableMeasurement(tblwidth_Auto, 0));
else if (Props.CellsWidth > -0.001)
Cell.Set_W(new CTableMeasurement(tblwidth_Mm, Props.CellsWidth));
else
Cell.Set_W(new CTableMeasurement(tblwidth_Pct, Math.abs(Props.CellsWidth)));
}
}
else
{
if (null === Props.CellsWidth)
this.CurCell.Set_W(new CTableMeasurement(tblwidth_Auto, 0));
else if (Props.CellsWidth > -0.001)
this.CurCell.Set_W(new CTableMeasurement(tblwidth_Mm, Props.CellsWidth));
else
this.CurCell.Set_W(new CTableMeasurement(tblwidth_Pct, Math.abs(Props.CellsWidth)));
}
}
return true;
},
......
/*
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
......@@ -4139,6 +4139,7 @@ function CTableProp (tblProp)
this.TableLayout = tblProp.TableLayout;
this.CellsTextDirection = tblProp.CellsTextDirection;
this.CellsNoWrap = tblProp.CellsNoWrap;
this.CellsWidth = tblProp.CellsWidth;
this.Locked = (undefined != tblProp.Locked) ? tblProp.Locked : false;
}
else
......@@ -4223,6 +4224,9 @@ CTableProp.prototype.get_CellsTextDirection = function(){return this.CellsTextDi
CTableProp.prototype.put_CellsTextDirection = function(v){this.CellsTextDirection = v;};
CTableProp.prototype.get_CellsNoWrap = function(){return this.CellsNoWrap;};
CTableProp.prototype.put_CellsNoWrap = function(v){this.CellsNoWrap = v;};
CTableProp.prototype.get_CellsWidth = function (){return this.CellsWidth;};
CTableProp.prototype.put_CellsWidth = function (v){this.CellsWidth = v;};
function CBorders (obj)
{
......
......@@ -685,6 +685,8 @@ CTableProp.prototype['get_CellsTextDirection'] = CTableProp.prototype.get_CellsT
CTableProp.prototype['put_CellsTextDirection'] = CTableProp.prototype.put_CellsTextDirection;
CTableProp.prototype['get_CellsNoWrap'] = CTableProp.prototype.get_CellsNoWrap;
CTableProp.prototype['put_CellsNoWrap'] = CTableProp.prototype.put_CellsNoWrap;
CTableProp.prototype['get_CellsWidth'] = CTableProp.prototype.get_CellsWidth;
CTableProp.prototype['put_CellsWidth'] = CTableProp.prototype.put_CellsWidth;
window['CBorders'] = CBorders;
CBorders.prototype['get_Left'] = CBorders.prototype.get_Left;
......
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