Commit bf006b95 authored by GoshaZotov's avatar GoshaZotov

insert table from presentation into excel

parent 31433402
...@@ -971,16 +971,8 @@ ...@@ -971,16 +971,8 @@
} }
var objects = this.ReadPresentationShapes(stream, worksheet); var objects = this.ReadPresentationShapes(stream, worksheet);
//****если записана одна табличка, то вставляем html и поддерживаем все цвета и стили****
if(!objects.arrImages.length && objects.arrShapes.length === 1)
{
var drawing = objects.arrShapes[0].graphicObject;
if(typeof CGraphicFrame !== "undefined" && drawing instanceof CGraphicFrame)
return false;
}
var arr_shapes = objects.arrShapes; var arr_shapes = objects.arrShapes;
if(arr_shapes && arr_shapes.length) if(arr_shapes && arr_shapes.length)
{ {
var aPastedImages = objects.arrImages; var aPastedImages = objects.arrImages;
...@@ -1103,6 +1095,14 @@ ...@@ -1103,6 +1095,14 @@
var activeRange = ws.activeRange; var activeRange = ws.activeRange;
var curCol, drawingObject, curRow, startCol, startRow, xfrm, aImagesSync = [], activeRow, activeCol, tempArr, offX, offY, rot; var curCol, drawingObject, curRow, startCol, startRow, xfrm, aImagesSync = [], activeRow, activeCol, tempArr, offX, offY, rot;
//отдельная обработка для вставки одной таблички из презентаций
drawingObject = data.Drawings[0];
if(data.Drawings.length === 1 && typeof AscFormat.CGraphicFrame !== "undefined" && drawingObject.graphicObject instanceof AscFormat.CGraphicFrame)
{
this._insertTableFromPresentation(ws, data.Drawings[0]);
return;
}
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -1171,37 +1171,13 @@ ...@@ -1171,37 +1171,13 @@
} }
} }
} }
}; }
for(var i = 0; i < data.Drawings.length; i++) for(var i = 0; i < data.Drawings.length; i++)
{ {
data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy(); data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy();
drawingObject = data.Drawings[i]; drawingObject = data.Drawings[i];
//отдельная обработка для вставки таблички из презентаций
if(data.Drawings.length === 1 && typeof AscFormat.CGraphicFrame !== "undefined" && drawingObject.graphicObject instanceof AscFormat.CGraphicFrame)
{
//вставляем табличку из презентаций
var oPasteFromBinaryWord = new pasteFromBinaryWord(this, ws);
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
drawingObject.graphicObject.setBDeleted(true);
drawingObject.graphicObject.setWordFlag(false, newCDocument);
var oTempDrawingDocument = ws.model.DrawingDocument;
oTempDrawingDocument.m_oLogicDocument = newCDocument;
drawingObject.graphicObject.graphicObject.Set_Parent(newCDocument);
oPasteFromBinaryWord._paste(ws, {content: [drawingObject.graphicObject.graphicObject]});
return;
}
if(drawingObject.graphicObject.fromSerialize && drawingObject.graphicObject.setBFromSerialize) if(drawingObject.graphicObject.fromSerialize && drawingObject.graphicObject.setBFromSerialize)
{ {
drawingObject.graphicObject.setBFromSerialize(false); drawingObject.graphicObject.setBFromSerialize(false);
...@@ -1256,6 +1232,7 @@ ...@@ -1256,6 +1232,7 @@
ws.objectRender.controller.updateOverlay(); ws.objectRender.controller.updateOverlay();
ws.setSelectionShape(true); ws.setSelectionShape(true);
History.EndTransaction(); History.EndTransaction();
if(aImagesSync.length > 0) if(aImagesSync.length > 0)
{ {
window["Asc"]["editor"].ImageLoader.LoadDocumentImages(aImagesSync, null, window["Asc"]["editor"].ImageLoader.LoadDocumentImages(aImagesSync, null,
...@@ -1280,6 +1257,32 @@ ...@@ -1280,6 +1257,32 @@
}, true); }, true);
}, },
_insertTableFromPresentation: function(ws, graphicFrame)
{
History.TurnOff();
graphicFrame.graphicObject = graphicFrame.graphicObject.copy();
var drawingObject = graphicFrame;
//вставляем табличку из презентаций
var oPasteFromBinaryWord = new pasteFromBinaryWord(this, ws);
var newCDocument = new CDocument(oTempDrawingDocument, false);
newCDocument.bFromDocument = true;
newCDocument.theme = this.Api.wbModel.theme;
drawingObject.graphicObject.setBDeleted(true);
drawingObject.graphicObject.setWordFlag(false, newCDocument);
var oTempDrawingDocument = ws.model.DrawingDocument;
oTempDrawingDocument.m_oLogicDocument = newCDocument;
drawingObject.graphicObject.graphicObject.Set_Parent(newCDocument);
History.TurnOn();
oPasteFromBinaryWord._paste(ws, {content: [drawingObject.graphicObject.graphicObject]});
},
editorPasteExec: function (worksheet, node, isText, onlyFromLocalStorage) editorPasteExec: function (worksheet, node, isText, onlyFromLocalStorage)
{ {
if(node == undefined) if(node == undefined)
...@@ -1777,7 +1780,7 @@ ...@@ -1777,7 +1780,7 @@
var extY = stream.GetULong() / 100000; var extY = stream.GetULong() / 100000;
var base64 = stream.GetString2(); var base64 = stream.GetString2();
if(count !== 1 && typeof CGraphicFrame !== "undefined" && drawing instanceof CGraphicFrame) if(count !== 1 && typeof AscFormat.CGraphicFrame !== "undefined" && drawing instanceof AscFormat.CGraphicFrame)
{ {
drawing = AscFormat.DrawingObjectsController.prototype.createImage(base64, x, y, extX, extY); drawing = AscFormat.DrawingObjectsController.prototype.createImage(base64, x, y, extX, extY);
} }
......
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