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

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

parent 5ef1d92a
......@@ -287,7 +287,8 @@ CTable.prototype =
var Border_insideH = null;
var Border_insideV = null;
var CellShd = null;
var CellShd = null;
var CellWidth = undefined;
var Prev_row = -1;
var bFirstRow = true;
......@@ -300,10 +301,11 @@ CTable.prototype =
{
var Pos = this.Selection.Data[Index];
var Row = this.Content[Pos.Row];
var Cell = Row.Get_Cell( Pos.Cell );
var Cell = Row.Get_Cell( Pos.Cell );
var Cell_borders = Cell.Get_Borders();
var Cell_margins = Cell.Get_Margins();
var Cell_shd = Cell.Get_Shd();
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)
{
......
......@@ -631,60 +631,62 @@ CTablePropLook.prototype['put_BandHor'] = CTablePropLook.prototype.put_BandHor;
CTablePropLook.prototype['get_BandVer'] = CTablePropLook.prototype.get_BandVer;
CTablePropLook.prototype['put_BandVer'] = CTablePropLook.prototype.put_BandVer;
window['CTableProp'] = CTableProp;
CTableProp.prototype['get_Width'] = CTableProp.prototype.get_Width;
CTableProp.prototype['put_Width'] = CTableProp.prototype.put_Width;
CTableProp.prototype['get_Spacing'] = CTableProp.prototype.get_Spacing;
CTableProp.prototype['put_Spacing'] = CTableProp.prototype.put_Spacing;
CTableProp.prototype['get_DefaultMargins'] = CTableProp.prototype.get_DefaultMargins;
CTableProp.prototype['put_DefaultMargins'] = CTableProp.prototype.put_DefaultMargins;
CTableProp.prototype['get_CellMargins'] = CTableProp.prototype.get_CellMargins;
CTableProp.prototype['put_CellMargins'] = CTableProp.prototype.put_CellMargins;
CTableProp.prototype['get_TableAlignment'] = CTableProp.prototype.get_TableAlignment;
CTableProp.prototype['put_TableAlignment'] = CTableProp.prototype.put_TableAlignment;
CTableProp.prototype['get_TableIndent'] = CTableProp.prototype.get_TableIndent;
CTableProp.prototype['put_TableIndent'] = CTableProp.prototype.put_TableIndent;
CTableProp.prototype['get_TableWrap'] = CTableProp.prototype.get_TableWrap;
CTableProp.prototype['put_TableWrap'] = CTableProp.prototype.put_TableWrap;
CTableProp.prototype['get_TablePaddings'] = CTableProp.prototype.get_TablePaddings;
CTableProp.prototype['put_TablePaddings'] = CTableProp.prototype.put_TablePaddings;
CTableProp.prototype['get_TableBorders'] = CTableProp.prototype.get_TableBorders;
CTableProp.prototype['put_TableBorders'] = CTableProp.prototype.put_TableBorders;
CTableProp.prototype['get_CellBorders'] = CTableProp.prototype.get_CellBorders;
CTableProp.prototype['put_CellBorders'] = CTableProp.prototype.put_CellBorders;
CTableProp.prototype['get_TableBackground'] = CTableProp.prototype.get_TableBackground;
CTableProp.prototype['put_TableBackground'] = CTableProp.prototype.put_TableBackground;
CTableProp.prototype['get_CellsBackground'] = CTableProp.prototype.get_CellsBackground;
CTableProp.prototype['put_CellsBackground'] = CTableProp.prototype.put_CellsBackground;
CTableProp.prototype['get_Position'] = CTableProp.prototype.get_Position;
CTableProp.prototype['put_Position'] = CTableProp.prototype.put_Position;
CTableProp.prototype['get_PositionH'] = CTableProp.prototype.get_PositionH;
CTableProp.prototype['put_PositionH'] = CTableProp.prototype.put_PositionH;
CTableProp.prototype['get_PositionV'] = CTableProp.prototype.get_PositionV;
CTableProp.prototype['put_PositionV'] = CTableProp.prototype.put_PositionV;
CTableProp.prototype['get_Value_X'] = CTableProp.prototype.get_Value_X;
CTableProp.prototype['get_Value_Y'] = CTableProp.prototype.get_Value_Y;
CTableProp.prototype['get_ForSelectedCells'] = CTableProp.prototype.get_ForSelectedCells;
CTableProp.prototype['put_ForSelectedCells'] = CTableProp.prototype.put_ForSelectedCells;
CTableProp.prototype['put_CellSelect'] = CTableProp.prototype.put_CellSelect;
CTableProp.prototype['get_CellSelect'] = CTableProp.prototype.get_CellSelect;
CTableProp.prototype['get_CanBeFlow'] = CTableProp.prototype.get_CanBeFlow;
CTableProp.prototype['get_RowsInHeader'] = CTableProp.prototype.get_RowsInHeader;
CTableProp.prototype['put_RowsInHeader'] = CTableProp.prototype.put_RowsInHeader;
CTableProp.prototype['get_Locked'] = CTableProp.prototype.get_Locked;
CTableProp.prototype['get_CellsVAlign'] = CTableProp.prototype.get_CellsVAlign;
CTableProp.prototype['put_CellsVAlign'] = CTableProp.prototype.put_CellsVAlign;
CTableProp.prototype['get_TableLook'] = CTableProp.prototype.get_TableLook;
CTableProp.prototype['put_TableLook'] = CTableProp.prototype.put_TableLook;
CTableProp.prototype['get_TableStyle'] = CTableProp.prototype.get_TableStyle;
CTableProp.prototype['put_TableStyle'] = CTableProp.prototype.put_TableStyle;
CTableProp.prototype['get_AllowOverlap'] = CTableProp.prototype.get_AllowOverlap;
CTableProp.prototype['put_AllowOverlap'] = CTableProp.prototype.put_AllowOverlap;
CTableProp.prototype['get_TableLayout'] = CTableProp.prototype.get_TableLayout;
CTableProp.prototype['put_TableLayout'] = CTableProp.prototype.put_TableLayout;
CTableProp.prototype['get_Width'] = CTableProp.prototype.get_Width;
CTableProp.prototype['put_Width'] = CTableProp.prototype.put_Width;
CTableProp.prototype['get_Spacing'] = CTableProp.prototype.get_Spacing;
CTableProp.prototype['put_Spacing'] = CTableProp.prototype.put_Spacing;
CTableProp.prototype['get_DefaultMargins'] = CTableProp.prototype.get_DefaultMargins;
CTableProp.prototype['put_DefaultMargins'] = CTableProp.prototype.put_DefaultMargins;
CTableProp.prototype['get_CellMargins'] = CTableProp.prototype.get_CellMargins;
CTableProp.prototype['put_CellMargins'] = CTableProp.prototype.put_CellMargins;
CTableProp.prototype['get_TableAlignment'] = CTableProp.prototype.get_TableAlignment;
CTableProp.prototype['put_TableAlignment'] = CTableProp.prototype.put_TableAlignment;
CTableProp.prototype['get_TableIndent'] = CTableProp.prototype.get_TableIndent;
CTableProp.prototype['put_TableIndent'] = CTableProp.prototype.put_TableIndent;
CTableProp.prototype['get_TableWrap'] = CTableProp.prototype.get_TableWrap;
CTableProp.prototype['put_TableWrap'] = CTableProp.prototype.put_TableWrap;
CTableProp.prototype['get_TablePaddings'] = CTableProp.prototype.get_TablePaddings;
CTableProp.prototype['put_TablePaddings'] = CTableProp.prototype.put_TablePaddings;
CTableProp.prototype['get_TableBorders'] = CTableProp.prototype.get_TableBorders;
CTableProp.prototype['put_TableBorders'] = CTableProp.prototype.put_TableBorders;
CTableProp.prototype['get_CellBorders'] = CTableProp.prototype.get_CellBorders;
CTableProp.prototype['put_CellBorders'] = CTableProp.prototype.put_CellBorders;
CTableProp.prototype['get_TableBackground'] = CTableProp.prototype.get_TableBackground;
CTableProp.prototype['put_TableBackground'] = CTableProp.prototype.put_TableBackground;
CTableProp.prototype['get_CellsBackground'] = CTableProp.prototype.get_CellsBackground;
CTableProp.prototype['put_CellsBackground'] = CTableProp.prototype.put_CellsBackground;
CTableProp.prototype['get_Position'] = CTableProp.prototype.get_Position;
CTableProp.prototype['put_Position'] = CTableProp.prototype.put_Position;
CTableProp.prototype['get_PositionH'] = CTableProp.prototype.get_PositionH;
CTableProp.prototype['put_PositionH'] = CTableProp.prototype.put_PositionH;
CTableProp.prototype['get_PositionV'] = CTableProp.prototype.get_PositionV;
CTableProp.prototype['put_PositionV'] = CTableProp.prototype.put_PositionV;
CTableProp.prototype['get_Value_X'] = CTableProp.prototype.get_Value_X;
CTableProp.prototype['get_Value_Y'] = CTableProp.prototype.get_Value_Y;
CTableProp.prototype['get_ForSelectedCells'] = CTableProp.prototype.get_ForSelectedCells;
CTableProp.prototype['put_ForSelectedCells'] = CTableProp.prototype.put_ForSelectedCells;
CTableProp.prototype['put_CellSelect'] = CTableProp.prototype.put_CellSelect;
CTableProp.prototype['get_CellSelect'] = CTableProp.prototype.get_CellSelect;
CTableProp.prototype['get_CanBeFlow'] = CTableProp.prototype.get_CanBeFlow;
CTableProp.prototype['get_RowsInHeader'] = CTableProp.prototype.get_RowsInHeader;
CTableProp.prototype['put_RowsInHeader'] = CTableProp.prototype.put_RowsInHeader;
CTableProp.prototype['get_Locked'] = CTableProp.prototype.get_Locked;
CTableProp.prototype['get_CellsVAlign'] = CTableProp.prototype.get_CellsVAlign;
CTableProp.prototype['put_CellsVAlign'] = CTableProp.prototype.put_CellsVAlign;
CTableProp.prototype['get_TableLook'] = CTableProp.prototype.get_TableLook;
CTableProp.prototype['put_TableLook'] = CTableProp.prototype.put_TableLook;
CTableProp.prototype['get_TableStyle'] = CTableProp.prototype.get_TableStyle;
CTableProp.prototype['put_TableStyle'] = CTableProp.prototype.put_TableStyle;
CTableProp.prototype['get_AllowOverlap'] = CTableProp.prototype.get_AllowOverlap;
CTableProp.prototype['put_AllowOverlap'] = CTableProp.prototype.put_AllowOverlap;
CTableProp.prototype['get_TableLayout'] = CTableProp.prototype.get_TableLayout;
CTableProp.prototype['put_TableLayout'] = CTableProp.prototype.put_TableLayout;
CTableProp.prototype['get_CellsTextDirection'] = CTableProp.prototype.get_CellsTextDirection;
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_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