Commit 5820ae37 authored by Ilya Kirillov's avatar Ilya Kirillov Committed by Alexander.Trofimov

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

parent 162bcaf4
......@@ -264,6 +264,7 @@ CTable.prototype =
var Border_insideV = null;
var CellShd = null;
var CellWidth = undefined;
var Prev_row = -1;
var bFirstRow = true;
......@@ -280,6 +281,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 )
{
......@@ -309,6 +311,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 )
{
......@@ -418,6 +436,7 @@ CTable.prototype =
Pr.CellsVAlign = VAlign;
Pr.CellsTextDirection = TextDirection;
Pr.CellsNoWrap = NoWrap;
Pr.CellsWidth = CellWidth;
Pr.CellBorders =
{
......@@ -465,6 +484,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() )
{
......@@ -491,6 +511,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 )
......@@ -1911,6 +1937,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;
},
......
"use strict";
"use strict";
function CAscSection()
{
......@@ -4115,6 +4115,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
......@@ -4199,6 +4200,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)
{
......
......@@ -661,6 +661,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