Commit 23b35366 authored by GoshaZotov's avatar GoshaZotov

fix bug 32949

parent fdace1b6
...@@ -485,9 +485,9 @@ var editor; ...@@ -485,9 +485,9 @@ var editor;
return AscCommon.g_clipboardBase.Button_Cut(); return AscCommon.g_clipboardBase.Button_Cut();
}; };
spreadsheet_api.prototype.asc_PasteData = function (_format, data1, data2) { spreadsheet_api.prototype.asc_PasteData = function (_format, data1, data2, text_data) {
if (!this.getViewMode()) { if (!this.getViewMode()) {
this.wb.pasteData(_format, data1, data2); this.wb.pasteData(_format, data1, data2, text_data);
} }
}; };
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
} }
}, },
pasteData: function(ws, _format, data1, data2) pasteData: function(ws, _format, data1, data2, text_data)
{ {
var t = this; var t = this;
t.pasteProcessor.clean(); t.pasteProcessor.clean();
...@@ -161,7 +161,14 @@ ...@@ -161,7 +161,14 @@
} }
else else
{ {
t.pasteProcessor.editorPasteExec(ws, data1); if(text_data)
{
t.pasteProcessor.pasteTextOnSheet(ws, text_data);
}
else
{
t.pasteProcessor.editorPasteExec(ws, data1);
}
} }
break; break;
...@@ -2237,10 +2244,7 @@ ...@@ -2237,10 +2244,7 @@
return; return;
} }
//var aResult = this._getTableFromText(text); var aResult = this._getTableFromText(worksheet, text);
var aResult = new excelPasteContent();
aResult = aResult.getDefaultPasteContent(worksheet, this.activeRange.r1, this.activeRange.c1, text);
if(aResult && !(aResult.onlyImages && window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor)) if(aResult && !(aResult.onlyImages && window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor))
{ {
worksheet.setSelectionInfo('paste', aResult, this); worksheet.setSelectionInfo('paste', aResult, this);
...@@ -2447,15 +2451,23 @@ ...@@ -2447,15 +2451,23 @@
return res; return res;
}, },
_getTableFromText: function (sText) _getTableFromText: function (worksheet, sText)
{ {
var activeRange = worksheet.model.selectionRange.getLast().clone(true);
var t = this; var t = this;
var addTextIntoCell = function(row, col, text)
{
var cell = aResult.getCell(rowCounter, colCounter);
cell.content[0] = {text: text, format: {}};
return cell;
};
var aResult = new excelPasteContent(); var aResult = new excelPasteContent();
var width = 0; var width = 0;
var colCounter = 0; var colCounter = activeRange.c1;
var rowCounter = 0; var rowCounter = activeRange.r1;
var sCurPar = "";
var sCurChar = ""; var sCurChar = "";
for ( var i = 0, length = sText.length; i < length; i++ ) for ( var i = 0, length = sText.length; i < length; i++ )
{ {
...@@ -2463,44 +2475,27 @@ ...@@ -2463,44 +2475,27 @@
var Code = sText.charCodeAt(i); var Code = sText.charCodeAt(i);
var Item = null; var Item = null;
if(colCounter > width) if(colCounter - activeRange.c1 > width)
{ {
width = colCounter; width = colCounter - activeRange.c1;
} }
if ( '\n' === Char ) if ( '\n' === Char )
{ {
if("" == sCurChar) if("" == sCurChar)
{ {
var cell = aResult.getCell(rowCounter, colCounter); addTextIntoCell(rowCounter, colCounter, sCurChar);
cell.content[0] = {text: "", format: {}}; colCounter = activeRange.c1;
colCounter = 0;
rowCounter++; rowCounter++;
//sHtml += "<tr><td style='font-family:Calibri'>&nbsp;</td></tr>";
} }
else else
{ {
var cell = aResult.getCell(rowCounter, colCounter); addTextIntoCell(rowCounter, colCounter, sCurChar);
cell.content[0] = {text: sCurChar, format: {}}; colCounter = activeRange.c1;
colCounter = 0;
rowCounter++;
//sHtml += "<tr><td><span style='font-family:Calibri;font-size:11pt;white-space:nowrap'>" + sCurChar + "</span></td></tr>";
sCurChar = "";
}
/*else if(sCurPar != '')
{
var cell = aResult.getCell(rowCounter, colCounter);
cell.content[0] = {text: sCurChar, format: {}};
colCounter = 0;
rowCounter++; rowCounter++;
//sCurPar += "<td><span style='font-family:Calibri;font-size:11pt;white-space:nowrap'>" + sCurChar + "</span></td>";
//sHtml += "<tr>" + sCurPar + "</tr>";
sCurChar = ""; sCurChar = "";
sCurPar = ""; }
}*/
} }
else if ( 13 === Code ) else if ( 13 === Code )
{ {
...@@ -2514,29 +2509,20 @@ ...@@ -2514,29 +2509,20 @@
} }
else if ( 9 === Code )//tab else if ( 9 === Code )//tab
{ {
var cell = aResult.getCell(rowCounter, colCounter); addTextIntoCell(rowCounter, colCounter, sCurChar);
cell.content[0] = {text: sCurChar, format: {}};
colCounter++; colCounter++;
/*sCurPar += "<td><span style='font-family:Calibri;font-size:11pt;white-space:nowrap'>" + sCurChar + "</span></td>"; sCurChar = "";
if(i == length - 1)
{
sHtml += "<tr>" + sCurPar + "</tr>";
}*/
sCurChar = '';
} }
else else
{ {
sCurChar += t._copyPasteCorrectString(Char); sCurChar += t._copyPasteCorrectString(Char);
if(i == length - 1)
{
var cell = aResult.getCell(rowCounter, colCounter);
cell.content[0] = {text: sCurChar, format: {}};
//sCurPar += "<td><span style='font-family:Calibri;font-size:11pt;white-space:nowrap'>" + sCurChar + "</span></td>";
//sHtml += "<tr>" + sCurPar + "</tr>";
}
} }
if(i == length - 1)
{
addTextIntoCell(rowCounter, colCounter, sCurChar);
}
} }
} }
......
...@@ -2025,10 +2025,10 @@ ...@@ -2025,10 +2025,10 @@
t.clipboard.checkCopyToClipboard(ws, _clipboard, _formats); t.clipboard.checkCopyToClipboard(ws, _clipboard, _formats);
}; };
WorkbookView.prototype.pasteData = function(_format, data1, data2) { WorkbookView.prototype.pasteData = function(_format, data1, data2, text_data) {
var t = this, ws; var t = this, ws;
ws = t.getWorksheet(); ws = t.getWorksheet();
t.clipboard.pasteData(ws, _format, data1, data2); t.clipboard.pasteData(ws, _format, data1, data2, text_data);
}; };
WorkbookView.prototype.selectionCut = function() { WorkbookView.prototype.selectionCut = function() {
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
} }
sHtml += "</body></html>"; sHtml += "</body></html>";
this.CommonIframe_PasteStart(sHtml, text_data); this.CommonIframe_PasteStart(sHtml, _text_format);
return false; return false;
} }
......
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