Commit 97ab08b1 authored by GoshaZotov's avatar GoshaZotov

copy/paste hidden rows

parent 1f69d50e
...@@ -1130,7 +1130,7 @@ ...@@ -1130,7 +1130,7 @@
this.aDxfs = aDxfs; this.aDxfs = aDxfs;
this.bs = new BinaryCommonWriter(this.memory); this.bs = new BinaryCommonWriter(this.memory);
this.isCopyPaste = isCopyPaste; this.isCopyPaste = isCopyPaste;
this.Write = function(aTables) this.Write = function(aTables, ws)
{ {
var oThis = this; var oThis = this;
for(var i = 0, length = aTables.length; i < length; ++i) for(var i = 0, length = aTables.length; i < length; ++i)
...@@ -1140,7 +1140,7 @@ ...@@ -1140,7 +1140,7 @@
if (this.isCopyPaste) if (this.isCopyPaste)
rangeTable = aTables[i].Ref; rangeTable = aTables[i].Ref;
if(!this.isCopyPaste || (this.isCopyPaste && rangeTable && this.isCopyPaste.containsRange(rangeTable))) if(!this.isCopyPaste || (this.isCopyPaste && rangeTable && this.isCopyPaste.containsRange(rangeTable) && !ws.bExcludeHiddenRows))
this.bs.WriteItem(c_oSer_TablePart.Table, function(){oThis.WriteTable(aTables[i]);}); this.bs.WriteItem(c_oSer_TablePart.Table, function(){oThis.WriteTable(aTables[i]);});
} }
}; };
...@@ -2442,7 +2442,7 @@ ...@@ -2442,7 +2442,7 @@
if(null != ws.TableParts && ws.TableParts.length > 0) if(null != ws.TableParts && ws.TableParts.length > 0)
{ {
oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs, this.isCopyPaste); oBinaryTableWriter = new BinaryTableWriter(this.memory, this.aDxfs, this.isCopyPaste);
this.bs.WriteItem(c_oSerWorksheetsTypes.TableParts, function(){oBinaryTableWriter.Write(ws.TableParts);}); this.bs.WriteItem(c_oSerWorksheetsTypes.TableParts, function(){oBinaryTableWriter.Write(ws.TableParts, ws);});
} }
if (ws.aSparklineGroups.length > 0) { if (ws.aSparklineGroups.length > 0) {
this.bs.WriteItem(c_oSerWorksheetsTypes.SparklineGroups, function(){oThis.WriteSparklineGroups(ws.aSparklineGroups);}); this.bs.WriteItem(c_oSerWorksheetsTypes.SparklineGroups, function(){oThis.WriteSparklineGroups(ws.aSparklineGroups);});
...@@ -2475,9 +2475,32 @@ ...@@ -2475,9 +2475,32 @@
//activeRange(serialize activeRange) //activeRange(serialize activeRange)
if(oThis.isCopyPaste) if(oThis.isCopyPaste)
{ {
var activeRange = oThis.isCopyPaste;
var newRange = null;
if(ws.bExcludeHiddenRows)
{
for(var i = activeRange.r1; i < activeRange.r2; i++)
{
if(ws.getRowHidden(i))
{
if(!newRange)
{
newRange = activeRange.clone();
}
newRange.r2--;
}
}
if(newRange)
{
activeRange = newRange;
}
}
this.memory.WriteByte(c_oSerWorksheetPropTypes.Ref); this.memory.WriteByte(c_oSerWorksheetPropTypes.Ref);
this.memory.WriteByte(c_oSerPropLenType.Variable); this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(oThis.isCopyPaste.getName()); this.memory.WriteString2(activeRange.getName());
} }
}; };
this.WriteWorksheetCols = function(ws) this.WriteWorksheetCols = function(ws)
...@@ -3019,16 +3042,38 @@ ...@@ -3019,16 +3042,38 @@
aIndexes.push(i - 0); aIndexes.push(i - 0);
} }
aIndexes.sort(AscCommon.fSortAscending); aIndexes.sort(AscCommon.fSortAscending);
for(var i = 0, length = aIndexes.length; i < length; ++i)
{ var index = aIndexes[0];
var row = ws.aGCells[aIndexes[i]]; for(var i = 0, length = aIndexes.length; i < length; ++i)
if(null != row) {
{ var row = ws.aGCells[aIndexes[i]];
if(false == row.isEmpty()) if(null != row)
this.bs.WriteItem(c_oSerWorksheetsTypes.Row, function(){oThis.WriteRow(row);}); {
} if(ws.bExcludeHiddenRows && oThis.isCopyPaste && row.getHidden())
} {
}; continue;
}
if(false == row.isEmpty())
{
if(oThis.isCopyPaste && ws.bExcludeHiddenRows)
{
//подменяем индекс
var oldIndex = row.index;
row.index = index;
this.bs.WriteItem(c_oSerWorksheetsTypes.Row, function(){oThis.WriteRow(row);});
row.index = oldIndex;
}
else
{
this.bs.WriteItem(c_oSerWorksheetsTypes.Row, function(){oThis.WriteRow(row);});
}
}
}
index++;
}
};
this.WriteRow = function(oRow) this.WriteRow = function(oRow)
{ {
var oThis = this; var oThis = this;
......
...@@ -324,7 +324,15 @@ ...@@ -324,7 +324,15 @@
return; return;
} }
} }
//ignore hidden rows
var selectionRange = activeRange ? activeRange : ws.model.selectionRange.getLast();
var activeCell = ws.model.selectionRange.activeCell.clone();
if(ws.model.autoFilters.bIsExcludeHiddenRows(selectionRange, activeCell))
{
ws.model.excludeHiddenRows(true);
}
//TEXT //TEXT
if (AscCommon.c_oAscClipboardDataFormat.Text & _formats) if (AscCommon.c_oAscClipboardDataFormat.Text & _formats)
{ {
...@@ -369,6 +377,8 @@ ...@@ -369,6 +377,8 @@
_clipboard.pushData(AscCommon.c_oAscClipboardDataFormat.Internal, _data); _clipboard.pushData(AscCommon.c_oAscClipboardDataFormat.Internal, _data);
} }
} }
ws.model.excludeHiddenRows(false);
} }
}, },
...@@ -776,6 +786,11 @@ ...@@ -776,6 +786,11 @@
{ {
for (row = bbox.r1; row <= bbox.r2; ++row) for (row = bbox.r1; row <= bbox.r2; ++row)
{ {
if(worksheet.model.bExcludeHiddenRows && worksheet.model.getRowHidden(row))
{
continue;
}
tr = doc.createElement("TR"); tr = doc.createElement("TR");
h = worksheet.model.getRowHeight(row); h = worksheet.model.getRowHeight(row);
if (h > 0) {tr.style.height = h + "pt";} if (h > 0) {tr.style.height = h + "pt";}
...@@ -969,6 +984,11 @@ ...@@ -969,6 +984,11 @@
var res = ''; var res = '';
for (var row = bbox.r1; row <= bbox.r2; ++row) for (var row = bbox.r1; row <= bbox.r2; ++row)
{ {
if(worksheet.model.bExcludeHiddenRows && worksheet.model.getRowHidden(row))
{
continue;
}
if(row !== bbox.r1) if(row !== bbox.r1)
res += '\n'; res += '\n';
......
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