Commit d6c1dcca authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 15005 - Не отменяются границы ячеек загруженной таблицы.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53074 954022d7-b5bf-4e40-9824-e11837661b57
parent 8f16fad1
...@@ -2370,7 +2370,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -2370,7 +2370,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var col = aCols[nIndex]; var col = aCols[nIndex];
if(null != col) if(null != col)
{ {
if(false == col.isEmptyToSave()) if(false == col.isEmpty())
{ {
if(null != oAllCol && null == nPrevIndex && nIndex > 0) if(null != oAllCol && null == nPrevIndex && nIndex > 0)
{ {
...@@ -2772,7 +2772,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -2772,7 +2772,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var row = ws.aGCells[aIndexes[i]]; var row = ws.aGCells[aIndexes[i]];
if(null != row) if(null != row)
{ {
if(false == row.isEmptyToSave()) if(false == row.isEmpty())
this.bs.WriteItem(c_oSerWorksheetsTypes.Row, function(){oThis.WriteRow(row);}); this.bs.WriteItem(c_oSerWorksheetsTypes.Row, function(){oThis.WriteRow(row);});
} }
} }
...@@ -2838,7 +2838,8 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF ...@@ -2838,7 +2838,8 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
if(!oThis.isCopyPaste || (oThis.isCopyPaste && cell)) if(!oThis.isCopyPaste || (oThis.isCopyPaste && cell))
{ {
var nXfsId = this.prepareXfs(cell.xfs); var nXfsId = this.prepareXfs(cell.xfs);
if(0 != nXfsId || false == cell.isEmptyText()) //сохраняем как и Excel даже пустой стиль(нужно чтобы убрать стиль строки/колонки)
if(null != cell.xfs || false == cell.isEmptyText())
this.bs.WriteItem(c_oSerRowTypes.Cell, function(){oThis.WriteCell(cell, nXfsId);}); this.bs.WriteItem(c_oSerRowTypes.Cell, function(){oThis.WriteCell(cell, nXfsId);});
}; };
}; };
......
...@@ -5530,589 +5530,166 @@ Range.prototype.setBorderSrc=function(border){ ...@@ -5530,589 +5530,166 @@ Range.prototype.setBorderSrc=function(border){
}); });
History.EndTransaction(); History.EndTransaction();
}; };
Range.prototype.setBorder=function(border){ Range.prototype._setBorderMerge=function(bLeft, bTop, bRight, bBottom, oNewBorder, oCurBorder){
History.Create_NewPoint(); var oTargetBorder = new Border();
//border = null очисть border //не делаем clone для свойств потому у нас нельзя поменять свойство отдельное свойство border можно только применить border целиком
//"ih" - внутренние горизонтальные, "iv" - внутренние вертикальные if(bLeft)
var oBBox = this.bbox; oTargetBorder.l = oNewBorder.l;
var nRangeType = this._getRangeType(); else
var oThis = this; oTargetBorder.l = oNewBorder.iv;
var fSetBorder = function(nRow, nCol, oNewBorder) if(bTop)
oTargetBorder.t = oNewBorder.t;
else
oTargetBorder.t = oNewBorder.ih;
if(bRight)
oTargetBorder.r = oNewBorder.r;
else
oTargetBorder.r = oNewBorder.iv;
if(bBottom)
oTargetBorder.b = oNewBorder.b;
else
oTargetBorder.b = oNewBorder.ih;
oTargetBorder.dd = oNewBorder.dd;
oTargetBorder.du = oNewBorder.du;
var oRes = null;
if(null != oCurBorder)
{ {
oCurBorder.mergeInner(oTargetBorder);
oRes = oCurBorder;
}
else
oRes = oTargetBorder;
return oRes;
}
Range.prototype._setCellBorder=function(bbox, cell, oNewBorder){
if(null == oNewBorder) if(null == oNewBorder)
{
var cell = oThis.worksheet._getCellNoEmpty(nRow, nCol);
if(null != cell)
cell.setBorder(oNewBorder); cell.setBorder(oNewBorder);
}
else else
{ {
if(oNewBorder.isEqual(g_oDefaultBorderAbs)) var oCurBorder = null;
return; if(null != cell.xfs && null != cell.xfs.border)
var _cell = oThis.worksheet.getCell(new CellAddress(nRow, nCol, 0)); oCurBorder = cell.xfs.border.clone();
var oCurBorder = _cell.getBorderSrc().clone(); var nRow = cell.oId.getRow0();
oCurBorder.mergeInner(oNewBorder); var nCol = cell.oId.getCol0();
var cell = oThis.worksheet._getCell(nRow, nCol); cell.setBorder(this._setBorderMerge(nCol == bbox.c1, nRow == bbox.r1, nCol == bbox.c2, nRow == bbox.r2, oNewBorder, oCurBorder));
cell.setBorder(oCurBorder);
} }
}; }
var fSetBorderRowCol = function(rowcol, oNewBorder) Range.prototype._setRowColBorder=function(bbox, rowcol, bRow, oNewBorder){
{
if(null == oNewBorder) if(null == oNewBorder)
rowcol.setBorder(null); rowcol.setBorder(oNewBorder);
else else
{ {
if(oNewBorder.isEqual(g_oDefaultBorderAbs)) var oCurBorder = null;
return;
var oCurBorder;
if(null != rowcol.xfs && null != rowcol.xfs.border) if(null != rowcol.xfs && null != rowcol.xfs.border)
oCurBorder = rowcol.xfs.border.clone(); oCurBorder = rowcol.xfs.border.clone();
else var bLeft, bTop, bRight, bBottom = false;
oCurBorder = new Border(); if(bRow)
oCurBorder.mergeInner(oNewBorder); {
rowcol.setBorder(oNewBorder); bTop = rowcol.index == bbox.r1;
bBottom = rowcol.index == bbox.r2;
} }
}; else
var nEdgeTypeLeft = 1;
var nEdgeTypeTop = 2;
var nEdgeTypeRight = 3;
var nEdgeTypeBottom = 4;
var fSetBorderEdge = function(nRow, nCol, oNewBorder, type)
{
var _cell = oThis.worksheet.getCell(new CellAddress(nRow, nCol, 0));
var oCurBorder = _cell.getBorderSrc().clone();
var oCurBorderProp;
var oNewBorderProp = null;
if(null == oNewBorder)
oNewBorderProp = new BorderProp();
switch(type)
{ {
case nEdgeTypeLeft: bLeft = rowcol.index == bbox.c1;
bRight = rowcol.index == bbox.c2;
}
rowcol.setBorder(this._setBorderMerge(bLeft, bTop, bRight, bBottom, oNewBorder, oCurBorder));
}
}
Range.prototype._setBorderEdge=function(bbox, oItemWithXfs, nRow, nCol, oNewBorder){
var oCurBorder = null;
if(null != oItemWithXfs.xfs && null != oItemWithXfs.xfs.border)
oCurBorder = oItemWithXfs.xfs.border;
if(null != oCurBorder)
{
var oCurBorderProp = null;
if(nCol == bbox.c1 - 1)
oCurBorderProp = oCurBorder.r; oCurBorderProp = oCurBorder.r;
if(null != oNewBorder) else if(nRow == bbox.r1 - 1)
oNewBorderProp = oNewBorder.l;
break;
case nEdgeTypeTop:
oCurBorderProp = oCurBorder.b; oCurBorderProp = oCurBorder.b;
if(null != oNewBorder) else if(nCol == bbox.c2 + 1)
oNewBorderProp = oNewBorder.t;
break;
case nEdgeTypeRight:
oCurBorderProp = oCurBorder.l; oCurBorderProp = oCurBorder.l;
if(null != oNewBorder) else if(nRow == bbox.r2 + 1)
oNewBorderProp = oNewBorder.r;
break;
case nEdgeTypeBottom:
oCurBorderProp = oCurBorder.t; oCurBorderProp = oCurBorder.t;
if(null != oNewBorder) var oNewBorderProp = null;
oNewBorderProp = oNewBorder.b;
break;
}
if(null != oNewBorderProp && null != oCurBorderProp && c_oAscBorderStyles.None != oCurBorderProp.s && (null == oNewBorder || c_oAscBorderStyles.None != oNewBorderProp.s) &&
(oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.getRgbOrNull() != oCurBorderProp.getRgbOrNull())){
switch(type)
{
case nEdgeTypeLeft: oCurBorder.r = new BorderProp(); break;
case nEdgeTypeTop: oCurBorder.b = new BorderProp(); break;
case nEdgeTypeRight: oCurBorder.l = new BorderProp(); break;
case nEdgeTypeBottom: oCurBorder.t = new BorderProp(); break;
}
var cell = oThis.worksheet._getCell(nRow, nCol);
cell.setBorder(oCurBorder);
}
};
var fSetBorderRowColEdge = function(rowcol, oNewBorder, type)
{
if(null != rowcol.xfs && null != rowcol.xfs.border)
{
var oCurBorder = rowcol.xfs.border.clone();
var oCurBorderProp;
var oNewBorderProp;
if(null == oNewBorder) if(null == oNewBorder)
oNewBorderProp = new BorderProp(); oNewBorderProp = new BorderProp();
switch(type) else
{ {
case nEdgeTypeLeft: if(nCol == bbox.c1 - 1)
oCurBorderProp = oCurBorder.r;
if(null != oNewBorder)
oNewBorderProp = oNewBorder.l; oNewBorderProp = oNewBorder.l;
break; else if(nRow == bbox.r1 - 1)
case nEdgeTypeTop:
oCurBorderProp = oCurBorder.b;
if(null != oNewBorder)
oNewBorderProp = oNewBorder.t; oNewBorderProp = oNewBorder.t;
break; else if(nCol == bbox.c2 + 1)
case nEdgeTypeRight:
oCurBorderProp = oCurBorder.l;
if(null != oNewBorder)
oNewBorderProp = oNewBorder.r; oNewBorderProp = oNewBorder.r;
break; else if(nRow == bbox.r2 + 1)
case nEdgeTypeBottom:
oCurBorderProp = oCurBorder.t;
if(null != oNewBorder)
oNewBorderProp = oNewBorder.b; oNewBorderProp = oNewBorder.b;
break;
} }
if(null != oNewBorderProp && null != oCurBorderProp && c_oAscBorderStyles.None != oCurBorderProp.s && (null == oNewBorder || c_oAscBorderStyles.None != oNewBorderProp.s) && if(null != oNewBorderProp && null != oCurBorderProp && c_oAscBorderStyles.None != oCurBorderProp.s && (null == oNewBorder || c_oAscBorderStyles.None != oNewBorderProp.s) &&
(oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.getRgbOrNull() != oCurBorderProp.getRgbOrNull())){ (oNewBorderProp.s != oCurBorderProp.s || oNewBorderProp.getRgbOrNull() != oCurBorderProp.getRgbOrNull())){
switch(type) var oTargetBorder = oCurBorder.clone();
{ if(nCol == bbox.c1 - 1)
case nEdgeTypeLeft: oCurBorder.r = new BorderProp(); break; oTargetBorder.r = oNewBorderProp;
case nEdgeTypeTop: oCurBorder.b = new BorderProp(); break; else if(nRow == bbox.r1 - 1)
case nEdgeTypeRight: oCurBorder.l = new BorderProp(); break; oTargetBorder.b = oNewBorderProp;
case nEdgeTypeBottom: oCurBorder.t = new BorderProp(); break; else if(nCol == bbox.c2 + 1)
} oTargetBorder.l = oNewBorderProp;
rowcol.setBorder(oCurBorder); else if(nRow == bbox.r2 + 1)
} oTargetBorder.t = oNewBorderProp;
} oItemWithXfs.setBorder(oTargetBorder);
};
if (null != border && border.isEqual(g_oDefaultBorderAbs))
border = null;
if(nRangeType == c_oRangeType.Col)
{
var oLeftOuter = null;
var oLeftInner = null;
var oInner = null;
var oRightInner = null;
var oRightOuter = null;
var nWidth = oBBox.c2 - oBBox.c1 + 1;
if(null != border)
{
if(oBBox.c1 > 0 && null != border.l)
{
oLeftOuter = new Border();
oLeftOuter.l = border.l;
}
if(oBBox.c2 < gc_nMaxCol0 && null != border.r)
{
oRightOuter = new Border();
oRightOuter.r = border.r;
}
oLeftInner = new Border();
oLeftInner.l = border.l;
oLeftInner.t = border.ih;
if(nWidth > 1)
oLeftInner.r = border.iv;
else
oLeftInner.r = border.r;
oLeftInner.b = border.ih;
oLeftInner.d = border.d;
oLeftInner.dd = border.dd;
oLeftInner.du = border.du;
if(oLeftInner.isEqual(g_oDefaultBorderAbs))
oLeftInner = null;
if(nWidth > 1)
{
oRightInner = new Border();
oRightInner.l = border.iv;
oRightInner.t = border.ih;
oRightInner.r = border.r;
oRightInner.b = border.ih;
oRightInner.d = border.d;
oRightInner.dd = border.dd;
oRightInner.du = border.du;
if(oRightInner.isEqual(g_oDefaultBorderAbs))
oRightInner = null;
}
if(nWidth > 2)
{
oInner = new Border();
oInner.l = border.iv;
oInner.t = border.ih;
oInner.r = border.iv;
oInner.b = border.ih;
oInner.d = border.d;
oInner.dd = border.dd;
oInner.du = border.du;
if(oInner.isEqual(g_oDefaultBorderAbs))
oInner = null;
}
}
//oLeftOuter
if(oBBox.c1 > 0)
{
var oTempRange = this.worksheet.getRange(new CellAddress(0, oBBox.c1 - 1, 0), new CellAddress(gc_nMaxRow0, oBBox.c1 - 1, 0));
oTempRange._foreachColNoEmpty(function(col){
if(null != col.xfs)
fSetBorderRowColEdge(col, oLeftOuter, nEdgeTypeLeft);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorderEdge(nRow, nCol ,oLeftOuter, nEdgeTypeLeft);
});
}
//oLeftInner
var oTempRange = this.worksheet.getRange(new CellAddress(0, oBBox.c1, 0), new CellAddress(gc_nMaxRow0, oBBox.c1, 0));
oTempRange._foreachCol(function(col){
fSetBorderRowCol(col, oLeftInner);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorder(nRow, nCol ,oLeftInner);
});
//oInner
if(nWidth > 2)
{
var oTempRange = this.worksheet.getRange(new CellAddress(0, oBBox.c1 + 1, 0), new CellAddress(gc_nMaxRow0, oBBox.c2 - 1, 0));
oTempRange._foreachCol(function(col){
fSetBorderRowCol(col, oInner);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorder(nRow, nCol ,oInner);
});
} }
//oRightInner
if(nWidth > 1)
{
var oTempRange = this.worksheet.getRange(new CellAddress(0, oBBox.c2, 0), new CellAddress(gc_nMaxRow0, oBBox.c2, 0));
oTempRange._foreachCol(function(col){
fSetBorderRowCol(col, oRightInner);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorder(nRow, nCol ,oRightInner);
});
} }
//oRightOuter }
if(oBBox.c2 < gc_nMaxCol0) Range.prototype.setBorder=function(border){
{ //border = null очисть border
var oTempRange = this.worksheet.getRange(new CellAddress(0, oBBox.c2 + 1, 0), new CellAddress(gc_nMaxRow0, oBBox.c2 + 1, 0)); //"ih" - внутренние горизонтальные, "iv" - внутренние вертикальные
oTempRange._foreachColNoEmpty(function(col){ History.Create_NewPoint();
if(null != col.xfs) var _this = this;
fSetBorderRowColEdge(col, oRightOuter, nEdgeTypeRight); var oBBox = this.bbox;
}, this.createCellOnRowColCross();
function(cell, nRow, nCol, nRowStart, nColStart){ var fSetProperty = this._setProperty;
fSetBorderEdge(nRow, nCol ,oRightOuter, nEdgeTypeRight); var nRangeType = this._getRangeType();
}); if(c_oRangeType.All == nRangeType)
}
}
else if(nRangeType == c_oRangeType.Row)
{
var oTopOuter = null;
var oTopInner = null;
var oInner = null;
var oBottomInner = null;
var oBottomOuter = null;
var nHeight = oBBox.r2 - oBBox.r1 + 1;
if(null != border)
{
if(oBBox.r1 > 0 && null != border.t)
{
oTopOuter = new Border();
oTopOuter.t = border.t;
}
if(oBBox.r2 < gc_nMaxRow0 && null != border.b)
{
oBottomOuter = new Border();
oBottomOuter.b = border.b;
}
oTopInner = new Border();
oTopInner.l = border.iv;
oTopInner.t = border.t;
oTopInner.r = border.iv;
if(nHeight > 1)
oTopInner.b = border.ih;
else
oTopInner.b = border.b;
oTopInner.d = border.d;
oTopInner.dd = border.dd;
oTopInner.du = border.du;
if(oTopInner.isEqual(g_oDefaultBorderAbs))
oTopInner = null;
if(nHeight > 1)
{
oBottomInner = new Border();
oBottomInner.l = border.iv;
oBottomInner.t = border.ih;
oBottomInner.r = border.iv;
oBottomInner.b = border.b;
oBottomInner.d = border.d;
oBottomInner.dd = border.dd;
oBottomInner.du = border.du;
if(oBottomInner.isEqual(g_oDefaultBorderAbs))
oBottomInner = null;
}
if(nHeight > 2)
{
oInner = new Border();
oInner.l = border.iv;
oInner.t = border.ih;
oInner.r = border.iv;
oInner.b = border.ih;
oInner.d = border.d;
oInner.dd = border.dd;
oInner.du = border.du;
if(oInner.isEqual(g_oDefaultBorderAbs))
oInner = null;
}
}
//oTopOuter
if(oBBox.r1 > 0)
{
var oTempRange = this.worksheet.getRange(new CellAddress(oBBox.r1 - 1, 0, 0), new CellAddress(oBBox.r1 - 1, gc_nMaxCol0, 0));
oTempRange._foreachRowNoEmpty(function(row){
if(null != row.xfs)
fSetBorderRowColEdge(row, oTopOuter, nEdgeTypeTop);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorderEdge(nRow, nCol ,oTopOuter, nEdgeTypeTop);
});
}
//oTopInner
var oTempRange = this.worksheet.getRange(new CellAddress(oBBox.r1, 0, 0), new CellAddress(oBBox.r1, gc_nMaxCol0, 0));
oTempRange._foreachRow(function(row){
fSetBorderRowCol(row, oTopInner);
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorder(nRow, nCol ,oTopInner);
});
//oInner
if(nHeight > 2)
{ {
var oTempRange = this.worksheet.getRange(new CellAddress(oBBox.r1 + 1, 0, 0), new CellAddress(oBBox.r2 - 1, gc_nMaxCol0, 0)); var oAllCol = this.worksheet.getAllCol();
oTempRange._foreachRow(function(row){ _this._setRowColBorder(oBBox, oAllCol, false, border);
fSetBorderRowCol(row, oInner); fSetProperty = this._setPropertyNoEmpty;
},
function(cell, nRow, nCol, nRowStart, nColStart){
fSetBorder(nRow, nCol ,oInner);
});
} }
//oBottomInner fSetProperty.call(this, function(row){
if(nHeight > 1) if(c_oRangeType.All == nRangeType && null == row.xfs)
{ return;
var oTempRange = this.worksheet.getRange(new CellAddress(oBBox.r2, 0, 0), new CellAddress(oBBox.r2, gc_nMaxCol0, 0)); _this._setRowColBorder(oBBox, row, true, border);
oTempRange._foreachRow(function(row){
fSetBorderRowCol(row, oBottomInner);
}, },
function(cell, nRow, nCol, nRowStart, nColStart){ function(col){
fSetBorder(nRow, nCol ,oBottomInner); _this._setRowColBorder(oBBox, col, false, border);
});
}
//oBottomOuter
if(oBBox.r2 < gc_nMaxRow0)
{
var oTempRange = this.worksheet.getRange(new CellAddress(oBBox.r2 + 1, 0, 0), new CellAddress(oBBox.r2 + 1, gc_nMaxCol0, 0));
oTempRange._foreachRowNoEmpty(function(row){
if(null != row.xfs)
fSetBorderRowColEdge(row, oBottomOuter, nEdgeTypeBottom);
}, },
function(cell, nRow, nCol, nRowStart, nColStart){ function(cell){
fSetBorderEdge(nRow, nCol ,oBottomOuter, nEdgeTypeBottom); _this._setCellBorder(oBBox, cell, border);
});
}
}
else if(nRangeType == c_oRangeType.Range)
{
var bLeftBorder = false;
var bTopBorder = false;
var bRightBorder = false;
var bBottomBorder = false;
if(null == border){
this._foreachNoEmpty(function(cell){
cell.setBorder(border);
}); });
bLeftBorder = true; //убираем граничные border
bTopBorder = true; var aEdgeBorders = [];
bRightBorder = true; if(oBBox.c1 > 0 && (null == border || !border.l.isEmpty()))
bBottomBorder = true; aEdgeBorders.push(this.worksheet.getRange3(oBBox.r1, oBBox.c1 - 1, oBBox.r2, oBBox.c1 - 1));
} if(oBBox.r1 > 0 && (null == border || !border.t.isEmpty()))
else{ aEdgeBorders.push(this.worksheet.getRange3(oBBox.r1 - 1, oBBox.c1, oBBox.r1 - 1, oBBox.c2));
bLeftBorder = null != border.l; if(oBBox.c2 < gc_nMaxCol0 && (null == border || !border.r.isEmpty()))
bTopBorder = null != border.t; aEdgeBorders.push(this.worksheet.getRange3(oBBox.r1, oBBox.c2 + 1, oBBox.r2, oBBox.c2 + 1));
bRightBorder = null != border.r; if(oBBox.r2 < gc_nMaxRow0 && (null == border || !border.b.isEmpty()))
bBottomBorder = null != border.b; aEdgeBorders.push(this.worksheet.getRange3(oBBox.r2 + 1, oBBox.c1, oBBox.r2 + 1, oBBox.c2));
var bInnerHBorder = null != border.ih; for(var i = 0, length = aEdgeBorders.length; i < length; i++)
var bInnerVBorder = null != border.iv; {
var bDiagonal = null != border.d; var range = aEdgeBorders[i];
if(oBBox.c1 == oBBox.c2 && oBBox.r1 == oBBox.r2){ range._setPropertyNoEmpty(function(row){
//Если ячейка одна if(c_oRangeType.All == nRangeType && null == row.xfs)
fSetBorder(oBBox.r1, oBBox.c1, border); return;
} _this._setBorderEdge(oBBox, row, row.index, 0, border);
else{
//бордеры угловых ячеек
if(oBBox.c1 == oBBox.c2){
if(bLeftBorder || bTopBorder || bRightBorder || bInnerHBorder || bDiagonal){
var oLTBorder = new Border();
oLTBorder.l = border.l;
oLTBorder.t = border.t;
oLTBorder.r = border.r;
oLTBorder.b = border.ih;
oLTBorder.d = border.d;
oLTBorder.dd = border.dd;
oLTBorder.du = border.du;
fSetBorder(oBBox.r1, oBBox.c1, oLTBorder);
}
if(bLeftBorder || bBottomBorder || bRightBorder || bInnerHBorder || bDiagonal){
var oLBBorder = new Border();
oLBBorder.l = border.l;
oLBBorder.t = border.ih;
oLBBorder.r = border.r;
oLBBorder.b = border.b;
oLBBorder.d = border.d;
oLBBorder.dd = border.dd;
oLBBorder.du = border.du;
fSetBorder(oBBox.r2, oBBox.c1, oLBBorder);
}
}
else{
if(bLeftBorder || bTopBorder || bInnerVBorder || (oBBox.r1 == oBBox.r2 ? bBottomBorder : bInnerHBorder) || bDiagonal){
var oLTBorder = new Border();
oLTBorder.l = border.l;
oLTBorder.t = border.t;
oLTBorder.r = border.iv;
if(oBBox.r1 == oBBox.r2)
oLTBorder.b = border.b;
else
oLTBorder.b = border.ih;
oLTBorder.d = border.d;
oLTBorder.dd = border.dd;
oLTBorder.du = border.du;
fSetBorder(oBBox.r1, oBBox.c1, oLTBorder);
}
if(oBBox.r1 != oBBox.r2 && (bLeftBorder || bInnerVBorder || bInnerHBorder || bBottomBorder || bDiagonal)){
var oLBBorder = new Border();
oLBBorder.l = border.l;
oLBBorder.t = border.ih;
oLBBorder.r = border.iv;
oLBBorder.b = border.b;
oLBBorder.d = border.d;
oLBBorder.dd = border.dd;
oLBBorder.du = border.du;
fSetBorder(oBBox.r2, oBBox.c1, oLBBorder);
}
if(bRightBorder || bTopBorder || bInnerVBorder || (oBBox.r1 == oBBox.r2 ? bBottomBorder : bInnerHBorder) || bDiagonal){
var oRTBorder = new Border();
oRTBorder.l = border.iv;
oRTBorder.t = border.t;
oRTBorder.r = border.r;
if(oBBox.r1 == oBBox.r2)
oRTBorder.b = border.b;
else
oRTBorder.b = border.ih;
oRTBorder.d = border.d;
oRTBorder.dd = border.dd;
oRTBorder.du = border.du;
fSetBorder(oBBox.r1, oBBox.c2, oRTBorder);
}
if(oBBox.r1 != oBBox.r2 && (bRightBorder || bInnerHBorder || bInnerVBorder || bBottomBorder || bDiagonal) ){
var oRBBorder = new Border();
oRBBorder.l = border.iv;
oRBBorder.t = border.ih;
oRBBorder.r = border.r;
oRBBorder.b = border.b;
oRBBorder.d = border.d;
oRBBorder.dd = border.dd;
oRBBorder.du = border.du;
fSetBorder(oBBox.r2, oBBox.c2, oRBBorder);
}
}
//граничные бордеры
if(bTopBorder || bInnerVBorder || (oBBox.r1 == oBBox.r2 ? bBottomBorder : bInnerHBorder) || bDiagonal){
for(var i = oBBox.c1 + 1 ; i < oBBox.c2; i++){
var oTopBorder = new Border();
oTopBorder.l = border.iv;
oTopBorder.t = border.t;
oTopBorder.r = border.iv;
if(oBBox.r1 == oBBox.r2)
oTopBorder.b = border.b;
else
oTopBorder.b = border.ih;
oTopBorder.d = border.d;
oTopBorder.dd = border.dd;
oTopBorder.du = border.du;
fSetBorder(oBBox.r1, i, oTopBorder);
}
}
if(oBBox.r1 != oBBox.r2 && (bBottomBorder || bInnerVBorder || bInnerHBorder || bDiagonal)){
for(var i = oBBox.c1 + 1 ; i < oBBox.c2; i++){
var oBottomBorder = new Border();
oBottomBorder.l = border.iv;
oBottomBorder.t = border.ih;
oBottomBorder.r = border.iv;
oBottomBorder.b = border.b;
oBottomBorder.d = border.d;
oBottomBorder.dd = border.dd;
oBottomBorder.du = border.du;
fSetBorder(oBBox.r2, i, oBottomBorder);
}
}
if(bLeftBorder || bInnerHBorder || (oBBox.c1 == oBBox.c2 ? bRightBorder : bInnerVBorder) || bDiagonal){
for(var i = oBBox.r1 + 1 ; i < oBBox.r2; i++){
var oLeftBorder = new Border();
oLeftBorder.l = border.l;
oLeftBorder.t = border.ih;
if(oBBox.c1 == oBBox.c2)
oLeftBorder.r = border.r;
else
oLeftBorder.r = border.iv;
oLeftBorder.b = border.ih;
oLeftBorder.d = border.d;
oLeftBorder.dd = border.dd;
oLeftBorder.du = border.du;
fSetBorder(i, oBBox.c1, oLeftBorder);
}
}
if(oBBox.c1 != oBBox.c2 && (bRightBorder || bInnerVBorder || bInnerHBorder || bDiagonal)){
for(var i = oBBox.r1 + 1 ; i < oBBox.r2; i++){
var oRightBorder = new Border();
oRightBorder.l = border.iv;
oRightBorder.t = border.ih;
oRightBorder.r = border.r;
oRightBorder.b = border.ih;
oRightBorder.d = border.d;
oRightBorder.dd = border.dd;
oRightBorder.du = border.du;
fSetBorder(i, oBBox.c2, oRightBorder);
}
}
//Внутренние границы
if(bInnerHBorder || bInnerVBorder || bDiagonal){
for(var i = oBBox.r1 + 1 ; i < oBBox.r2; i++){
for(var j = oBBox.c1 + 1 ; j < oBBox.c2; j++){
var oInnerBorder = new Border();
oInnerBorder.l = border.iv;
oInnerBorder.t = border.ih;
oInnerBorder.r = border.iv;
oInnerBorder.b = border.ih;
oInnerBorder.d = border.d;
oInnerBorder.dd = border.dd;
oInnerBorder.du = border.du;
fSetBorder(i, j, oInnerBorder);
}
}
}
}
}
//для граничных ячеек стираем border
if(bLeftBorder && oBBox.c1 > 0){
var nCol = oBBox.c1 - 1;
for(var i = oBBox.r1 ; i <= oBBox.r2; i++)
fSetBorderEdge(i, nCol, border, nEdgeTypeLeft);
}
if(bTopBorder && oBBox.r1 > 0){
var nRow = oBBox.r1 - 1;
for(var i = oBBox.c1 ; i <= oBBox.c2; i++)
fSetBorderEdge(nRow, i, border, nEdgeTypeTop);
}
if(bRightBorder && oBBox.c2 + 1 < this.worksheet.getColsCount()){
var nCol = oBBox.c2 + 1;
for(var i = oBBox.r1 ; i <= oBBox.r2; i++)
fSetBorderEdge(i, nCol, border, nEdgeTypeRight);
}
if(bBottomBorder && oBBox.r2 + 1 < this.worksheet.getRowsCount()){
var nRow = oBBox.r2 + 1;
for(var i = oBBox.c1 ; i <= oBBox.c2; i++)
fSetBorderEdge(nRow, i, border, nEdgeTypeBottom);
}
}
else
{
this.worksheet.getAllCol().setBorder(border);
this._setPropertyNoEmpty(function(row){
row.setBorder(border);
}, },
function(col){ function(col){
col.setBorder(border); _this._setBorderEdge(oBBox, col, 0, col.index, border);
}, },
function(cell){ function(cell){
cell.setBorder(border); _this._setBorderEdge(oBBox, cell, cell.oId.getRow0(), cell.oId.getCol0(), border);
}); });
} }
}; };
...@@ -8327,15 +7904,21 @@ Range.prototype.createCellOnRowColCross=function(){ ...@@ -8327,15 +7904,21 @@ Range.prototype.createCellOnRowColCross=function(){
if(c_oRangeType.Row == nRangeType) if(c_oRangeType.Row == nRangeType)
{ {
this._foreachColNoEmpty(function(col){ this._foreachColNoEmpty(function(col){
if(null != col.xfs)
{
for(var i = bbox.r1; i <= bbox.r2; ++i) for(var i = bbox.r1; i <= bbox.r2; ++i)
oThis.worksheet._getCell(i, col.index); oThis.worksheet._getCell(i, col.index);
}
}, null); }, null);
} }
else if(c_oRangeType.Col == nRangeType) else if(c_oRangeType.Col == nRangeType)
{ {
this._foreachRowNoEmpty(function(row){ this._foreachRowNoEmpty(function(row){
if(null != row.xfs)
{
for(var i = bbox.c1; i <= bbox.c2; ++i) for(var i = bbox.c1; i <= bbox.c2; ++i)
oThis.worksheet._getCell(row.index, i); oThis.worksheet._getCell(row.index, i);
}
}, null); }, null);
} }
} }
......
...@@ -2050,13 +2050,9 @@ Col.prototype = ...@@ -2050,13 +2050,9 @@ Col.prototype =
} }
return bRes; return bRes;
}, },
isEmptyToSave : function()
{
return null == this.BestFit && null == this.hd && null == this.width && null == this.xfs && null == this.CustomWidth;
},
isEmpty : function() isEmpty : function()
{ {
return this.isEmptyToSave(); return null == this.BestFit && null == this.hd && null == this.width && null == this.xfs && null == this.CustomWidth;
}, },
Remove : function() Remove : function()
{ {
...@@ -2303,7 +2299,7 @@ Row.prototype = ...@@ -2303,7 +2299,7 @@ Row.prototype =
{ {
this.r += nDif; this.r += nDif;
}, },
isEmptyToSave : function() isEmpty : function()
{ {
if(null != this.xfs || null != this.h || null != this.hd || null != this.CustomHeight) if(null != this.xfs || null != this.h || null != this.hd || null != this.CustomHeight)
return false; return false;
...@@ -2317,10 +2313,6 @@ Row.prototype = ...@@ -2317,10 +2313,6 @@ Row.prototype =
return false; return false;
return true; return true;
}, },
isEmpty : function()
{
return this.isEmptyToSave();
},
Remove : function() Remove : function()
{ {
this.ws._removeRow(this.index); this.ws._removeRow(this.index);
......
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